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