1 /*
2  * Copyright (C) 2018 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 
19 import android.app.ActivityManager;
20 import android.app.ApplicationErrorReport;
21 import android.app.ContentProviderHolder;
22 import android.app.GrantedUriPermission;
23 import android.app.IApplicationThread;
24 import android.app.IActivityController;
25 import android.app.IAppTask;
26 import android.app.IAssistDataReceiver;
27 import android.app.IInstrumentationWatcher;
28 import android.app.IProcessObserver;
29 import android.app.IRequestFinishCallback;
30 import android.app.IServiceConnection;
31 import android.app.IStopUserCallback;
32 import android.app.ITaskStackListener;
33 import android.app.IUiAutomationConnection;
34 import android.app.IUidObserver;
35 import android.app.IUserSwitchObserver;
36 import android.app.Notification;
37 import android.app.PendingIntent;
38 import android.app.PictureInPictureParams;
39 import android.app.ProfilerInfo;
40 import android.app.WaitResult;
41 import android.app.assist.AssistContent;
42 import android.app.assist.AssistStructure;
43 import android.content.ComponentName;
44 import android.content.IIntentReceiver;
45 import android.content.IIntentSender;
46 import android.content.Intent;
47 import android.content.IntentFilter;
48 import android.content.IntentSender;
49 import android.content.pm.ApplicationInfo;
50 import android.content.pm.ConfigurationInfo;
51 import android.content.pm.IPackageDataObserver;
52 import android.content.pm.ParceledListSlice;
53 import android.content.pm.ProviderInfo;
54 import android.content.pm.UserInfo;
55 import android.content.res.Configuration;
56 import android.graphics.Bitmap;
57 import android.graphics.GraphicBuffer;
58 import android.graphics.Point;
59 import android.graphics.Rect;
60 import android.net.Uri;
61 import android.os.Bundle;
62 import android.os.Debug;
63 import android.os.IBinder;
64 import android.os.IProgressListener;
65 import android.os.ParcelFileDescriptor;
66 import android.os.PersistableBundle;
67 import android.os.StrictMode;
68 import android.os.WorkSource;
69 import android.service.voice.IVoiceInteractionSession;
70 import android.view.IRecentsAnimationRunner;
71 import android.view.RemoteAnimationDefinition;
72 import android.view.RemoteAnimationAdapter;
73 import android.window.IWindowOrganizerController;
74 import com.android.internal.app.IVoiceInteractor;
75 import com.android.internal.os.IResultReceiver;
76 import com.android.internal.policy.IKeyguardDismissCallback;
77 
78 import java.util.List;
79 
80 /**
81  * System private API for talking with the activity task manager that handles how activities are
82  * managed on screen.
83  *
84  * {@hide}
85  */
86 interface IActivityTaskManager {
startActivity(in IApplicationThread caller, in String callingPackage, in String callingFeatureId, in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, int flags, in ProfilerInfo profilerInfo, in Bundle options)87     int startActivity(in IApplicationThread caller, in String callingPackage,
88             in String callingFeatureId, in Intent intent, in String resolvedType,
89             in IBinder resultTo, in String resultWho, int requestCode,
90             int flags, in ProfilerInfo profilerInfo, in Bundle options);
startActivities(in IApplicationThread caller, in String callingPackage, in String callingFeatureId, in Intent[] intents, in String[] resolvedTypes, in IBinder resultTo, in Bundle options, int userId)91     int startActivities(in IApplicationThread caller, in String callingPackage,
92             in String callingFeatureId, in Intent[] intents, in String[] resolvedTypes,
93             in IBinder resultTo, in Bundle options, int userId);
startActivityAsUser(in IApplicationThread caller, in String callingPackage, in String callingFeatureId, in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, int flags, in ProfilerInfo profilerInfo, in Bundle options, int userId)94     int startActivityAsUser(in IApplicationThread caller, in String callingPackage,
95             in String callingFeatureId, in Intent intent, in String resolvedType,
96             in IBinder resultTo, in String resultWho, int requestCode, int flags,
97             in ProfilerInfo profilerInfo, in Bundle options, int userId);
startNextMatchingActivity(in IBinder callingActivity, in Intent intent, in Bundle options)98     boolean startNextMatchingActivity(in IBinder callingActivity,
99             in Intent intent, in Bundle options);
100 
101     /**
102     *  The DreamActivity has to be started in a special way that does not involve the PackageParser.
103     *  The DreamActivity is a framework component inserted in the dream application process. Hence,
104     *  it is not declared in the application's manifest and cannot be parsed. startDreamActivity
105     *  creates the activity and starts it without reaching out to the PackageParser.
106     */
startDreamActivity(in Intent intent)107     boolean startDreamActivity(in Intent intent);
startActivityIntentSender(in IApplicationThread caller, in IIntentSender target, in IBinder whitelistToken, in Intent fillInIntent, in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, int flagsMask, int flagsValues, in Bundle options)108     int startActivityIntentSender(in IApplicationThread caller,
109             in IIntentSender target, in IBinder whitelistToken, in Intent fillInIntent,
110             in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode,
111             int flagsMask, int flagsValues, in Bundle options);
startActivityAndWait(in IApplicationThread caller, in String callingPackage, in String callingFeatureId, in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, int flags, in ProfilerInfo profilerInfo, in Bundle options, int userId)112     WaitResult startActivityAndWait(in IApplicationThread caller, in String callingPackage,
113             in String callingFeatureId, in Intent intent, in String resolvedType,
114             in IBinder resultTo, in String resultWho, int requestCode, int flags,
115             in ProfilerInfo profilerInfo, in Bundle options, int userId);
startActivityWithConfig(in IApplicationThread caller, in String callingPackage, in String callingFeatureId, in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, int startFlags, in Configuration newConfig, in Bundle options, int userId)116     int startActivityWithConfig(in IApplicationThread caller, in String callingPackage,
117             in String callingFeatureId, in Intent intent, in String resolvedType,
118             in IBinder resultTo, in String resultWho, int requestCode, int startFlags,
119             in Configuration newConfig, in Bundle options, int userId);
startVoiceActivity(in String callingPackage, in String callingFeatureId, int callingPid, int callingUid, in Intent intent, in String resolvedType, in IVoiceInteractionSession session, in IVoiceInteractor interactor, int flags, in ProfilerInfo profilerInfo, in Bundle options, int userId)120     int startVoiceActivity(in String callingPackage, in String callingFeatureId, int callingPid,
121             int callingUid, in Intent intent, in String resolvedType,
122             in IVoiceInteractionSession session, in IVoiceInteractor interactor, int flags,
123             in ProfilerInfo profilerInfo, in Bundle options, int userId);
startAssistantActivity(in String callingPackage, in String callingFeatureId, int callingPid, int callingUid, in Intent intent, in String resolvedType, in Bundle options, int userId)124     int startAssistantActivity(in String callingPackage, in String callingFeatureId, int callingPid,
125             int callingUid, in Intent intent, in String resolvedType, in Bundle options, int userId);
startRecentsActivity(in Intent intent, in IAssistDataReceiver assistDataReceiver, in IRecentsAnimationRunner recentsAnimationRunner)126     void startRecentsActivity(in Intent intent, in IAssistDataReceiver assistDataReceiver,
127             in IRecentsAnimationRunner recentsAnimationRunner);
startActivityFromRecents(int taskId, in Bundle options)128     int startActivityFromRecents(int taskId, in Bundle options);
startActivityAsCaller(in IApplicationThread caller, in String callingPackage, in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, int flags, in ProfilerInfo profilerInfo, in Bundle options, IBinder permissionToken, boolean ignoreTargetSecurity, int userId)129     int startActivityAsCaller(in IApplicationThread caller, in String callingPackage,
130             in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho,
131             int requestCode, int flags, in ProfilerInfo profilerInfo, in Bundle options,
132             IBinder permissionToken, boolean ignoreTargetSecurity, int userId);
133 
isActivityStartAllowedOnDisplay(int displayId, in Intent intent, in String resolvedType, int userId)134     boolean isActivityStartAllowedOnDisplay(int displayId, in Intent intent, in String resolvedType,
135             int userId);
136 
unhandledBack()137     void unhandledBack();
finishActivity(in IBinder token, int code, in Intent data, int finishTask)138     boolean finishActivity(in IBinder token, int code, in Intent data, int finishTask);
finishActivityAffinity(in IBinder token)139     boolean finishActivityAffinity(in IBinder token);
140 
activityIdle(in IBinder token, in Configuration config, in boolean stopProfiling)141     oneway void activityIdle(in IBinder token, in Configuration config,
142             in boolean stopProfiling);
activityResumed(in IBinder token)143     void activityResumed(in IBinder token);
activityTopResumedStateLost()144     void activityTopResumedStateLost();
activityPaused(in IBinder token)145     void activityPaused(in IBinder token);
activityStopped(in IBinder token, in Bundle state, in PersistableBundle persistentState, in CharSequence description)146     void activityStopped(in IBinder token, in Bundle state,
147             in PersistableBundle persistentState, in CharSequence description);
activityDestroyed(in IBinder token)148     oneway void activityDestroyed(in IBinder token);
activityRelaunched(in IBinder token)149     void activityRelaunched(in IBinder token);
getFrontActivityScreenCompatMode()150     int getFrontActivityScreenCompatMode();
setFrontActivityScreenCompatMode(int mode)151     void setFrontActivityScreenCompatMode(int mode);
getCallingPackage(in IBinder token)152     String getCallingPackage(in IBinder token);
getCallingActivity(in IBinder token)153     ComponentName getCallingActivity(in IBinder token);
setFocusedTask(int taskId)154     void setFocusedTask(int taskId);
removeTask(int taskId)155     boolean removeTask(int taskId);
removeAllVisibleRecentTasks()156     void removeAllVisibleRecentTasks();
getTasks(int maxNum)157     List<ActivityManager.RunningTaskInfo> getTasks(int maxNum);
getFilteredTasks(int maxNum, boolean filterOnlyVisibleRecents)158     List<ActivityManager.RunningTaskInfo> getFilteredTasks(int maxNum,
159             boolean filterOnlyVisibleRecents);
shouldUpRecreateTask(in IBinder token, in String destAffinity)160     boolean shouldUpRecreateTask(in IBinder token, in String destAffinity);
navigateUpTo(in IBinder token, in Intent target, int resultCode, in Intent resultData)161     boolean navigateUpTo(in IBinder token, in Intent target, int resultCode,
162             in Intent resultData);
moveTaskToFront(in IApplicationThread app, in String callingPackage, int task, int flags, in Bundle options)163     void moveTaskToFront(in IApplicationThread app, in String callingPackage, int task,
164             int flags, in Bundle options);
getTaskForActivity(in IBinder token, in boolean onlyRoot)165     int getTaskForActivity(in IBinder token, in boolean onlyRoot);
166     /** Finish all activities that were started for result from the specified activity. */
finishSubActivity(in IBinder token, in String resultWho, int requestCode)167     void finishSubActivity(in IBinder token, in String resultWho, int requestCode);
getRecentTasks(int maxNum, int flags, int userId)168     ParceledListSlice getRecentTasks(int maxNum, int flags, int userId);
willActivityBeVisible(in IBinder token)169     boolean willActivityBeVisible(in IBinder token);
setRequestedOrientation(in IBinder token, int requestedOrientation)170     void setRequestedOrientation(in IBinder token, int requestedOrientation);
getRequestedOrientation(in IBinder token)171     int getRequestedOrientation(in IBinder token);
convertFromTranslucent(in IBinder token)172     boolean convertFromTranslucent(in IBinder token);
convertToTranslucent(in IBinder token, in Bundle options)173     boolean convertToTranslucent(in IBinder token, in Bundle options);
notifyActivityDrawn(in IBinder token)174     void notifyActivityDrawn(in IBinder token);
reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle)175     void reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle);
getDisplayId(in IBinder activityToken)176     int getDisplayId(in IBinder activityToken);
isImmersive(in IBinder token)177     boolean isImmersive(in IBinder token);
setImmersive(in IBinder token, boolean immersive)178     void setImmersive(in IBinder token, boolean immersive);
isTopActivityImmersive()179     boolean isTopActivityImmersive();
moveActivityTaskToBack(in IBinder token, boolean nonRoot)180     boolean moveActivityTaskToBack(in IBinder token, boolean nonRoot);
getTaskDescription(int taskId)181     ActivityManager.TaskDescription getTaskDescription(int taskId);
overridePendingTransition(in IBinder token, in String packageName, int enterAnim, int exitAnim)182     void overridePendingTransition(in IBinder token, in String packageName,
183             int enterAnim, int exitAnim);
getLaunchedFromUid(in IBinder activityToken)184     int getLaunchedFromUid(in IBinder activityToken);
getLaunchedFromPackage(in IBinder activityToken)185     String getLaunchedFromPackage(in IBinder activityToken);
reportAssistContextExtras(in IBinder token, in Bundle extras, in AssistStructure structure, in AssistContent content, in Uri referrer)186     void reportAssistContextExtras(in IBinder token, in Bundle extras,
187             in AssistStructure structure, in AssistContent content, in Uri referrer);
188 
setFocusedStack(int stackId)189     void setFocusedStack(int stackId);
getFocusedStackInfo()190     ActivityManager.StackInfo getFocusedStackInfo();
getTaskBounds(int taskId)191     Rect getTaskBounds(int taskId);
192 
cancelRecentsAnimation(boolean restoreHomeStackPosition)193     void cancelRecentsAnimation(boolean restoreHomeStackPosition);
startLockTaskModeByToken(in IBinder token)194     void startLockTaskModeByToken(in IBinder token);
stopLockTaskModeByToken(in IBinder token)195     void stopLockTaskModeByToken(in IBinder token);
updateLockTaskPackages(int userId, in String[] packages)196     void updateLockTaskPackages(int userId, in String[] packages);
isInLockTaskMode()197     boolean isInLockTaskMode();
getLockTaskModeState()198     int getLockTaskModeState();
setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values)199     void setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values);
getActivityOptions(in IBinder token)200     Bundle getActivityOptions(in IBinder token);
getAppTasks(in String callingPackage)201     List<IBinder> getAppTasks(in String callingPackage);
startSystemLockTaskMode(int taskId)202     void startSystemLockTaskMode(int taskId);
stopSystemLockTaskMode()203     void stopSystemLockTaskMode();
finishVoiceTask(in IVoiceInteractionSession session)204     void finishVoiceTask(in IVoiceInteractionSession session);
isTopOfTask(in IBinder token)205     boolean isTopOfTask(in IBinder token);
notifyLaunchTaskBehindComplete(in IBinder token)206     void notifyLaunchTaskBehindComplete(in IBinder token);
notifyEnterAnimationComplete(in IBinder token)207     void notifyEnterAnimationComplete(in IBinder token);
addAppTask(in IBinder activityToken, in Intent intent, in ActivityManager.TaskDescription description, in Bitmap thumbnail)208     int addAppTask(in IBinder activityToken, in Intent intent,
209             in ActivityManager.TaskDescription description, in Bitmap thumbnail);
getAppTaskThumbnailSize()210     Point getAppTaskThumbnailSize();
releaseActivityInstance(in IBinder token)211     boolean releaseActivityInstance(in IBinder token);
212     /**
213      * Only callable from the system. This token grants a temporary permission to call
214      * #startActivityAsCallerWithToken. The token will time out after
215      * START_AS_CALLER_TOKEN_TIMEOUT if it is not used.
216      *
217      * @param delegatorToken The Binder token referencing the system Activity that wants to delegate
218      *        the #startActivityAsCaller to another app. The "caller" will be the caller of this
219      *        activity's token, not the delegate's caller (which is probably the delegator itself).
220      *
221      * @return Returns a token that can be given to a "delegate" app that may call
222      *         #startActivityAsCaller
223      */
requestStartActivityPermissionToken(in IBinder delegatorToken)224     IBinder requestStartActivityPermissionToken(in IBinder delegatorToken);
225 
releaseSomeActivities(in IApplicationThread app)226     void releaseSomeActivities(in IApplicationThread app);
getTaskDescriptionIcon(in String filename, int userId)227     Bitmap getTaskDescriptionIcon(in String filename, int userId);
registerTaskStackListener(in ITaskStackListener listener)228     void registerTaskStackListener(in ITaskStackListener listener);
unregisterTaskStackListener(in ITaskStackListener listener)229     void unregisterTaskStackListener(in ITaskStackListener listener);
setTaskResizeable(int taskId, int resizeableMode)230     void setTaskResizeable(int taskId, int resizeableMode);
toggleFreeformWindowingMode(in IBinder token)231     void toggleFreeformWindowingMode(in IBinder token);
232 
233     /**
234      * Resize the task with given bounds
235      *
236      * @param taskId The id of the task to set the bounds for.
237      * @param bounds The new bounds.
238      * @param resizeMode Resize mode defined as {@code ActivityTaskManager#RESIZE_MODE_*} constants.
239      * @return Return true on success. Otherwise false.
240      */
resizeTask(int taskId, in Rect bounds, int resizeMode)241     boolean resizeTask(int taskId, in Rect bounds, int resizeMode);
moveStackToDisplay(int stackId, int displayId)242     void moveStackToDisplay(int stackId, int displayId);
removeStack(int stackId)243     void removeStack(int stackId);
244 
245     /**
246      * Sets the windowing mode for a specific task. Only works on tasks of type
247      * {@link WindowConfiguration#ACTIVITY_TYPE_STANDARD}
248      * @param taskId The id of the task to set the windowing mode for.
249      * @param windowingMode The windowing mode to set for the task.
250      * @param toTop If the task should be moved to the top once the windowing mode changes.
251      * @return Whether the task was successfully put into the specified windowing mode.
252      */
setTaskWindowingMode(int taskId, int windowingMode, boolean toTop)253     boolean setTaskWindowingMode(int taskId, int windowingMode, boolean toTop);
moveTaskToStack(int taskId, int stackId, boolean toTop)254     void moveTaskToStack(int taskId, int stackId, boolean toTop);
setTaskWindowingModeSplitScreenPrimary(int taskId, boolean toTop)255     boolean setTaskWindowingModeSplitScreenPrimary(int taskId, boolean toTop);
256     /**
257      * Removes stacks in the input windowing modes from the system if they are of activity type
258      * ACTIVITY_TYPE_STANDARD or ACTIVITY_TYPE_UNDEFINED
259      */
removeStacksInWindowingModes(in int[] windowingModes)260     void removeStacksInWindowingModes(in int[] windowingModes);
261     /** Removes stack of the activity types from the system. */
removeStacksWithActivityTypes(in int[] activityTypes)262     void removeStacksWithActivityTypes(in int[] activityTypes);
263 
getAllStackInfos()264     List<ActivityManager.StackInfo> getAllStackInfos();
getStackInfo(int windowingMode, int activityType)265     ActivityManager.StackInfo getStackInfo(int windowingMode, int activityType);
getAllStackInfosOnDisplay(int displayId)266     List<ActivityManager.StackInfo> getAllStackInfosOnDisplay(int displayId);
getStackInfoOnDisplay(int windowingMode, int activityType, int displayId)267     ActivityManager.StackInfo getStackInfoOnDisplay(int windowingMode, int activityType,
268             int displayId);
269 
270     /**
271      * Informs ActivityTaskManagerService that the keyguard is showing.
272      *
273      * @param showingKeyguard True if the keyguard is showing, false otherwise.
274      * @param showingAod True if AOD is showing, false otherwise.
275      */
setLockScreenShown(boolean showingKeyguard, boolean showingAod)276     void setLockScreenShown(boolean showingKeyguard, boolean showingAod);
getAssistContextExtras(int requestType)277     Bundle getAssistContextExtras(int requestType);
launchAssistIntent(in Intent intent, int requestType, in String hint, int userHandle, in Bundle args)278     boolean launchAssistIntent(in Intent intent, int requestType, in String hint, int userHandle,
279             in Bundle args);
requestAssistContextExtras(int requestType, in IAssistDataReceiver receiver, in Bundle receiverExtras, in IBinder activityToken, boolean focused, boolean newSessionId)280     boolean requestAssistContextExtras(int requestType, in IAssistDataReceiver receiver,
281             in Bundle receiverExtras, in IBinder activityToken,
282             boolean focused, boolean newSessionId);
requestAutofillData(in IAssistDataReceiver receiver, in Bundle receiverExtras, in IBinder activityToken, int flags)283     boolean requestAutofillData(in IAssistDataReceiver receiver, in Bundle receiverExtras,
284             in IBinder activityToken, int flags);
isAssistDataAllowedOnCurrentActivity()285     boolean isAssistDataAllowedOnCurrentActivity();
showAssistFromActivity(in IBinder token, in Bundle args)286     boolean showAssistFromActivity(in IBinder token, in Bundle args);
isRootVoiceInteraction(in IBinder token)287     boolean isRootVoiceInteraction(in IBinder token);
showLockTaskEscapeMessage(in IBinder token)288     oneway void showLockTaskEscapeMessage(in IBinder token);
289 
290     /**
291      * Notify the system that the keyguard is going away.
292      *
293      * @param flags See
294      *              {@link android.view.WindowManagerPolicyConstants#KEYGUARD_GOING_AWAY_FLAG_TO_SHADE}
295      *              etc.
296      */
keyguardGoingAway(int flags)297     void keyguardGoingAway(int flags);
getActivityClassForToken(in IBinder token)298     ComponentName getActivityClassForToken(in IBinder token);
getPackageForToken(in IBinder token)299     String getPackageForToken(in IBinder token);
300 
301     /**
302      * Try to place task to provided position. The final position might be different depending on
303      * current user and stacks state. The task will be moved to target stack if it's currently in
304      * different stack.
305      */
positionTaskInStack(int taskId, int stackId, int position)306     void positionTaskInStack(int taskId, int stackId, int position);
reportSizeConfigurations(in IBinder token, in int[] horizontalSizeConfiguration, in int[] verticalSizeConfigurations, in int[] smallestWidthConfigurations)307     void reportSizeConfigurations(in IBinder token, in int[] horizontalSizeConfiguration,
308             in int[] verticalSizeConfigurations, in int[] smallestWidthConfigurations);
309 
suppressResizeConfigChanges(boolean suppress)310     void suppressResizeConfigChanges(boolean suppress);
moveTopActivityToPinnedStack(int stackId, in Rect bounds)311     boolean moveTopActivityToPinnedStack(int stackId, in Rect bounds);
enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params)312     boolean enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params);
setPictureInPictureParams(in IBinder token, in PictureInPictureParams params)313     void setPictureInPictureParams(in IBinder token, in PictureInPictureParams params);
requestPictureInPictureMode(in IBinder token)314     void requestPictureInPictureMode(in IBinder token);
getMaxNumPictureInPictureActions(in IBinder token)315     int getMaxNumPictureInPictureActions(in IBinder token);
getUriPermissionOwnerForActivity(in IBinder activityToken)316     IBinder getUriPermissionOwnerForActivity(in IBinder activityToken);
317 
318     /**
319      * Resizes the docked stack, and all other stacks as the result of the dock stack bounds change.
320      *
321      * @param dockedBounds The bounds for the docked stack.
322      * @param tempDockedTaskBounds The temporary bounds for the tasks in the docked stack, which
323      *                             might be different from the stack bounds to allow more
324      *                             flexibility while resizing, or {@code null} if they should be the
325      *                             same as the stack bounds.
326      * @param tempDockedTaskInsetBounds The temporary bounds for the tasks to calculate the insets.
327      *                                  When resizing, we usually "freeze" the layout of a task. To
328      *                                  achieve that, we also need to "freeze" the insets, which
329      *                                  gets achieved by changing task bounds but not bounds used
330      *                                  to calculate the insets in this transient state
331      * @param tempOtherTaskBounds The temporary bounds for the tasks in all other stacks, or
332      *                            {@code null} if they should be the same as the stack bounds.
333      * @param tempOtherTaskInsetBounds Like {@code tempDockedTaskInsetBounds}, but for the other
334      *                                 stacks.
335      * @throws RemoteException
336      */
resizeDockedStack(in Rect dockedBounds, in Rect tempDockedTaskBounds, in Rect tempDockedTaskInsetBounds, in Rect tempOtherTaskBounds, in Rect tempOtherTaskInsetBounds)337     void resizeDockedStack(in Rect dockedBounds, in Rect tempDockedTaskBounds,
338             in Rect tempDockedTaskInsetBounds,
339             in Rect tempOtherTaskBounds, in Rect tempOtherTaskInsetBounds);
340 
341     /** Returns an interface enabling the management of window organizers. */
getWindowOrganizerController()342     IWindowOrganizerController getWindowOrganizerController();
343 
344     /**
345      * Sets whether we are currently in an interactive split screen resize operation where we
346      * are changing the docked stack size.
347      */
setSplitScreenResizing(boolean resizing)348     void setSplitScreenResizing(boolean resizing);
setVrMode(in IBinder token, boolean enabled, in ComponentName packageName)349     int setVrMode(in IBinder token, boolean enabled, in ComponentName packageName);
startLocalVoiceInteraction(in IBinder token, in Bundle options)350     void startLocalVoiceInteraction(in IBinder token, in Bundle options);
stopLocalVoiceInteraction(in IBinder token)351     void stopLocalVoiceInteraction(in IBinder token);
supportsLocalVoiceInteraction()352     boolean supportsLocalVoiceInteraction();
353 
354     // Get device configuration
getDeviceConfigurationInfo()355     ConfigurationInfo getDeviceConfigurationInfo();
356 
dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback, in CharSequence message)357     void dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback,
358             in CharSequence message);
359 
360     /** Cancels the window transitions for the given task. */
cancelTaskWindowTransition(int taskId)361     void cancelTaskWindowTransition(int taskId);
362 
363     /**
364      * @param taskId the id of the task to retrieve the sAutoapshots for
365      * @param isLowResolution if set, if the snapshot needs to be loaded from disk, this will load
366      *                          a reduced resolution of it, which is much faster
367      * @return a graphic buffer representing a screenshot of a task
368      */
getTaskSnapshot(int taskId, boolean isLowResolution)369     ActivityManager.TaskSnapshot getTaskSnapshot(int taskId, boolean isLowResolution);
370 
371     /**
372      * See {@link android.app.Activity#setDisablePreviewScreenshots}
373      */
setDisablePreviewScreenshots(IBinder token, boolean disable)374     void setDisablePreviewScreenshots(IBinder token, boolean disable);
375 
376     /**
377      * It should only be called from home activity to remove its outdated snapshot. The home
378      * snapshot is used to speed up entering home from screen off. If the content of home activity
379      * is significantly different from before taking the snapshot, then the home activity can use
380      * this method to avoid inconsistent transition.
381      */
invalidateHomeTaskSnapshot(IBinder homeToken)382     void invalidateHomeTaskSnapshot(IBinder homeToken);
383 
384     /**
385      * Return the user id of last resumed activity.
386      */
getLastResumedActivityUserId()387     int getLastResumedActivityUserId();
388 
389     /**
390      * Updates global configuration and applies changes to the entire system.
391      * @param values Update values for global configuration. If null is passed it will request the
392      *               Window Manager to compute new config for the default display.
393      * @throws RemoteException
394      * @return Returns true if the configuration was updated.
395      */
updateConfiguration(in Configuration values)396     boolean updateConfiguration(in Configuration values);
updateLockTaskFeatures(int userId, int flags)397     void updateLockTaskFeatures(int userId, int flags);
398 
setShowWhenLocked(in IBinder token, boolean showWhenLocked)399     void setShowWhenLocked(in IBinder token, boolean showWhenLocked);
setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked)400     void setInheritShowWhenLocked(in IBinder token, boolean setInheritShownWhenLocked);
setTurnScreenOn(in IBinder token, boolean turnScreenOn)401     void setTurnScreenOn(in IBinder token, boolean turnScreenOn);
402 
403     /**
404      * Registers remote animations for a specific activity.
405      */
registerRemoteAnimations(in IBinder token, in RemoteAnimationDefinition definition)406     void registerRemoteAnimations(in IBinder token, in RemoteAnimationDefinition definition);
407 
408     /**
409      * Unregisters all remote animations for a specific activity.
410      */
unregisterRemoteAnimations(in IBinder token)411     void unregisterRemoteAnimations(in IBinder token);
412 
413     /**
414      * Registers a remote animation to be run for all activity starts from a certain package during
415      * a short predefined amount of time.
416      */
registerRemoteAnimationForNextActivityStart(in String packageName, in RemoteAnimationAdapter adapter)417     void registerRemoteAnimationForNextActivityStart(in String packageName,
418            in RemoteAnimationAdapter adapter);
419 
420     /**
421      * Registers remote animations for a display.
422      */
registerRemoteAnimationsForDisplay(int displayId, in RemoteAnimationDefinition definition)423     void registerRemoteAnimationsForDisplay(int displayId, in RemoteAnimationDefinition definition);
424 
425     /** @see android.app.ActivityManager#alwaysShowUnsupportedCompileSdkWarning */
alwaysShowUnsupportedCompileSdkWarning(in ComponentName activity)426     void alwaysShowUnsupportedCompileSdkWarning(in ComponentName activity);
427 
setVrThread(int tid)428     void setVrThread(int tid);
setPersistentVrThread(int tid)429     void setPersistentVrThread(int tid);
stopAppSwitches()430     void stopAppSwitches();
resumeAppSwitches()431     void resumeAppSwitches();
setActivityController(in IActivityController watcher, boolean imAMonkey)432     void setActivityController(in IActivityController watcher, boolean imAMonkey);
setVoiceKeepAwake(in IVoiceInteractionSession session, boolean keepAwake)433     void setVoiceKeepAwake(in IVoiceInteractionSession session, boolean keepAwake);
434 
getPackageScreenCompatMode(in String packageName)435     int getPackageScreenCompatMode(in String packageName);
setPackageScreenCompatMode(in String packageName, int mode)436     void setPackageScreenCompatMode(in String packageName, int mode);
getPackageAskScreenCompat(in String packageName)437     boolean getPackageAskScreenCompat(in String packageName);
setPackageAskScreenCompat(in String packageName, boolean ask)438     void setPackageAskScreenCompat(in String packageName, boolean ask);
439 
440     /**
441      * Clears launch params for given packages.
442      */
clearLaunchParamsForPackages(in List<String> packageNames)443     void clearLaunchParamsForPackages(in List<String> packageNames);
444 
445     /**
446      * Makes the display with the given id a single task instance display. I.e the display can only
447      * contain one task.
448      */
setDisplayToSingleTaskInstance(int displayId)449     void setDisplayToSingleTaskInstance(int displayId);
450 
451     /**
452      * Restarts the activity by killing its process if it is visible. If the activity is not
453      * visible, the activity will not be restarted immediately and just keep the activity record in
454      * the stack. It also resets the current override configuration so the activity will use the
455      * configuration according to the latest state.
456      *
457      * @param activityToken The token of the target activity to restart.
458      */
restartActivityProcessIfVisible(in IBinder activityToken)459     void restartActivityProcessIfVisible(in IBinder activityToken);
460 
461     /**
462      * Reports that an Activity received a back key press when there were no additional activities
463      * on the back stack. If the Activity should be finished, the callback will be invoked. A
464      * callback is used instead of finishing the activity directly from the server such that the
465      * client may perform actions prior to finishing.
466      */
onBackPressedOnTaskRoot(in IBinder activityToken, in IRequestFinishCallback callback)467     void onBackPressedOnTaskRoot(in IBinder activityToken, in IRequestFinishCallback callback);
468 }
469