Winson Chung | 740c3ac | 2014-11-12 16:14:38 -0800 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (c) 2014, 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 android.app; |
| 18 | |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 19 | import android.app.ActivityManager; |
| 20 | import android.content.ComponentName; |
| 21 | |
Winson Chung | 740c3ac | 2014-11-12 16:14:38 -0800 | [diff] [blame] | 22 | /** @hide */ |
| 23 | oneway interface ITaskStackListener { |
Andrii Kulian | 036e3ad | 2017-04-19 10:55:10 -0700 | [diff] [blame] | 24 | /** Activity was resized to be displayed in split-screen. */ |
| 25 | const int FORCED_RESIZEABLE_REASON_SPLIT_SCREEN = 1; |
| 26 | /** Activity was resized to be displayed on a secondary display. */ |
| 27 | const int FORCED_RESIZEABLE_REASON_SECONDARY_DISPLAY = 2; |
| 28 | |
Wale Ogunwale | 03ce863 | 2015-12-29 16:15:22 -0800 | [diff] [blame] | 29 | /** Called whenever there are changes to the state of tasks in a stack. */ |
Winson Chung | 740c3ac | 2014-11-12 16:14:38 -0800 | [diff] [blame] | 30 | void onTaskStackChanged(); |
Wale Ogunwale | 03ce863 | 2015-12-29 16:15:22 -0800 | [diff] [blame] | 31 | |
| 32 | /** Called whenever an Activity is moved to the pinned stack from another stack. */ |
Wale Ogunwale | 89be576 | 2017-10-04 13:27:49 -0700 | [diff] [blame] | 33 | void onActivityPinned(String packageName, int userId, int taskId, int stackId); |
Winson Chung | c81c0ce | 2017-03-17 12:27:30 -0700 | [diff] [blame] | 34 | |
| 35 | /** Called whenever an Activity is moved from the pinned stack to another stack. */ |
| 36 | void onActivityUnpinned(); |
Wale Ogunwale | cc25a8a | 2016-01-23 14:31:37 -0800 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * Called whenever IActivityManager.startActivity is called on an activity that is already |
| 40 | * running in the pinned stack and the activity is not actually started, but the task is either |
| 41 | * brought to the front or a new Intent is delivered to it. |
Winson Chung | e6385a2 | 2017-05-02 18:15:16 -0700 | [diff] [blame] | 42 | * |
| 43 | * @param clearedTask whether or not the launch activity also cleared the task as a part of |
| 44 | * starting |
Wale Ogunwale | cc25a8a | 2016-01-23 14:31:37 -0800 | [diff] [blame] | 45 | */ |
Winson Chung | e6385a2 | 2017-05-02 18:15:16 -0700 | [diff] [blame] | 46 | void onPinnedActivityRestartAttempt(boolean clearedTask); |
Wale Ogunwale | 480dca0 | 2016-02-06 13:58:29 -0800 | [diff] [blame] | 47 | |
| 48 | /** |
Winson Chung | 85d3998 | 2017-02-24 15:21:25 -0800 | [diff] [blame] | 49 | * Called whenever the pinned stack is starting animating a resize. |
| 50 | */ |
| 51 | void onPinnedStackAnimationStarted(); |
| 52 | |
| 53 | /** |
Wale Ogunwale | 480dca0 | 2016-02-06 13:58:29 -0800 | [diff] [blame] | 54 | * Called whenever the pinned stack is done animating a resize. |
| 55 | */ |
| 56 | void onPinnedStackAnimationEnded(); |
Jorim Jaggi | 2adba07 | 2016-03-03 13:43:39 +0100 | [diff] [blame] | 57 | |
| 58 | /** |
| 59 | * Called when we launched an activity that we forced to be resizable. |
Andrii Kulian | 036e3ad | 2017-04-19 10:55:10 -0700 | [diff] [blame] | 60 | * |
| 61 | * @param packageName Package name of the top activity in the task. |
| 62 | * @param taskId Id of the task. |
| 63 | * @param reason {@link #FORCED_RESIZEABLE_REASON_SPLIT_SCREEN} or |
| 64 | * {@link #FORCED_RESIZEABLE_REASON_SECONDARY_DISPLAY}. |
Jorim Jaggi | 2adba07 | 2016-03-03 13:43:39 +0100 | [diff] [blame] | 65 | */ |
Andrii Kulian | 036e3ad | 2017-04-19 10:55:10 -0700 | [diff] [blame] | 66 | void onActivityForcedResizable(String packageName, int taskId, int reason); |
Jorim Jaggi | d53f092 | 2016-04-06 22:16:23 -0700 | [diff] [blame] | 67 | |
| 68 | /** |
Andrii Kulian | 036e3ad | 2017-04-19 10:55:10 -0700 | [diff] [blame] | 69 | * Called when we launched an activity that dismissed the docked stack. |
Jorim Jaggi | d53f092 | 2016-04-06 22:16:23 -0700 | [diff] [blame] | 70 | */ |
| 71 | void onActivityDismissingDockedStack(); |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 72 | |
| 73 | /** |
Andrii Kulian | 036e3ad | 2017-04-19 10:55:10 -0700 | [diff] [blame] | 74 | * Called when an activity was requested to be launched on a secondary display but was not |
| 75 | * allowed there. |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 76 | * |
| 77 | * @param taskInfo info about the Activity's task |
| 78 | * @param requestedDisplayId the id of the requested launch display |
Andrii Kulian | 036e3ad | 2017-04-19 10:55:10 -0700 | [diff] [blame] | 79 | */ |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 80 | void onActivityLaunchOnSecondaryDisplayFailed(in ActivityManager.RunningTaskInfo taskInfo, |
| 81 | int requestedDisplayId); |
Andrii Kulian | 036e3ad | 2017-04-19 10:55:10 -0700 | [diff] [blame] | 82 | |
| 83 | /** |
Jeff Chang | bf29986 | 2019-02-26 20:07:22 +0800 | [diff] [blame] | 84 | * Called when an activity was requested to be launched on a secondary display but was rerouted |
| 85 | * to default display. |
| 86 | * |
| 87 | * @param taskInfo info about the Activity's task |
| 88 | * @param requestedDisplayId the id of the requested launch display |
| 89 | */ |
| 90 | void onActivityLaunchOnSecondaryDisplayRerouted(in ActivityManager.RunningTaskInfo taskInfo, |
| 91 | int requestedDisplayId); |
| 92 | |
| 93 | /** |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 94 | * Called when a task is added. |
| 95 | * |
| 96 | * @param taskId id of the task. |
| 97 | * @param componentName of the activity that the task is being started with. |
| 98 | */ |
| 99 | void onTaskCreated(int taskId, in ComponentName componentName); |
| 100 | |
| 101 | /** |
| 102 | * Called when a task is removed. |
| 103 | * |
| 104 | * @param taskId id of the task. |
| 105 | */ |
| 106 | void onTaskRemoved(int taskId); |
| 107 | |
| 108 | /** |
| 109 | * Called when a task is moved to the front of its stack. |
| 110 | * |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 111 | * @param taskInfo info about the task which moved |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 112 | */ |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 113 | void onTaskMovedToFront(in ActivityManager.RunningTaskInfo taskInfo); |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 114 | |
| 115 | /** |
| 116 | * Called when a task’s description is changed due to an activity calling |
| 117 | * ActivityManagerService.setTaskDescription |
| 118 | * |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 119 | * @param taskInfo info about the task which changed, with {@link TaskInfo#taskDescription} |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 120 | */ |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 121 | void onTaskDescriptionChanged(in ActivityManager.RunningTaskInfo taskInfo); |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 122 | |
| 123 | /** |
| 124 | * Called when a activity’s orientation is changed due to it calling |
| 125 | * ActivityManagerService.setRequestedOrientation |
| 126 | * |
| 127 | * @param taskId id of the task that the activity is in. |
| 128 | * @param requestedOrientation the new requested orientation. |
| 129 | */ |
| 130 | void onActivityRequestedOrientationChanged(int taskId, int requestedOrientation); |
| 131 | |
| 132 | /** |
| 133 | * Called when the task is about to be finished but before its surfaces are |
| 134 | * removed from the window manager. This allows interested parties to |
| 135 | * perform relevant animations before the window disappears. |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 136 | * |
| 137 | * @param taskInfo info about the task being removed |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 138 | */ |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 139 | void onTaskRemovalStarted(in ActivityManager.RunningTaskInfo taskInfo); |
Robin Lee | c41f6ec | 2017-01-10 17:02:34 +0000 | [diff] [blame] | 140 | |
| 141 | /** |
| 142 | * Called when the task has been put in a locked state because one or more of the |
| 143 | * activities inside it belong to a managed profile user, and that user has just |
| 144 | * been locked. |
| 145 | */ |
| 146 | void onTaskProfileLocked(int taskId, int userId); |
Jorim Jaggi | fb9d78a | 2017-01-05 18:57:12 +0100 | [diff] [blame] | 147 | |
| 148 | /** |
| 149 | * Called when a task snapshot got updated. |
| 150 | */ |
| 151 | void onTaskSnapshotChanged(int taskId, in ActivityManager.TaskSnapshot snapshot); |
Riddle Hsu | 7b766fd | 2019-01-28 21:14:59 +0800 | [diff] [blame] | 152 | |
| 153 | /** |
| 154 | * Called when the resumed activity is in size compatibility mode and its override configuration |
| 155 | * is different from the current one of system. |
| 156 | * |
| 157 | * @param displayId Id of the display where the activity resides. |
| 158 | * @param activityToken Token of the size compatibility mode activity. It will be null when |
| 159 | * switching to a activity that is not in size compatibility mode or the |
| 160 | * configuration of the activity. |
| 161 | * @see com.android.server.wm.AppWindowToken#inSizeCompatMode |
| 162 | */ |
| 163 | void onSizeCompatModeActivityChanged(int displayId, in IBinder activityToken); |
Mark Renouf | 446251d | 2019-04-26 10:22:41 -0400 | [diff] [blame] | 164 | |
| 165 | /** |
| 166 | * Reports that an Activity received a back key press when there were no additional activities |
| 167 | * on the back stack. |
| 168 | * |
| 169 | * @param taskInfo info about the task which received the back press |
| 170 | */ |
| 171 | void onBackPressedOnTaskRoot(in ActivityManager.RunningTaskInfo taskInfo); |
Issei Suzuki | cac2a50 | 2019-04-16 16:52:50 +0200 | [diff] [blame] | 172 | |
| 173 | /* |
| 174 | * Called when contents are drawn for the first time on a display which can only contain one |
| 175 | * task. |
| 176 | * |
| 177 | * @param displayId the id of the display on which contents are drawn. |
| 178 | */ |
| 179 | void onSingleTaskDisplayDrawn(int displayId); |
Issei Suzuki | 734bc94 | 2019-06-05 13:59:52 +0200 | [diff] [blame] | 180 | |
| 181 | /* |
| 182 | * Called when the last task is removed from a display which can only contain one task. |
| 183 | * |
| 184 | * @param displayId the id of the display from which the window is removed. |
| 185 | */ |
| 186 | void onSingleTaskDisplayEmpty(int displayId); |
Winson Chung | 740c3ac | 2014-11-12 16:14:38 -0800 | [diff] [blame] | 187 | } |