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 19 import android.app.ActivityManager; 20 import android.app.ApplicationErrorReport; 21 import android.app.ContentProviderHolder; 22 import android.app.IApplicationThread; 23 import android.app.IActivityContainer; 24 import android.app.IActivityContainerCallback; 25 import android.app.IActivityController; 26 import android.app.IAppTask; 27 import android.app.IInstrumentationWatcher; 28 import android.app.IProcessObserver; 29 import android.app.IServiceConnection; 30 import android.app.IStopUserCallback; 31 import android.app.ITaskStackListener; 32 import android.app.IUiAutomationConnection; 33 import android.app.IUidObserver; 34 import android.app.IUserSwitchObserver; 35 import android.app.Notification; 36 import android.app.PendingIntent; 37 import android.app.PictureInPictureParams; 38 import android.app.ProfilerInfo; 39 import android.app.WaitResult; 40 import android.app.assist.AssistContent; 41 import android.app.assist.AssistStructure; 42 import android.content.ComponentName; 43 import android.content.IIntentReceiver; 44 import android.content.IIntentSender; 45 import android.content.Intent; 46 import android.content.IntentFilter; 47 import android.content.IntentSender; 48 import android.content.pm.ApplicationInfo; 49 import android.content.pm.ConfigurationInfo; 50 import android.content.pm.IPackageDataObserver; 51 import android.content.pm.ParceledListSlice; 52 import android.content.pm.ProviderInfo; 53 import android.content.pm.UserInfo; 54 import android.content.res.Configuration; 55 import android.graphics.Bitmap; 56 import android.graphics.GraphicBuffer; 57 import android.graphics.Point; 58 import android.graphics.Rect; 59 import android.net.Uri; 60 import android.os.Bundle; 61 import android.os.Debug; 62 import android.os.IBinder; 63 import android.os.IProgressListener; 64 import android.os.ParcelFileDescriptor; 65 import android.os.PersistableBundle; 66 import android.os.StrictMode; 67 import android.service.voice.IVoiceInteractionSession; 68 import com.android.internal.app.IVoiceInteractor; 69 import com.android.internal.os.IResultReceiver; 70 import com.android.internal.policy.IKeyguardDismissCallback; 71 72 import java.util.List; 73 74 /** 75 * System private API for talking with the activity manager service. This 76 * provides calls from the application back to the activity manager. 77 * 78 * {@hide} 79 */ 80 interface IActivityManager { 81 // WARNING: when these transactions are updated, check if they are any callers on the native 82 // side. If so, make sure they are using the correct transaction ids and arguments. 83 // If a transaction which will also be used on the native side is being inserted, add it to 84 // below block of transactions. 85 86 // Since these transactions are also called from native code, these must be kept in sync with 87 // the ones in frameworks/native/include/binder/IActivityManager.h 88 // =============== Beginning of transactions used on native side as well ====================== openContentUri(in String uriString)89 ParcelFileDescriptor openContentUri(in String uriString); 90 // =============== End of transactions used on native side as well ============================ 91 92 // Special low-level communication with activity manager. handleApplicationCrash(in IBinder app, in ApplicationErrorReport.ParcelableCrashInfo crashInfo)93 void handleApplicationCrash(in IBinder app, 94 in ApplicationErrorReport.ParcelableCrashInfo crashInfo); 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)95 int startActivity(in IApplicationThread caller, in String callingPackage, in Intent intent, 96 in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, 97 int flags, in ProfilerInfo profilerInfo, in Bundle options); unhandledBack()98 void unhandledBack(); 99 finishActivity(in IBinder token, int code, in Intent data, int finishTask)100 boolean finishActivity(in IBinder token, int code, in Intent data, int finishTask); registerReceiver(in IApplicationThread caller, in String callerPackage, in IIntentReceiver receiver, in IntentFilter filter, in String requiredPermission, int userId, int flags)101 Intent registerReceiver(in IApplicationThread caller, in String callerPackage, 102 in IIntentReceiver receiver, in IntentFilter filter, 103 in String requiredPermission, int userId, int flags); unregisterReceiver(in IIntentReceiver receiver)104 void unregisterReceiver(in IIntentReceiver receiver); broadcastIntent(in IApplicationThread caller, in Intent intent, in String resolvedType, in IIntentReceiver resultTo, int resultCode, in String resultData, in Bundle map, in String[] requiredPermissions, int appOp, in Bundle options, boolean serialized, boolean sticky, int userId)105 int broadcastIntent(in IApplicationThread caller, in Intent intent, 106 in String resolvedType, in IIntentReceiver resultTo, int resultCode, 107 in String resultData, in Bundle map, in String[] requiredPermissions, 108 int appOp, in Bundle options, boolean serialized, boolean sticky, int userId); unbroadcastIntent(in IApplicationThread caller, in Intent intent, int userId)109 void unbroadcastIntent(in IApplicationThread caller, in Intent intent, int userId); finishReceiver(in IBinder who, int resultCode, in String resultData, in Bundle map, boolean abortBroadcast, int flags)110 oneway void finishReceiver(in IBinder who, int resultCode, in String resultData, in Bundle map, 111 boolean abortBroadcast, int flags); attachApplication(in IApplicationThread app)112 void attachApplication(in IApplicationThread app); activityIdle(in IBinder token, in Configuration config, in boolean stopProfiling)113 oneway void activityIdle(in IBinder token, in Configuration config, 114 in boolean stopProfiling); activityPaused(in IBinder token)115 void activityPaused(in IBinder token); activityStopped(in IBinder token, in Bundle state, in PersistableBundle persistentState, in CharSequence description)116 oneway void activityStopped(in IBinder token, in Bundle state, 117 in PersistableBundle persistentState, in CharSequence description); getCallingPackage(in IBinder token)118 String getCallingPackage(in IBinder token); getCallingActivity(in IBinder token)119 ComponentName getCallingActivity(in IBinder token); getTasks(int maxNum, int flags)120 List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags); moveTaskToFront(int task, int flags, in Bundle options)121 void moveTaskToFront(int task, int flags, in Bundle options); moveTaskBackwards(int task)122 void moveTaskBackwards(int task); getTaskForActivity(in IBinder token, in boolean onlyRoot)123 int getTaskForActivity(in IBinder token, in boolean onlyRoot); getContentProvider(in IApplicationThread caller, in String name, int userId, boolean stable)124 ContentProviderHolder getContentProvider(in IApplicationThread caller, 125 in String name, int userId, boolean stable); publishContentProviders(in IApplicationThread caller, in List<ContentProviderHolder> providers)126 void publishContentProviders(in IApplicationThread caller, 127 in List<ContentProviderHolder> providers); refContentProvider(in IBinder connection, int stableDelta, int unstableDelta)128 boolean refContentProvider(in IBinder connection, int stableDelta, int unstableDelta); finishSubActivity(in IBinder token, in String resultWho, int requestCode)129 void finishSubActivity(in IBinder token, in String resultWho, int requestCode); getRunningServiceControlPanel(in ComponentName service)130 PendingIntent getRunningServiceControlPanel(in ComponentName service); startService(in IApplicationThread caller, in Intent service, in String resolvedType, boolean requireForeground, in String callingPackage, int userId)131 ComponentName startService(in IApplicationThread caller, in Intent service, 132 in String resolvedType, boolean requireForeground, in String callingPackage, int userId); stopService(in IApplicationThread caller, in Intent service, in String resolvedType, int userId)133 int stopService(in IApplicationThread caller, in Intent service, 134 in String resolvedType, int userId); bindService(in IApplicationThread caller, in IBinder token, in Intent service, in String resolvedType, in IServiceConnection connection, int flags, in String callingPackage, int userId)135 int bindService(in IApplicationThread caller, in IBinder token, in Intent service, 136 in String resolvedType, in IServiceConnection connection, int flags, 137 in String callingPackage, int userId); unbindService(in IServiceConnection connection)138 boolean unbindService(in IServiceConnection connection); publishService(in IBinder token, in Intent intent, in IBinder service)139 void publishService(in IBinder token, in Intent intent, in IBinder service); activityResumed(in IBinder token)140 void activityResumed(in IBinder token); setDebugApp(in String packageName, boolean waitForDebugger, boolean persistent)141 void setDebugApp(in String packageName, boolean waitForDebugger, boolean persistent); setAlwaysFinish(boolean enabled)142 void setAlwaysFinish(boolean enabled); startInstrumentation(in ComponentName className, in String profileFile, int flags, in Bundle arguments, in IInstrumentationWatcher watcher, in IUiAutomationConnection connection, int userId, in String abiOverride)143 boolean startInstrumentation(in ComponentName className, in String profileFile, 144 int flags, in Bundle arguments, in IInstrumentationWatcher watcher, 145 in IUiAutomationConnection connection, int userId, 146 in String abiOverride); addInstrumentationResults(in IApplicationThread target, in Bundle results)147 void addInstrumentationResults(in IApplicationThread target, in Bundle results); finishInstrumentation(in IApplicationThread target, int resultCode, in Bundle results)148 void finishInstrumentation(in IApplicationThread target, int resultCode, 149 in Bundle results); 150 /** 151 * @return A copy of global {@link Configuration}, contains general settings for the entire 152 * system. Corresponds to the configuration of the default display. 153 * @throws RemoteException 154 */ getConfiguration()155 Configuration getConfiguration(); 156 /** 157 * Updates global configuration and applies changes to the entire system. 158 * @param values Update values for global configuration. If null is passed it will request the 159 * Window Manager to compute new config for the default display. 160 * @throws RemoteException 161 * @return Returns true if the configuration was updated. 162 */ updateConfiguration(in Configuration values)163 boolean updateConfiguration(in Configuration values); stopServiceToken(in ComponentName className, in IBinder token, int startId)164 boolean stopServiceToken(in ComponentName className, in IBinder token, int startId); getActivityClassForToken(in IBinder token)165 ComponentName getActivityClassForToken(in IBinder token); getPackageForToken(in IBinder token)166 String getPackageForToken(in IBinder token); setProcessLimit(int max)167 void setProcessLimit(int max); getProcessLimit()168 int getProcessLimit(); checkPermission(in String permission, int pid, int uid)169 int checkPermission(in String permission, int pid, int uid); checkUriPermission(in Uri uri, int pid, int uid, int mode, int userId, in IBinder callerToken)170 int checkUriPermission(in Uri uri, int pid, int uid, int mode, int userId, 171 in IBinder callerToken); grantUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri, int mode, int userId)172 void grantUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri, 173 int mode, int userId); revokeUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri, int mode, int userId)174 void revokeUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri, 175 int mode, int userId); setActivityController(in IActivityController watcher, boolean imAMonkey)176 void setActivityController(in IActivityController watcher, boolean imAMonkey); showWaitingForDebugger(in IApplicationThread who, boolean waiting)177 void showWaitingForDebugger(in IApplicationThread who, boolean waiting); 178 /* 179 * This will deliver the specified signal to all the persistent processes. Currently only 180 * SIGUSR1 is delivered. All others are ignored. 181 */ signalPersistentProcesses(int signal)182 void signalPersistentProcesses(int signal); getRecentTasks(int maxNum, int flags, int userId)183 ParceledListSlice getRecentTasks(int maxNum, 184 int flags, int userId); serviceDoneExecuting(in IBinder token, int type, int startId, int res)185 oneway void serviceDoneExecuting(in IBinder token, int type, int startId, int res); activityDestroyed(in IBinder token)186 oneway void activityDestroyed(in IBinder token); getIntentSender(int type, in String packageName, in IBinder token, in String resultWho, int requestCode, in Intent[] intents, in String[] resolvedTypes, int flags, in Bundle options, int userId)187 IIntentSender getIntentSender(int type, in String packageName, in IBinder token, 188 in String resultWho, int requestCode, in Intent[] intents, in String[] resolvedTypes, 189 int flags, in Bundle options, int userId); cancelIntentSender(in IIntentSender sender)190 void cancelIntentSender(in IIntentSender sender); getPackageForIntentSender(in IIntentSender sender)191 String getPackageForIntentSender(in IIntentSender sender); registerIntentSenderCancelListener(in IIntentSender sender, in IResultReceiver receiver)192 void registerIntentSenderCancelListener(in IIntentSender sender, in IResultReceiver receiver); unregisterIntentSenderCancelListener(in IIntentSender sender, in IResultReceiver receiver)193 void unregisterIntentSenderCancelListener(in IIntentSender sender, in IResultReceiver receiver); enterSafeMode()194 void enterSafeMode(); startNextMatchingActivity(in IBinder callingActivity, in Intent intent, in Bundle options)195 boolean startNextMatchingActivity(in IBinder callingActivity, 196 in Intent intent, in Bundle options); noteWakeupAlarm(in IIntentSender sender, int sourceUid, in String sourcePkg, in String tag)197 void noteWakeupAlarm(in IIntentSender sender, int sourceUid, 198 in String sourcePkg, in String tag); removeContentProvider(in IBinder connection, boolean stable)199 void removeContentProvider(in IBinder connection, boolean stable); setRequestedOrientation(in IBinder token, int requestedOrientation)200 void setRequestedOrientation(in IBinder token, int requestedOrientation); getRequestedOrientation(in IBinder token)201 int getRequestedOrientation(in IBinder token); unbindFinished(in IBinder token, in Intent service, boolean doRebind)202 void unbindFinished(in IBinder token, in Intent service, boolean doRebind); setProcessImportant(in IBinder token, int pid, boolean isForeground, String reason)203 void setProcessImportant(in IBinder token, int pid, boolean isForeground, String reason); setServiceForeground(in ComponentName className, in IBinder token, int id, in Notification notification, int flags)204 void setServiceForeground(in ComponentName className, in IBinder token, 205 int id, in Notification notification, int flags); moveActivityTaskToBack(in IBinder token, boolean nonRoot)206 boolean moveActivityTaskToBack(in IBinder token, boolean nonRoot); getMemoryInfo(out ActivityManager.MemoryInfo outInfo)207 void getMemoryInfo(out ActivityManager.MemoryInfo outInfo); getProcessesInErrorState()208 List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState(); clearApplicationUserData(in String packageName, in IPackageDataObserver observer, int userId)209 boolean clearApplicationUserData(in String packageName, 210 in IPackageDataObserver observer, int userId); forceStopPackage(in String packageName, int userId)211 void forceStopPackage(in String packageName, int userId); killPids(in int[] pids, in String reason, boolean secure)212 boolean killPids(in int[] pids, in String reason, boolean secure); getServices(int maxNum, int flags)213 List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags); getTaskThumbnail(int taskId)214 ActivityManager.TaskThumbnail getTaskThumbnail(int taskId); getTaskDescription(int taskId)215 ActivityManager.TaskDescription getTaskDescription(int taskId); 216 // Retrieve running application processes in the system getRunningAppProcesses()217 List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses(); 218 // Get device configuration getDeviceConfigurationInfo()219 ConfigurationInfo getDeviceConfigurationInfo(); peekService(in Intent service, in String resolvedType, in String callingPackage)220 IBinder peekService(in Intent service, in String resolvedType, in String callingPackage); 221 // Turn on/off profiling in a particular process. profileControl(in String process, int userId, boolean start, in ProfilerInfo profilerInfo, int profileType)222 boolean profileControl(in String process, int userId, boolean start, 223 in ProfilerInfo profilerInfo, int profileType); shutdown(int timeout)224 boolean shutdown(int timeout); stopAppSwitches()225 void stopAppSwitches(); resumeAppSwitches()226 void resumeAppSwitches(); bindBackupAgent(in String packageName, int backupRestoreMode, int userId)227 boolean bindBackupAgent(in String packageName, int backupRestoreMode, int userId); backupAgentCreated(in String packageName, in IBinder agent)228 void backupAgentCreated(in String packageName, in IBinder agent); unbindBackupAgent(in ApplicationInfo appInfo)229 void unbindBackupAgent(in ApplicationInfo appInfo); getUidForIntentSender(in IIntentSender sender)230 int getUidForIntentSender(in IIntentSender sender); handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll, boolean requireFull, in String name, in String callerPackage)231 int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll, 232 boolean requireFull, in String name, in String callerPackage); addPackageDependency(in String packageName)233 void addPackageDependency(in String packageName); killApplication(in String pkg, int appId, int userId, in String reason)234 void killApplication(in String pkg, int appId, int userId, in String reason); closeSystemDialogs(in String reason)235 void closeSystemDialogs(in String reason); getProcessMemoryInfo(in int[] pids)236 Debug.MemoryInfo[] getProcessMemoryInfo(in int[] pids); killApplicationProcess(in String processName, int uid)237 void killApplicationProcess(in String processName, int uid); 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)238 int startActivityIntentSender(in IApplicationThread caller, 239 in IIntentSender target, in IBinder whitelistToken, in Intent fillInIntent, 240 in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, 241 int flagsMask, int flagsValues, in Bundle options); overridePendingTransition(in IBinder token, in String packageName, int enterAnim, int exitAnim)242 void overridePendingTransition(in IBinder token, in String packageName, 243 int enterAnim, int exitAnim); 244 // Special low-level communication with activity manager. handleApplicationWtf(in IBinder app, in String tag, boolean system, in ApplicationErrorReport.ParcelableCrashInfo crashInfo)245 boolean handleApplicationWtf(in IBinder app, in String tag, boolean system, 246 in ApplicationErrorReport.ParcelableCrashInfo crashInfo); killBackgroundProcesses(in String packageName, int userId)247 void killBackgroundProcesses(in String packageName, int userId); isUserAMonkey()248 boolean isUserAMonkey(); 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)249 WaitResult startActivityAndWait(in IApplicationThread caller, in String callingPackage, 250 in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, 251 int requestCode, int flags, in ProfilerInfo profilerInfo, in Bundle options, 252 int userId); willActivityBeVisible(in IBinder token)253 boolean willActivityBeVisible(in IBinder token); 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)254 int startActivityWithConfig(in IApplicationThread caller, in String callingPackage, 255 in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, 256 int requestCode, int startFlags, in Configuration newConfig, 257 in Bundle options, int userId); 258 // Retrieve info of applications installed on external media that are currently 259 // running. getRunningExternalApplications()260 List<ApplicationInfo> getRunningExternalApplications(); finishHeavyWeightApp()261 void finishHeavyWeightApp(); 262 // A StrictMode violation to be handled. The violationMask is a 263 // subset of the original StrictMode policy bitmask, with only the 264 // bit violated and penalty bits to be executed by the 265 // ActivityManagerService remaining set. handleApplicationStrictModeViolation(in IBinder app, int violationMask, in StrictMode.ViolationInfo crashInfo)266 void handleApplicationStrictModeViolation(in IBinder app, int violationMask, 267 in StrictMode.ViolationInfo crashInfo); isImmersive(in IBinder token)268 boolean isImmersive(in IBinder token); setImmersive(in IBinder token, boolean immersive)269 void setImmersive(in IBinder token, boolean immersive); isTopActivityImmersive()270 boolean isTopActivityImmersive(); crashApplication(int uid, int initialPid, in String packageName, int userId, in String message)271 void crashApplication(int uid, int initialPid, in String packageName, int userId, in String message); getProviderMimeType(in Uri uri, int userId)272 String getProviderMimeType(in Uri uri, int userId); newUriPermissionOwner(in String name)273 IBinder newUriPermissionOwner(in String name); grantUriPermissionFromOwner(in IBinder owner, int fromUid, in String targetPkg, in Uri uri, int mode, int sourceUserId, int targetUserId)274 void grantUriPermissionFromOwner(in IBinder owner, int fromUid, in String targetPkg, 275 in Uri uri, int mode, int sourceUserId, int targetUserId); revokeUriPermissionFromOwner(in IBinder owner, in Uri uri, int mode, int userId)276 void revokeUriPermissionFromOwner(in IBinder owner, in Uri uri, int mode, int userId); checkGrantUriPermission(int callingUid, in String targetPkg, in Uri uri, int modeFlags, int userId)277 int checkGrantUriPermission(int callingUid, in String targetPkg, in Uri uri, 278 int modeFlags, int userId); 279 // Cause the specified process to dump the specified heap. dumpHeap(in String process, int userId, boolean managed, in String path, in ParcelFileDescriptor fd)280 boolean dumpHeap(in String process, int userId, boolean managed, in String path, 281 in ParcelFileDescriptor fd); startActivities(in IApplicationThread caller, in String callingPackage, in Intent[] intents, in String[] resolvedTypes, in IBinder resultTo, in Bundle options, int userId)282 int startActivities(in IApplicationThread caller, in String callingPackage, 283 in Intent[] intents, in String[] resolvedTypes, in IBinder resultTo, 284 in Bundle options, int userId); isUserRunning(int userid, int flags)285 boolean isUserRunning(int userid, int flags); activitySlept(in IBinder token)286 oneway void activitySlept(in IBinder token); getFrontActivityScreenCompatMode()287 int getFrontActivityScreenCompatMode(); setFrontActivityScreenCompatMode(int mode)288 void setFrontActivityScreenCompatMode(int mode); getPackageScreenCompatMode(in String packageName)289 int getPackageScreenCompatMode(in String packageName); setPackageScreenCompatMode(in String packageName, int mode)290 void setPackageScreenCompatMode(in String packageName, int mode); getPackageAskScreenCompat(in String packageName)291 boolean getPackageAskScreenCompat(in String packageName); setPackageAskScreenCompat(in String packageName, boolean ask)292 void setPackageAskScreenCompat(in String packageName, boolean ask); switchUser(int userid)293 boolean switchUser(int userid); setFocusedTask(int taskId)294 void setFocusedTask(int taskId); removeTask(int taskId)295 boolean removeTask(int taskId); registerProcessObserver(in IProcessObserver observer)296 void registerProcessObserver(in IProcessObserver observer); unregisterProcessObserver(in IProcessObserver observer)297 void unregisterProcessObserver(in IProcessObserver observer); isIntentSenderTargetedToPackage(in IIntentSender sender)298 boolean isIntentSenderTargetedToPackage(in IIntentSender sender); updatePersistentConfiguration(in Configuration values)299 void updatePersistentConfiguration(in Configuration values); getProcessPss(in int[] pids)300 long[] getProcessPss(in int[] pids); showBootMessage(in CharSequence msg, boolean always)301 void showBootMessage(in CharSequence msg, boolean always); killAllBackgroundProcesses()302 void killAllBackgroundProcesses(); getContentProviderExternal(in String name, int userId, in IBinder token)303 ContentProviderHolder getContentProviderExternal(in String name, int userId, 304 in IBinder token); removeContentProviderExternal(in String name, in IBinder token)305 void removeContentProviderExternal(in String name, in IBinder token); 306 // Get memory information about the calling process. getMyMemoryState(out ActivityManager.RunningAppProcessInfo outInfo)307 void getMyMemoryState(out ActivityManager.RunningAppProcessInfo outInfo); killProcessesBelowForeground(in String reason)308 boolean killProcessesBelowForeground(in String reason); getCurrentUser()309 UserInfo getCurrentUser(); shouldUpRecreateTask(in IBinder token, in String destAffinity)310 boolean shouldUpRecreateTask(in IBinder token, in String destAffinity); navigateUpTo(in IBinder token, in Intent target, int resultCode, in Intent resultData)311 boolean navigateUpTo(in IBinder token, in Intent target, int resultCode, 312 in Intent resultData); setLockScreenShown(boolean showing)313 void setLockScreenShown(boolean showing); finishActivityAffinity(in IBinder token)314 boolean finishActivityAffinity(in IBinder token); 315 // This is not public because you need to be very careful in how you 316 // manage your activity to make sure it is always the uid you expect. getLaunchedFromUid(in IBinder activityToken)317 int getLaunchedFromUid(in IBinder activityToken); unstableProviderDied(in IBinder connection)318 void unstableProviderDied(in IBinder connection); isIntentSenderAnActivity(in IIntentSender sender)319 boolean isIntentSenderAnActivity(in IIntentSender sender); 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)320 int startActivityAsUser(in IApplicationThread caller, in String callingPackage, 321 in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, 322 int requestCode, int flags, in ProfilerInfo profilerInfo, 323 in Bundle options, int userId); stopUser(int userid, boolean force, in IStopUserCallback callback)324 int stopUser(int userid, boolean force, in IStopUserCallback callback); registerUserSwitchObserver(in IUserSwitchObserver observer, in String name)325 void registerUserSwitchObserver(in IUserSwitchObserver observer, in String name); unregisterUserSwitchObserver(in IUserSwitchObserver observer)326 void unregisterUserSwitchObserver(in IUserSwitchObserver observer); getRunningUserIds()327 int[] getRunningUserIds(); 328 329 // Deprecated - This method is only used by a few internal components and it will soon be 330 // replaced by a proper bug report API (which will be restricted to a few, pre-defined apps). 331 // No new code should be calling it. requestBugReport(int bugreportType)332 void requestBugReport(int bugreportType); 333 334 /** 335 * Takes a telephony bug report and notifies the user with the title and description 336 * that are passed to this API as parameters 337 * 338 * @param shareTitle should be a valid legible string less than 50 chars long 339 * @param shareDescription should be less than 91 bytes when encoded into UTF-8 format 340 * 341 * @throws IllegalArgumentException if shareTitle or shareDescription is too big or if the 342 * paremeters cannot be encoding to an UTF-8 charset. 343 */ requestTelephonyBugReport(in String shareTitle, in String shareDescription)344 void requestTelephonyBugReport(in String shareTitle, in String shareDescription); 345 inputDispatchingTimedOut(int pid, boolean aboveSystem, in String reason)346 long inputDispatchingTimedOut(int pid, boolean aboveSystem, in String reason); clearPendingBackup()347 void clearPendingBackup(); getIntentForIntentSender(in IIntentSender sender)348 Intent getIntentForIntentSender(in IIntentSender sender); getAssistContextExtras(int requestType)349 Bundle getAssistContextExtras(int requestType); reportAssistContextExtras(in IBinder token, in Bundle extras, in AssistStructure structure, in AssistContent content, in Uri referrer)350 void reportAssistContextExtras(in IBinder token, in Bundle extras, 351 in AssistStructure structure, in AssistContent content, in Uri referrer); 352 // This is not public because you need to be very careful in how you 353 // manage your activity to make sure it is always the uid you expect. getLaunchedFromPackage(in IBinder activityToken)354 String getLaunchedFromPackage(in IBinder activityToken); killUid(int appId, int userId, in String reason)355 void killUid(int appId, int userId, in String reason); setUserIsMonkey(boolean monkey)356 void setUserIsMonkey(boolean monkey); hang(in IBinder who, boolean allowRestart)357 void hang(in IBinder who, boolean allowRestart); createVirtualActivityContainer(in IBinder parentActivityToken, in IActivityContainerCallback callback)358 IActivityContainer createVirtualActivityContainer(in IBinder parentActivityToken, 359 in IActivityContainerCallback callback); moveTaskToStack(int taskId, int stackId, boolean toTop)360 void moveTaskToStack(int taskId, int stackId, boolean toTop); 361 /** 362 * Resizes the input stack id to the given bounds. 363 * 364 * @param stackId Id of the stack to resize. 365 * @param bounds Bounds to resize the stack to or {@code null} for fullscreen. 366 * @param allowResizeInDockedMode True if the resize should be allowed when the docked stack is 367 * active. 368 * @param preserveWindows True if the windows of activities contained in the stack should be 369 * preserved. 370 * @param animate True if the stack resize should be animated. 371 * @param animationDuration The duration of the resize animation in milliseconds or -1 if the 372 * default animation duration should be used. 373 * @throws RemoteException 374 */ resizeStack(int stackId, in Rect bounds, boolean allowResizeInDockedMode, boolean preserveWindows, boolean animate, int animationDuration)375 void resizeStack(int stackId, in Rect bounds, boolean allowResizeInDockedMode, 376 boolean preserveWindows, boolean animate, int animationDuration); getAllStackInfos()377 List<ActivityManager.StackInfo> getAllStackInfos(); setFocusedStack(int stackId)378 void setFocusedStack(int stackId); getStackInfo(int stackId)379 ActivityManager.StackInfo getStackInfo(int stackId); convertFromTranslucent(in IBinder token)380 boolean convertFromTranslucent(in IBinder token); convertToTranslucent(in IBinder token, in Bundle options)381 boolean convertToTranslucent(in IBinder token, in Bundle options); notifyActivityDrawn(in IBinder token)382 void notifyActivityDrawn(in IBinder token); reportActivityFullyDrawn(in IBinder token)383 void reportActivityFullyDrawn(in IBinder token); restart()384 void restart(); performIdleMaintenance()385 void performIdleMaintenance(); takePersistableUriPermission(in Uri uri, int modeFlags, int userId)386 void takePersistableUriPermission(in Uri uri, int modeFlags, int userId); releasePersistableUriPermission(in Uri uri, int modeFlags, int userId)387 void releasePersistableUriPermission(in Uri uri, int modeFlags, int userId); getPersistedUriPermissions(in String packageName, boolean incoming)388 ParceledListSlice getPersistedUriPermissions(in String packageName, boolean incoming); appNotRespondingViaProvider(in IBinder connection)389 void appNotRespondingViaProvider(in IBinder connection); getTaskBounds(int taskId)390 Rect getTaskBounds(int taskId); getActivityDisplayId(in IBinder activityToken)391 int getActivityDisplayId(in IBinder activityToken); setProcessMemoryTrimLevel(in String process, int uid, int level)392 boolean setProcessMemoryTrimLevel(in String process, int uid, int level); 393 394 395 // Start of L transactions getTagForIntentSender(in IIntentSender sender, in String prefix)396 String getTagForIntentSender(in IIntentSender sender, in String prefix); startUserInBackground(int userid)397 boolean startUserInBackground(int userid); startLockTaskModeById(int taskId)398 void startLockTaskModeById(int taskId); startLockTaskModeByToken(in IBinder token)399 void startLockTaskModeByToken(in IBinder token); stopLockTaskMode()400 void stopLockTaskMode(); isInLockTaskMode()401 boolean isInLockTaskMode(); setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values)402 void setTaskDescription(in IBinder token, in ActivityManager.TaskDescription values); 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)403 int startVoiceActivity(in String callingPackage, int callingPid, int callingUid, 404 in Intent intent, in String resolvedType, in IVoiceInteractionSession session, 405 in IVoiceInteractor interactor, int flags, in ProfilerInfo profilerInfo, 406 in Bundle options, int userId); startAssistantActivity(in String callingPackage, int callingPid, int callingUid, in Intent intent, in String resolvedType, in Bundle options, int userId)407 int startAssistantActivity(in String callingPackage, int callingPid, int callingUid, 408 in Intent intent, in String resolvedType, in Bundle options, int userId); getActivityOptions(in IBinder token)409 Bundle getActivityOptions(in IBinder token); getAppTasks(in String callingPackage)410 List<IBinder> getAppTasks(in String callingPackage); startSystemLockTaskMode(int taskId)411 void startSystemLockTaskMode(int taskId); stopSystemLockTaskMode()412 void stopSystemLockTaskMode(); finishVoiceTask(in IVoiceInteractionSession session)413 void finishVoiceTask(in IVoiceInteractionSession session); isTopOfTask(in IBinder token)414 boolean isTopOfTask(in IBinder token); requestVisibleBehind(in IBinder token, boolean visible)415 boolean requestVisibleBehind(in IBinder token, boolean visible); isBackgroundVisibleBehind(in IBinder token)416 boolean isBackgroundVisibleBehind(in IBinder token); backgroundResourcesReleased(in IBinder token)417 void backgroundResourcesReleased(in IBinder token); notifyLaunchTaskBehindComplete(in IBinder token)418 void notifyLaunchTaskBehindComplete(in IBinder token); startActivityFromRecents(int taskId, in Bundle options)419 int startActivityFromRecents(int taskId, in Bundle options); notifyEnterAnimationComplete(in IBinder token)420 void notifyEnterAnimationComplete(in IBinder token); 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, boolean ignoreTargetSecurity, int userId)421 int startActivityAsCaller(in IApplicationThread caller, in String callingPackage, 422 in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, 423 int requestCode, int flags, in ProfilerInfo profilerInfo, in Bundle options, 424 boolean ignoreTargetSecurity, int userId); addAppTask(in IBinder activityToken, in Intent intent, in ActivityManager.TaskDescription description, in Bitmap thumbnail)425 int addAppTask(in IBinder activityToken, in Intent intent, 426 in ActivityManager.TaskDescription description, in Bitmap thumbnail); getAppTaskThumbnailSize()427 Point getAppTaskThumbnailSize(); releaseActivityInstance(in IBinder token)428 boolean releaseActivityInstance(in IBinder token); releaseSomeActivities(in IApplicationThread app)429 void releaseSomeActivities(in IApplicationThread app); bootAnimationComplete()430 void bootAnimationComplete(); getTaskDescriptionIcon(in String filename, int userId)431 Bitmap getTaskDescriptionIcon(in String filename, int userId); launchAssistIntent(in Intent intent, int requestType, in String hint, int userHandle, in Bundle args)432 boolean launchAssistIntent(in Intent intent, int requestType, in String hint, int userHandle, 433 in Bundle args); startInPlaceAnimationOnFrontMostApplication(in Bundle opts)434 void startInPlaceAnimationOnFrontMostApplication(in Bundle opts); checkPermissionWithToken(in String permission, int pid, int uid, in IBinder callerToken)435 int checkPermissionWithToken(in String permission, int pid, int uid, 436 in IBinder callerToken); registerTaskStackListener(in ITaskStackListener listener)437 void registerTaskStackListener(in ITaskStackListener listener); 438 439 440 // Start of M transactions notifyCleartextNetwork(int uid, in byte[] firstPacket)441 void notifyCleartextNetwork(int uid, in byte[] firstPacket); createStackOnDisplay(int displayId)442 IActivityContainer createStackOnDisplay(int displayId); getFocusedStackId()443 int getFocusedStackId(); setTaskResizeable(int taskId, int resizeableMode)444 void setTaskResizeable(int taskId, int resizeableMode); requestAssistContextExtras(int requestType, in IResultReceiver receiver, in Bundle receiverExtras, in IBinder activityToken, boolean focused, boolean newSessionId)445 boolean requestAssistContextExtras(int requestType, in IResultReceiver receiver, 446 in Bundle receiverExtras, in IBinder activityToken, 447 boolean focused, boolean newSessionId); resizeTask(int taskId, in Rect bounds, int resizeMode)448 void resizeTask(int taskId, in Rect bounds, int resizeMode); getLockTaskModeState()449 int getLockTaskModeState(); setDumpHeapDebugLimit(in String processName, int uid, long maxMemSize, in String reportPackage)450 void setDumpHeapDebugLimit(in String processName, int uid, long maxMemSize, 451 in String reportPackage); dumpHeapFinished(in String path)452 void dumpHeapFinished(in String path); setVoiceKeepAwake(in IVoiceInteractionSession session, boolean keepAwake)453 void setVoiceKeepAwake(in IVoiceInteractionSession session, boolean keepAwake); updateLockTaskPackages(int userId, in String[] packages)454 void updateLockTaskPackages(int userId, in String[] packages); noteAlarmStart(in IIntentSender sender, int sourceUid, in String tag)455 void noteAlarmStart(in IIntentSender sender, int sourceUid, in String tag); noteAlarmFinish(in IIntentSender sender, int sourceUid, in String tag)456 void noteAlarmFinish(in IIntentSender sender, int sourceUid, in String tag); getPackageProcessState(in String packageName, in String callingPackage)457 int getPackageProcessState(in String packageName, in String callingPackage); showLockTaskEscapeMessage(in IBinder token)458 oneway void showLockTaskEscapeMessage(in IBinder token); updateDeviceOwner(in String packageName)459 void updateDeviceOwner(in String packageName); 460 /** 461 * Notify the system that the keyguard is going away. 462 * 463 * @param flags See {@link android.view.WindowManagerPolicy#KEYGUARD_GOING_AWAY_FLAG_TO_SHADE} 464 * etc. 465 */ keyguardGoingAway(int flags)466 void keyguardGoingAway(int flags); getUidProcessState(int uid, in String callingPackage)467 int getUidProcessState(int uid, in String callingPackage); registerUidObserver(in IUidObserver observer, int which, int cutpoint, String callingPackage)468 void registerUidObserver(in IUidObserver observer, int which, int cutpoint, 469 String callingPackage); unregisterUidObserver(in IUidObserver observer)470 void unregisterUidObserver(in IUidObserver observer); isAssistDataAllowedOnCurrentActivity()471 boolean isAssistDataAllowedOnCurrentActivity(); showAssistFromActivity(in IBinder token, in Bundle args)472 boolean showAssistFromActivity(in IBinder token, in Bundle args); isRootVoiceInteraction(in IBinder token)473 boolean isRootVoiceInteraction(in IBinder token); 474 475 476 // Start of N transactions 477 // Start Binder transaction tracking for all applications. startBinderTracking()478 boolean startBinderTracking(); 479 // Stop Binder transaction tracking for all applications and dump trace data to the given file 480 // descriptor. stopBinderTrackingAndDump(in ParcelFileDescriptor fd)481 boolean stopBinderTrackingAndDump(in ParcelFileDescriptor fd); 482 /** 483 * Try to place task to provided position. The final position might be different depending on 484 * current user and stacks state. The task will be moved to target stack if it's currently in 485 * different stack. 486 */ positionTaskInStack(int taskId, int stackId, int position)487 void positionTaskInStack(int taskId, int stackId, int position); getActivityStackId(in IBinder token)488 int getActivityStackId(in IBinder token); exitFreeformMode(in IBinder token)489 void exitFreeformMode(in IBinder token); reportSizeConfigurations(in IBinder token, in int[] horizontalSizeConfiguration, in int[] verticalSizeConfigurations, in int[] smallestWidthConfigurations)490 void reportSizeConfigurations(in IBinder token, in int[] horizontalSizeConfiguration, 491 in int[] verticalSizeConfigurations, in int[] smallestWidthConfigurations); moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate, in Rect initialBounds)492 boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate, 493 in Rect initialBounds); suppressResizeConfigChanges(boolean suppress)494 void suppressResizeConfigChanges(boolean suppress); moveTasksToFullscreenStack(int fromStackId, boolean onTop)495 void moveTasksToFullscreenStack(int fromStackId, boolean onTop); moveTopActivityToPinnedStack(int stackId, in Rect bounds)496 boolean moveTopActivityToPinnedStack(int stackId, in Rect bounds); isAppStartModeDisabled(int uid, in String packageName)497 boolean isAppStartModeDisabled(int uid, in String packageName); unlockUser(int userid, in byte[] token, in byte[] secret, in IProgressListener listener)498 boolean unlockUser(int userid, in byte[] token, in byte[] secret, 499 in IProgressListener listener); isInMultiWindowMode(in IBinder token)500 boolean isInMultiWindowMode(in IBinder token); isInPictureInPictureMode(in IBinder token)501 boolean isInPictureInPictureMode(in IBinder token); killPackageDependents(in String packageName, int userId)502 void killPackageDependents(in String packageName, int userId); enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params)503 boolean enterPictureInPictureMode(in IBinder token, in PictureInPictureParams params); setPictureInPictureParams(in IBinder token, in PictureInPictureParams params)504 void setPictureInPictureParams(in IBinder token, in PictureInPictureParams params); getMaxNumPictureInPictureActions(in IBinder token)505 int getMaxNumPictureInPictureActions(in IBinder token); activityRelaunched(in IBinder token)506 void activityRelaunched(in IBinder token); getUriPermissionOwnerForActivity(in IBinder activityToken)507 IBinder getUriPermissionOwnerForActivity(in IBinder activityToken); 508 /** 509 * Resizes the docked stack, and all other stacks as the result of the dock stack bounds change. 510 * 511 * @param dockedBounds The bounds for the docked stack. 512 * @param tempDockedTaskBounds The temporary bounds for the tasks in the docked stack, which 513 * might be different from the stack bounds to allow more 514 * flexibility while resizing, or {@code null} if they should be the 515 * same as the stack bounds. 516 * @param tempDockedTaskInsetBounds The temporary bounds for the tasks to calculate the insets. 517 * When resizing, we usually "freeze" the layout of a task. To 518 * achieve that, we also need to "freeze" the insets, which 519 * gets achieved by changing task bounds but not bounds used 520 * to calculate the insets in this transient state 521 * @param tempOtherTaskBounds The temporary bounds for the tasks in all other stacks, or 522 * {@code null} if they should be the same as the stack bounds. 523 * @param tempOtherTaskInsetBounds Like {@code tempDockedTaskInsetBounds}, but for the other 524 * stacks. 525 * @throws RemoteException 526 */ resizeDockedStack(in Rect dockedBounds, in Rect tempDockedTaskBounds, in Rect tempDockedTaskInsetBounds, in Rect tempOtherTaskBounds, in Rect tempOtherTaskInsetBounds)527 void resizeDockedStack(in Rect dockedBounds, in Rect tempDockedTaskBounds, 528 in Rect tempDockedTaskInsetBounds, 529 in Rect tempOtherTaskBounds, in Rect tempOtherTaskInsetBounds); setVrMode(in IBinder token, boolean enabled, in ComponentName packageName)530 int setVrMode(in IBinder token, boolean enabled, in ComponentName packageName); 531 // Gets the URI permissions granted to an arbitrary package. 532 // NOTE: this is different from getPersistedUriPermissions(), which returns the URIs the package 533 // granted to another packages (instead of those granted to it). getGrantedUriPermissions(in String packageName, int userId)534 ParceledListSlice getGrantedUriPermissions(in String packageName, int userId); 535 // Clears the URI permissions granted to an arbitrary package. clearGrantedUriPermissions(in String packageName, int userId)536 void clearGrantedUriPermissions(in String packageName, int userId); isAppForeground(int uid)537 boolean isAppForeground(int uid); startLocalVoiceInteraction(in IBinder token, in Bundle options)538 void startLocalVoiceInteraction(in IBinder token, in Bundle options); stopLocalVoiceInteraction(in IBinder token)539 void stopLocalVoiceInteraction(in IBinder token); supportsLocalVoiceInteraction()540 boolean supportsLocalVoiceInteraction(); notifyPinnedStackAnimationStarted()541 void notifyPinnedStackAnimationStarted(); notifyPinnedStackAnimationEnded()542 void notifyPinnedStackAnimationEnded(); removeStack(int stackId)543 void removeStack(int stackId); makePackageIdle(String packageName, int userId)544 void makePackageIdle(String packageName, int userId); getMemoryTrimLevel()545 int getMemoryTrimLevel(); 546 /** 547 * Resizes the pinned stack. 548 * 549 * @param pinnedBounds The bounds for the pinned stack. 550 * @param tempPinnedTaskBounds The temporary bounds for the tasks in the pinned stack, which 551 * might be different from the stack bounds to allow more 552 * flexibility while resizing, or {@code null} if they should be the 553 * same as the stack bounds. 554 */ resizePinnedStack(in Rect pinnedBounds, in Rect tempPinnedTaskBounds)555 void resizePinnedStack(in Rect pinnedBounds, in Rect tempPinnedTaskBounds); isVrModePackageEnabled(in ComponentName packageName)556 boolean isVrModePackageEnabled(in ComponentName packageName); 557 /** 558 * Moves all tasks from the docked stack in the fullscreen stack and puts the top task of the 559 * fullscreen stack into the docked stack. 560 */ swapDockedAndFullscreenStack()561 void swapDockedAndFullscreenStack(); notifyLockedProfile(int userId)562 void notifyLockedProfile(int userId); startConfirmDeviceCredentialIntent(in Intent intent, in Bundle options)563 void startConfirmDeviceCredentialIntent(in Intent intent, in Bundle options); sendIdleJobTrigger()564 void sendIdleJobTrigger(); sendIntentSender(in IIntentSender target, in IBinder whitelistToken, int code, in Intent intent, in String resolvedType, in IIntentReceiver finishedReceiver, in String requiredPermission, in Bundle options)565 int sendIntentSender(in IIntentSender target, in IBinder whitelistToken, int code, 566 in Intent intent, in String resolvedType, in IIntentReceiver finishedReceiver, 567 in String requiredPermission, in Bundle options); 568 569 570 // Start of N MR1 transactions setVrThread(int tid)571 void setVrThread(int tid); setRenderThread(int tid)572 void setRenderThread(int tid); 573 /** 574 * Lets activity manager know whether the calling process is currently showing "top-level" UI 575 * that is not an activity, i.e. windows on the screen the user is currently interacting with. 576 * 577 * <p>This flag can only be set for persistent processes. 578 * 579 * @param hasTopUi Whether the calling process has "top-level" UI. 580 */ setHasTopUi(boolean hasTopUi)581 void setHasTopUi(boolean hasTopUi); 582 583 // Start of O transactions requestActivityRelaunch(in IBinder token)584 void requestActivityRelaunch(in IBinder token); 585 /** 586 * Updates override configuration applied to specific display. 587 * @param values Update values for display configuration. If null is passed it will request the 588 * Window Manager to compute new config for the specified display. 589 * @param displayId Id of the display to apply the config to. 590 * @throws RemoteException 591 * @return Returns true if the configuration was updated. 592 */ updateDisplayOverrideConfiguration(in Configuration values, int displayId)593 boolean updateDisplayOverrideConfiguration(in Configuration values, int displayId); unregisterTaskStackListener(ITaskStackListener listener)594 void unregisterTaskStackListener(ITaskStackListener listener); moveStackToDisplay(int stackId, int displayId)595 void moveStackToDisplay(int stackId, int displayId); requestAutofillData(in IResultReceiver receiver, in Bundle receiverExtras, in IBinder activityToken, int flags)596 boolean requestAutofillData(in IResultReceiver receiver, in Bundle receiverExtras, 597 in IBinder activityToken, int flags); dismissKeyguard(in IBinder token, in IKeyguardDismissCallback callback)598