• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
17 package com.android.systemui.shared.system;
18 
19 import android.app.ActivityManager.RunningTaskInfo;
20 import android.app.ITaskStackListener;
21 import android.content.ComponentName;
22 import android.os.IBinder;
23 
24 import com.android.systemui.shared.recents.model.ThumbnailData;
25 
26 /**
27  * An interface to track task stack changes. Classes should implement this instead of
28  * {@link android.app.ITaskStackListener} to reduce IPC calls from system services.
29  */
30 public abstract class TaskStackChangeListener {
31 
32     // Binder thread callbacks
onTaskStackChangedBackground()33     public void onTaskStackChangedBackground() { }
34 
35     // Main thread callbacks
onTaskStackChanged()36     public void onTaskStackChanged() { }
onTaskSnapshotChanged(int taskId, ThumbnailData snapshot)37     public void onTaskSnapshotChanged(int taskId, ThumbnailData snapshot) { }
onActivityPinned(String packageName, int userId, int taskId, int stackId)38     public void onActivityPinned(String packageName, int userId, int taskId, int stackId) { }
onActivityUnpinned()39     public void onActivityUnpinned() { }
onActivityRestartAttempt(RunningTaskInfo task, boolean homeTaskVisible, boolean clearedTask, boolean wasVisible)40     public void onActivityRestartAttempt(RunningTaskInfo task, boolean homeTaskVisible,
41             boolean clearedTask, boolean wasVisible) { }
onActivityForcedResizable(String packageName, int taskId, int reason)42     public void onActivityForcedResizable(String packageName, int taskId, int reason) { }
onActivityDismissingDockedStack()43     public void onActivityDismissingDockedStack() { }
onActivityLaunchOnSecondaryDisplayFailed()44     public void onActivityLaunchOnSecondaryDisplayFailed() { }
45 
onActivityLaunchOnSecondaryDisplayFailed(RunningTaskInfo taskInfo)46     public void onActivityLaunchOnSecondaryDisplayFailed(RunningTaskInfo taskInfo) {
47         onActivityLaunchOnSecondaryDisplayFailed();
48     }
49 
50     /**
51      * @see #onActivityLaunchOnSecondaryDisplayRerouted(RunningTaskInfo taskInfo)
52      */
onActivityLaunchOnSecondaryDisplayRerouted()53     public void onActivityLaunchOnSecondaryDisplayRerouted() { }
54 
55     /**
56      * Called when an activity was requested to be launched on a secondary display but was rerouted
57      * to default display.
58      *
59      * @param taskInfo info about the Activity's task
60      */
onActivityLaunchOnSecondaryDisplayRerouted(RunningTaskInfo taskInfo)61     public void onActivityLaunchOnSecondaryDisplayRerouted(RunningTaskInfo taskInfo) {
62         onActivityLaunchOnSecondaryDisplayRerouted();
63     }
64 
65     /**
66      * Called when contents are drawn for the first time on a display which can only contain one
67      * task.
68      *
69      * @param displayId the id of the display on which contents are drawn.
70      */
onSingleTaskDisplayDrawn(int displayId)71     public void onSingleTaskDisplayDrawn(int displayId) { }
72 
73     /**
74      * Called when the last task is removed from a display which can only contain one task.
75      *
76      * @param displayId the id of the display from which the window is removed.
77      */
onSingleTaskDisplayEmpty(int displayId)78     public void onSingleTaskDisplayEmpty(int displayId) {}
79 
onTaskProfileLocked(int taskId, int userId)80     public void onTaskProfileLocked(int taskId, int userId) { }
onTaskCreated(int taskId, ComponentName componentName)81     public void onTaskCreated(int taskId, ComponentName componentName) { }
onTaskRemoved(int taskId)82     public void onTaskRemoved(int taskId) { }
onTaskMovedToFront(int taskId)83     public void onTaskMovedToFront(int taskId) { }
84 
onTaskMovedToFront(RunningTaskInfo taskInfo)85     public void onTaskMovedToFront(RunningTaskInfo taskInfo) {
86         onTaskMovedToFront(taskInfo.taskId);
87     }
88 
89     /**
90      * Called when a task’s description is changed due to an activity calling
91      * ActivityManagerService.setTaskDescription
92      *
93      * @param taskInfo info about the task which changed, with {@link TaskInfo#taskDescription}
94      */
onTaskDescriptionChanged(RunningTaskInfo taskInfo)95     public void onTaskDescriptionChanged(RunningTaskInfo taskInfo) { }
96 
onActivityRequestedOrientationChanged(int taskId, int requestedOrientation)97     public void onActivityRequestedOrientationChanged(int taskId, int requestedOrientation) { }
onSizeCompatModeActivityChanged(int displayId, IBinder activityToken)98     public void onSizeCompatModeActivityChanged(int displayId, IBinder activityToken) { }
99 
onBackPressedOnTaskRoot(RunningTaskInfo taskInfo)100     public void onBackPressedOnTaskRoot(RunningTaskInfo taskInfo) { }
101 
102     /**
103      * Called when a task is reparented to a stack on a different display.
104      *
105      * @param taskId id of the task which was moved to a different display.
106      * @param newDisplayId id of the new display.
107      */
onTaskDisplayChanged(int taskId, int newDisplayId)108     public void onTaskDisplayChanged(int taskId, int newDisplayId) { }
109 
110     /**
111      * Called when any additions or deletions to the recent tasks list have been made.
112      */
onRecentTaskListUpdated()113     public void onRecentTaskListUpdated() { }
114 
115     /** @see ITaskStackListener#onRecentTaskListFrozenChanged(boolean) */
onRecentTaskListFrozenChanged(boolean frozen)116     public void onRecentTaskListFrozenChanged(boolean frozen) { }
117 
118     /** @see ITaskStackListener#onActivityRotation(int)*/
onActivityRotation(int displayId)119     public void onActivityRotation(int displayId) { }
120 }
121