Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 19 | import android.annotation.UnsupportedAppUsage; |
Jorim Jaggi | fb9d78a | 2017-01-05 18:57:12 +0100 | [diff] [blame] | 20 | import android.app.ActivityManager.TaskSnapshot; |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 21 | import android.content.ComponentName; |
Winson Chung | 67b0902 | 2019-05-02 11:09:48 -0700 | [diff] [blame] | 22 | import android.os.Binder; |
Riddle Hsu | 7b766fd | 2019-01-28 21:14:59 +0800 | [diff] [blame] | 23 | import android.os.IBinder; |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 24 | import android.os.RemoteException; |
| 25 | |
| 26 | /** |
| 27 | * Classes interested in observing only a subset of changes using ITaskStackListener can extend |
| 28 | * this class to avoid having to implement all the methods. |
davidln | 1ceedb5 | 2019-05-30 14:25:01 -0700 | [diff] [blame] | 29 | * |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 30 | * @hide |
| 31 | */ |
| 32 | public abstract class TaskStackListener extends ITaskStackListener.Stub { |
| 33 | @Override |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 34 | @UnsupportedAppUsage |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 35 | public void onTaskStackChanged() throws RemoteException { |
| 36 | } |
| 37 | |
| 38 | @Override |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 39 | @UnsupportedAppUsage |
Wale Ogunwale | 89be576 | 2017-10-04 13:27:49 -0700 | [diff] [blame] | 40 | public void onActivityPinned(String packageName, int userId, int taskId, int stackId) |
Winson Chung | 85d3c8a | 2017-09-15 15:41:00 -0700 | [diff] [blame] | 41 | throws RemoteException { |
Winson Chung | c81c0ce | 2017-03-17 12:27:30 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | @Override |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 45 | @UnsupportedAppUsage |
Winson Chung | c81c0ce | 2017-03-17 12:27:30 -0700 | [diff] [blame] | 46 | public void onActivityUnpinned() throws RemoteException { |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | @Override |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 50 | @UnsupportedAppUsage |
Winson Chung | e6385a2 | 2017-05-02 18:15:16 -0700 | [diff] [blame] | 51 | public void onPinnedActivityRestartAttempt(boolean clearedTask) throws RemoteException { |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | @Override |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 55 | @UnsupportedAppUsage |
Winson Chung | 85d3998 | 2017-02-24 15:21:25 -0800 | [diff] [blame] | 56 | public void onPinnedStackAnimationStarted() throws RemoteException { |
| 57 | } |
| 58 | |
| 59 | @Override |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 60 | @UnsupportedAppUsage |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 61 | public void onPinnedStackAnimationEnded() throws RemoteException { |
| 62 | } |
| 63 | |
| 64 | @Override |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 65 | @UnsupportedAppUsage |
Andrii Kulian | 036e3ad | 2017-04-19 10:55:10 -0700 | [diff] [blame] | 66 | public void onActivityForcedResizable(String packageName, int taskId, int reason) |
| 67 | throws RemoteException { |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | @Override |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 71 | @UnsupportedAppUsage |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 72 | public void onActivityDismissingDockedStack() throws RemoteException { |
| 73 | } |
| 74 | |
| 75 | @Override |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 76 | public void onActivityLaunchOnSecondaryDisplayFailed(ActivityManager.RunningTaskInfo taskInfo, |
| 77 | int requestedDisplayId) throws RemoteException { |
| 78 | onActivityLaunchOnSecondaryDisplayFailed(); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * @deprecated see {@link |
| 83 | * #onActivityLaunchOnSecondaryDisplayFailed(ActivityManager.RunningTaskInfo, int)} |
| 84 | */ |
| 85 | @Deprecated |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 86 | @UnsupportedAppUsage |
Andrii Kulian | 036e3ad | 2017-04-19 10:55:10 -0700 | [diff] [blame] | 87 | public void onActivityLaunchOnSecondaryDisplayFailed() throws RemoteException { |
| 88 | } |
| 89 | |
| 90 | @Override |
Jeff Chang | bf29986 | 2019-02-26 20:07:22 +0800 | [diff] [blame] | 91 | @UnsupportedAppUsage |
| 92 | public void onActivityLaunchOnSecondaryDisplayRerouted(ActivityManager.RunningTaskInfo taskInfo, |
| 93 | int requestedDisplayId) throws RemoteException { |
| 94 | } |
| 95 | |
| 96 | @Override |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 97 | public void onTaskCreated(int taskId, ComponentName componentName) throws RemoteException { |
| 98 | } |
| 99 | |
| 100 | @Override |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 101 | @UnsupportedAppUsage |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 102 | public void onTaskRemoved(int taskId) throws RemoteException { |
| 103 | } |
| 104 | |
| 105 | @Override |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 106 | public void onTaskMovedToFront(ActivityManager.RunningTaskInfo taskInfo) |
| 107 | throws RemoteException { |
| 108 | onTaskMovedToFront(taskInfo.taskId); |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * @deprecated see {@link #onTaskMovedToFront(ActivityManager.RunningTaskInfo)} |
| 113 | */ |
| 114 | @Deprecated |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 115 | @UnsupportedAppUsage |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 116 | public void onTaskMovedToFront(int taskId) throws RemoteException { |
| 117 | } |
| 118 | |
| 119 | @Override |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 120 | public void onTaskRemovalStarted(ActivityManager.RunningTaskInfo taskInfo) |
| 121 | throws RemoteException { |
| 122 | onTaskRemovalStarted(taskInfo.taskId); |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * @deprecated see {@link #onTaskRemovalStarted(ActivityManager.RunningTaskInfo)} |
| 127 | */ |
| 128 | @Deprecated |
Winson Chung | 2db3557 | 2017-10-09 15:08:30 -0700 | [diff] [blame] | 129 | public void onTaskRemovalStarted(int taskId) throws RemoteException { |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | @Override |
Mark Renouf | c808f06 | 2019-02-07 15:20:37 -0500 | [diff] [blame] | 133 | public void onTaskDescriptionChanged(ActivityManager.RunningTaskInfo taskInfo) |
| 134 | throws RemoteException { |
| 135 | onTaskDescriptionChanged(taskInfo.taskId, taskInfo.taskDescription); |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * @deprecated see {@link #onTaskDescriptionChanged(ActivityManager.RunningTaskInfo)} |
| 140 | */ |
| 141 | @Deprecated |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 142 | public void onTaskDescriptionChanged(int taskId, ActivityManager.TaskDescription td) |
| 143 | throws RemoteException { |
| 144 | } |
| 145 | |
| 146 | @Override |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 147 | @UnsupportedAppUsage |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 148 | public void onActivityRequestedOrientationChanged(int taskId, int requestedOrientation) |
| 149 | throws RemoteException { |
| 150 | } |
Robin Lee | c41f6ec | 2017-01-10 17:02:34 +0000 | [diff] [blame] | 151 | |
| 152 | @Override |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 153 | @UnsupportedAppUsage |
Winson Chung | 2db3557 | 2017-10-09 15:08:30 -0700 | [diff] [blame] | 154 | public void onTaskProfileLocked(int taskId, int userId) throws RemoteException { |
Robin Lee | c41f6ec | 2017-01-10 17:02:34 +0000 | [diff] [blame] | 155 | } |
Jorim Jaggi | fb9d78a | 2017-01-05 18:57:12 +0100 | [diff] [blame] | 156 | |
| 157 | @Override |
Mathew Inwood | 61e8ae6 | 2018-08-14 14:17:44 +0100 | [diff] [blame] | 158 | @UnsupportedAppUsage |
Winson Chung | 2db3557 | 2017-10-09 15:08:30 -0700 | [diff] [blame] | 159 | public void onTaskSnapshotChanged(int taskId, TaskSnapshot snapshot) throws RemoteException { |
Winson Chung | 67b0902 | 2019-05-02 11:09:48 -0700 | [diff] [blame] | 160 | if (Binder.getCallingPid() != android.os.Process.myPid() |
| 161 | && snapshot != null && snapshot.getSnapshot() != null) { |
| 162 | // Preemptively clear any reference to the buffer |
| 163 | snapshot.getSnapshot().destroy(); |
| 164 | } |
Jorim Jaggi | fb9d78a | 2017-01-05 18:57:12 +0100 | [diff] [blame] | 165 | } |
Riddle Hsu | 7b766fd | 2019-01-28 21:14:59 +0800 | [diff] [blame] | 166 | |
| 167 | @Override |
| 168 | @UnsupportedAppUsage |
| 169 | public void onSizeCompatModeActivityChanged(int displayId, IBinder activityToken) |
| 170 | throws RemoteException { |
| 171 | } |
Mark Renouf | 446251d | 2019-04-26 10:22:41 -0400 | [diff] [blame] | 172 | |
| 173 | @Override |
| 174 | public void onBackPressedOnTaskRoot(ActivityManager.RunningTaskInfo taskInfo) |
| 175 | throws RemoteException { |
| 176 | } |
Issei Suzuki | cac2a50 | 2019-04-16 16:52:50 +0200 | [diff] [blame] | 177 | |
| 178 | @Override |
| 179 | public void onSingleTaskDisplayDrawn(int displayId) throws RemoteException { |
| 180 | } |
davidln | 1ceedb5 | 2019-05-30 14:25:01 -0700 | [diff] [blame] | 181 | |
| 182 | @Override |
| 183 | public void onTaskDisplayChanged(int taskId, int newDisplayId) throws RemoteException { |
| 184 | } |
Yorke Lee | bd54c2a | 2016-10-25 13:49:23 -0700 | [diff] [blame] | 185 | } |