blob: 394e902ec27e2ca53539bd65aab734aaf90b0785 [file] [log] [blame]
Winson Chung55893332017-02-17 17:13:10 -08001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server.am;
18
19import android.app.RemoteAction;
20import android.graphics.Rect;
21
22import com.android.server.am.ActivityStackSupervisor.ActivityContainer;
23import com.android.server.wm.PinnedStackWindowController;
24import com.android.server.wm.StackWindowController;
25
Winson Chung5af42fc2017-03-24 17:11:33 -070026import java.util.ArrayList;
Winson Chung55893332017-02-17 17:13:10 -080027import java.util.List;
28
29/**
30 * State and management of the pinned stack of activities.
31 */
32class PinnedActivityStack extends ActivityStack<PinnedStackWindowController> {
33
34 PinnedActivityStack(ActivityContainer activityContainer,
35 RecentTasks recentTasks, boolean onTop) {
36 super(activityContainer, recentTasks, onTop);
37 }
38
39 @Override
40 PinnedStackWindowController createStackWindowController(int displayId, boolean onTop,
41 Rect outBounds) {
42 return new PinnedStackWindowController(mStackId, this, displayId, onTop, outBounds);
43 }
44
Winson Chung08f81892017-03-02 15:40:51 -080045 void animateResizePinnedStack(Rect sourceBounds, Rect destBounds, int animationDuration) {
46 getWindowContainerController().animateResizePinnedStack(sourceBounds, destBounds,
47 animationDuration);
Winson Chung55893332017-02-17 17:13:10 -080048 }
49
50 void setPictureInPictureAspectRatio(float aspectRatio) {
51 getWindowContainerController().setPictureInPictureAspectRatio(aspectRatio);
52 }
53
54 void setPictureInPictureActions(List<RemoteAction> actions) {
55 getWindowContainerController().setPictureInPictureActions(actions);
56 }
Winson Chung02e71932017-03-10 10:08:17 -080057
58 boolean isBoundsAnimatingToFullscreen() {
59 return getWindowContainerController().isBoundsAnimatingToFullscreen();
60 }
Winson Chung5af42fc2017-03-24 17:11:33 -070061
62 @Override
63 public void updatePictureInPictureModeForPinnedStackAnimation(Rect targetStackBounds) {
64 // It is guaranteed that the activities requiring the update will be in the pinned stack at
65 // this point (either reparented before the animation into PiP, or before reparenting after
66 // the animation out of PiP)
67 synchronized(this) {
68 ArrayList<TaskRecord> tasks = getAllTasks();
69 for (int i = 0; i < tasks.size(); i++ ) {
70 mStackSupervisor.scheduleUpdatePictureInPictureModeIfNeeded(tasks.get(i),
71 targetStackBounds, true /* immediate */);
72 }
73 }
74 }
Winson Chung55893332017-02-17 17:13:10 -080075}