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.ActivityManager.PendingIntentInfo; 21 import android.app.ActivityTaskManager; 22 import android.app.ApplicationErrorReport; 23 import android.app.ApplicationExitInfo; 24 import android.app.ContentProviderHolder; 25 import android.app.GrantedUriPermission; 26 import android.app.IApplicationThread; 27 import android.app.IActivityController; 28 import android.app.IAppTask; 29 import android.app.IForegroundServiceObserver; 30 import android.app.IInstrumentationWatcher; 31 import android.app.IProcessObserver; 32 import android.app.IServiceConnection; 33 import android.app.IStopUserCallback; 34 import android.app.ITaskStackListener; 35 import android.app.IUiAutomationConnection; 36 import android.app.IUidObserver; 37 import android.app.IUserSwitchObserver; 38 import android.app.Notification; 39 import android.app.PendingIntent; 40 import android.app.PictureInPictureParams; 41 import android.app.ProfilerInfo; 42 import android.app.WaitResult; 43 import android.app.assist.AssistContent; 44 import android.app.assist.AssistStructure; 45 import android.content.ComponentName; 46 import android.content.IIntentReceiver; 47 import android.content.IIntentSender; 48 import android.content.Intent; 49 import android.content.IntentFilter; 50 import android.content.IntentSender; 51 import android.content.pm.ApplicationInfo; 52 import android.content.pm.ConfigurationInfo; 53 import android.content.pm.IPackageDataObserver; 54 import android.content.pm.ParceledListSlice; 55 import android.content.pm.ProviderInfo; 56 import android.content.pm.ResolveInfo; 57 import android.content.pm.UserInfo; 58 import android.content.res.Configuration; 59 import android.content.LocusId; 60 import android.graphics.Bitmap; 61 import android.graphics.GraphicBuffer; 62 import android.graphics.Point; 63 import android.graphics.Rect; 64 import android.net.Uri; 65 import android.os.Bundle; 66 import android.os.Debug; 67 import android.os.IBinder; 68 import android.os.IProgressListener; 69 import android.os.ParcelFileDescriptor; 70 import android.os.PersistableBundle; 71 import android.os.RemoteCallback; 72 import android.os.StrictMode; 73 import android.os.WorkSource; 74 import android.service.voice.IVoiceInteractionSession; 75 import android.view.RemoteAnimationDefinition; 76 import android.view.RemoteAnimationAdapter; 77 import com.android.internal.app.IVoiceInteractor; 78 import com.android.internal.os.IResultReceiver; 79 import com.android.internal.policy.IKeyguardDismissCallback; 80 81 import java.util.List; 82 83 /** 84 * System private API for talking with the activity manager service. This 85 * provides calls from the application back to the activity manager. 86 * 87 * {@hide} 88 */ 89 interface IActivityManager { 90 // WARNING: when these transactions are updated, check if they are any callers on the native 91 // side. If so, make sure they are using the correct transaction ids and arguments. 92 // If a transaction which will also be used on the native side is being inserted, add it to 93 // below block of transactions. 94 95 // Since these transactions are also called from native code, these must be kept in sync with 96 // the ones in frameworks/native/libs/binder/include/binder/IActivityManager.h 97 // =============== Beginning of transactions used on native side as well ====================== openContentUri(in String uriString)98 ParcelFileDescriptor openContentUri(in String uriString); registerUidObserver(in IUidObserver observer, int which, int cutpoint, String callingPackage)99 void registerUidObserver(in IUidObserver observer, int which, int cutpoint, 100 String callingPackage); unregisterUidObserver(in IUidObserver observer)101 void unregisterUidObserver(in IUidObserver observer); isUidActive(int uid, String callingPackage)102 boolean isUidActive(int uid, String callingPackage); 103 @JavaPassthrough(annotation= 104 "@android.annotation.RequiresPermission(allOf = {android.Manifest.permission.PACKAGE_USAGE_STATS, android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}, conditional = true)") getUidProcessState(int uid, in String callingPackage)105 int getUidProcessState(int uid, in String callingPackage); 106 @UnsupportedAppUsage checkPermission(in String permission, int pid, int uid)107 int checkPermission(in String permission, int pid, int uid); 108 // =============== End of transactions used on native side as well ============================ 109 110 // Special low-level communication with activity manager. handleApplicationCrash(in IBinder app, in ApplicationErrorReport.ParcelableCrashInfo crashInfo)111 void handleApplicationCrash(in IBinder app, 112 in ApplicationErrorReport.ParcelableCrashInfo crashInfo); 113 /** @deprecated Use {@link #startActivityWithFeature} instead */ 114 @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@link android.content.Context#startActivity(android.content.Intent)} instead") 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)115 int startActivity(in IApplicationThread caller, in String callingPackage, in Intent intent, 116 in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode, 117 int flags, in ProfilerInfo profilerInfo, in Bundle options); startActivityWithFeature(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)118 int startActivityWithFeature(in IApplicationThread caller, in String callingPackage, 119 in String callingFeatureId, in Intent intent, in String resolvedType, 120 in IBinder resultTo, in String resultWho, int requestCode, int flags, 121 in ProfilerInfo profilerInfo, in Bundle options); 122 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) unhandledBack()123 void unhandledBack(); 124 @UnsupportedAppUsage finishActivity(in IBinder token, int code, in Intent data, int finishTask)125 boolean finishActivity(in IBinder token, int code, in Intent data, int finishTask); 126 @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@link android.content.Context#registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter)} instead") registerReceiver(in IApplicationThread caller, in String callerPackage, in IIntentReceiver receiver, in IntentFilter filter, in String requiredPermission, int userId, int flags)127 Intent registerReceiver(in IApplicationThread caller, in String callerPackage, 128 in IIntentReceiver receiver, in IntentFilter filter, 129 in String requiredPermission, int userId, int flags); registerReceiverWithFeature(in IApplicationThread caller, in String callerPackage, in String callingFeatureId, in String receiverId, in IIntentReceiver receiver, in IntentFilter filter, in String requiredPermission, int userId, int flags)130 Intent registerReceiverWithFeature(in IApplicationThread caller, in String callerPackage, 131 in String callingFeatureId, in String receiverId, in IIntentReceiver receiver, 132 in IntentFilter filter, in String requiredPermission, int userId, int flags); 133 @UnsupportedAppUsage unregisterReceiver(in IIntentReceiver receiver)134 void unregisterReceiver(in IIntentReceiver receiver); 135 /** @deprecated Use {@link #broadcastIntentWithFeature} instead */ 136 @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@link android.content.Context#sendBroadcast(android.content.Intent)} instead") 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)137 int broadcastIntent(in IApplicationThread caller, in Intent intent, 138 in String resolvedType, in IIntentReceiver resultTo, int resultCode, 139 in String resultData, in Bundle map, in String[] requiredPermissions, 140 int appOp, in Bundle options, boolean serialized, boolean sticky, int userId); broadcastIntentWithFeature(in IApplicationThread caller, in String callingFeatureId, in Intent intent, in String resolvedType, in IIntentReceiver resultTo, int resultCode, in String resultData, in Bundle map, in String[] requiredPermissions, in String[] excludePermissions, in String[] excludePackages, int appOp, in Bundle options, boolean serialized, boolean sticky, int userId)141 int broadcastIntentWithFeature(in IApplicationThread caller, in String callingFeatureId, 142 in Intent intent, in String resolvedType, in IIntentReceiver resultTo, int resultCode, 143 in String resultData, in Bundle map, in String[] requiredPermissions, in String[] excludePermissions, 144 in String[] excludePackages, int appOp, in Bundle options, boolean serialized, boolean sticky, int userId); unbroadcastIntent(in IApplicationThread caller, in Intent intent, int userId)145 void unbroadcastIntent(in IApplicationThread caller, in Intent intent, int userId); 146 @UnsupportedAppUsage finishReceiver(in IBinder who, int resultCode, in String resultData, in Bundle map, boolean abortBroadcast, int flags)147 oneway void finishReceiver(in IBinder who, int resultCode, in String resultData, in Bundle map, 148 boolean abortBroadcast, int flags); attachApplication(in IApplicationThread app, long startSeq)149 void attachApplication(in IApplicationThread app, long startSeq); getTasks(int maxNum)150 List<ActivityManager.RunningTaskInfo> getTasks(int maxNum); 151 @UnsupportedAppUsage moveTaskToFront(in IApplicationThread caller, in String callingPackage, int task, int flags, in Bundle options)152 void moveTaskToFront(in IApplicationThread caller, in String callingPackage, int task, 153 int flags, in Bundle options); 154 @UnsupportedAppUsage getTaskForActivity(in IBinder token, in boolean onlyRoot)155 int getTaskForActivity(in IBinder token, in boolean onlyRoot); getContentProvider(in IApplicationThread caller, in String callingPackage, in String name, int userId, boolean stable)156 ContentProviderHolder getContentProvider(in IApplicationThread caller, in String callingPackage, 157 in String name, int userId, boolean stable); 158 @UnsupportedAppUsage publishContentProviders(in IApplicationThread caller, in List<ContentProviderHolder> providers)159 void publishContentProviders(in IApplicationThread caller, 160 in List<ContentProviderHolder> providers); refContentProvider(in IBinder connection, int stableDelta, int unstableDelta)161 boolean refContentProvider(in IBinder connection, int stableDelta, int unstableDelta); getRunningServiceControlPanel(in ComponentName service)162 PendingIntent getRunningServiceControlPanel(in ComponentName service); startService(in IApplicationThread caller, in Intent service, in String resolvedType, boolean requireForeground, in String callingPackage, in String callingFeatureId, int userId)163 ComponentName startService(in IApplicationThread caller, in Intent service, 164 in String resolvedType, boolean requireForeground, in String callingPackage, 165 in String callingFeatureId, int userId); 166 @UnsupportedAppUsage stopService(in IApplicationThread caller, in Intent service, in String resolvedType, int userId)167 int stopService(in IApplicationThread caller, in Intent service, 168 in String resolvedType, int userId); 169 // Currently keeping old bindService because it is on the greylist 170 @UnsupportedAppUsage bindService(in IApplicationThread caller, in IBinder token, in Intent service, in String resolvedType, in IServiceConnection connection, int flags, in String callingPackage, int userId)171 int bindService(in IApplicationThread caller, in IBinder token, in Intent service, 172 in String resolvedType, in IServiceConnection connection, int flags, 173 in String callingPackage, int userId); bindServiceInstance(in IApplicationThread caller, in IBinder token, in Intent service, in String resolvedType, in IServiceConnection connection, int flags, in String instanceName, in String callingPackage, int userId)174 int bindServiceInstance(in IApplicationThread caller, in IBinder token, in Intent service, 175 in String resolvedType, in IServiceConnection connection, int flags, 176 in String instanceName, in String callingPackage, int userId); updateServiceGroup(in IServiceConnection connection, int group, int importance)177 void updateServiceGroup(in IServiceConnection connection, int group, int importance); 178 @UnsupportedAppUsage unbindService(in IServiceConnection connection)179 boolean unbindService(in IServiceConnection connection); publishService(in IBinder token, in Intent intent, in IBinder service)180 void publishService(in IBinder token, in Intent intent, in IBinder service); 181 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) setDebugApp(in String packageName, boolean waitForDebugger, boolean persistent)182 void setDebugApp(in String packageName, boolean waitForDebugger, boolean persistent); setAgentApp(in String packageName, @nullable String agent)183 void setAgentApp(in String packageName, @nullable String agent); 184 @UnsupportedAppUsage setAlwaysFinish(boolean enabled)185 void setAlwaysFinish(boolean enabled); 186 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) startInstrumentation(in ComponentName className, in String profileFile, int flags, in Bundle arguments, in IInstrumentationWatcher watcher, in IUiAutomationConnection connection, int userId, in String abiOverride)187 boolean startInstrumentation(in ComponentName className, in String profileFile, 188 int flags, in Bundle arguments, in IInstrumentationWatcher watcher, 189 in IUiAutomationConnection connection, int userId, 190 in String abiOverride); addInstrumentationResults(in IApplicationThread target, in Bundle results)191 void addInstrumentationResults(in IApplicationThread target, in Bundle results); finishInstrumentation(in IApplicationThread target, int resultCode, in Bundle results)192 void finishInstrumentation(in IApplicationThread target, int resultCode, 193 in Bundle results); 194 /** 195 * @return A copy of global {@link Configuration}, contains general settings for the entire 196 * system. Corresponds to the configuration of the default display. 197 * @throws RemoteException 198 */ 199 @UnsupportedAppUsage getConfiguration()200 Configuration getConfiguration(); 201 /** 202 * Updates global configuration and applies changes to the entire system. 203 * @param values Update values for global configuration. If null is passed it will request the 204 * Window Manager to compute new config for the default display. 205 * @throws RemoteException 206 * @return Returns true if the configuration was updated. 207 */ 208 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) updateConfiguration(in Configuration values)209 boolean updateConfiguration(in Configuration values); 210 /** 211 * Updates mcc mnc configuration and applies changes to the entire system. 212 * 213 * @param mcc mcc configuration to update. 214 * @param mnc mnc configuration to update. 215 * @throws RemoteException; IllegalArgumentException if mcc or mnc is null. 216 * @return Returns {@code true} if the configuration was updated; 217 * {@code false} otherwise. 218 */ updateMccMncConfiguration(in String mcc, in String mnc)219 boolean updateMccMncConfiguration(in String mcc, in String mnc); stopServiceToken(in ComponentName className, in IBinder token, int startId)220 boolean stopServiceToken(in ComponentName className, in IBinder token, int startId); 221 @UnsupportedAppUsage setProcessLimit(int max)222 void setProcessLimit(int max); 223 @UnsupportedAppUsage getProcessLimit()224 int getProcessLimit(); checkUriPermission(in Uri uri, int pid, int uid, int mode, int userId, in IBinder callerToken)225 int checkUriPermission(in Uri uri, int pid, int uid, int mode, int userId, 226 in IBinder callerToken); checkUriPermissions(in List<Uri> uris, int pid, int uid, int mode, int userId, in IBinder callerToken)227 int[] checkUriPermissions(in List<Uri> uris, int pid, int uid, int mode, int userId, 228 in IBinder callerToken); grantUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri, int mode, int userId)229 void grantUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri, 230 int mode, int userId); revokeUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri, int mode, int userId)231 void revokeUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri, 232 int mode, int userId); 233 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) setActivityController(in IActivityController watcher, boolean imAMonkey)234 void setActivityController(in IActivityController watcher, boolean imAMonkey); showWaitingForDebugger(in IApplicationThread who, boolean waiting)235 void showWaitingForDebugger(in IApplicationThread who, boolean waiting); 236 /* 237 * This will deliver the specified signal to all the persistent processes. Currently only 238 * SIGUSR1 is delivered. All others are ignored. 239 */ signalPersistentProcesses(int signal)240 void signalPersistentProcesses(int signal); 241 242 @UnsupportedAppUsage getRecentTasks(int maxNum, int flags, int userId)243 ParceledListSlice getRecentTasks(int maxNum, int flags, int userId); 244 @UnsupportedAppUsage serviceDoneExecuting(in IBinder token, int type, int startId, int res)245 oneway void serviceDoneExecuting(in IBinder token, int type, int startId, int res); 246 /** @deprecated Use {@link #getIntentSenderWithFeature} instead */ 247 @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@link PendingIntent#getIntentSender()} instead") 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)248 IIntentSender getIntentSender(int type, in String packageName, in IBinder token, 249 in String resultWho, int requestCode, in Intent[] intents, in String[] resolvedTypes, 250 int flags, in Bundle options, int userId); getIntentSenderWithFeature(int type, in String packageName, in String featureId, in IBinder token, in String resultWho, int requestCode, in Intent[] intents, in String[] resolvedTypes, int flags, in Bundle options, int userId)251 IIntentSender getIntentSenderWithFeature(int type, in String packageName, in String featureId, 252 in IBinder token, in String resultWho, int requestCode, in Intent[] intents, 253 in String[] resolvedTypes, int flags, in Bundle options, int userId); cancelIntentSender(in IIntentSender sender)254 void cancelIntentSender(in IIntentSender sender); getInfoForIntentSender(in IIntentSender sender)255 ActivityManager.PendingIntentInfo getInfoForIntentSender(in IIntentSender sender); 256 /** 257 This method used to be called registerIntentSenderCancelListener(), was void, and 258 would call `receiver` if the PI has already been canceled. 259 Now it returns false if the PI is cancelled, without calling `receiver`. 260 The method was renamed to catch calls to the original method. 261 */ registerIntentSenderCancelListenerEx(in IIntentSender sender, in IResultReceiver receiver)262 boolean registerIntentSenderCancelListenerEx(in IIntentSender sender, 263 in IResultReceiver receiver); unregisterIntentSenderCancelListener(in IIntentSender sender, in IResultReceiver receiver)264 void unregisterIntentSenderCancelListener(in IIntentSender sender, in IResultReceiver receiver); enterSafeMode()265 void enterSafeMode(); noteWakeupAlarm(in IIntentSender sender, in WorkSource workSource, int sourceUid, in String sourcePkg, in String tag)266 void noteWakeupAlarm(in IIntentSender sender, in WorkSource workSource, int sourceUid, 267 in String sourcePkg, in String tag); removeContentProvider(in IBinder connection, boolean stable)268 oneway void removeContentProvider(in IBinder connection, boolean stable); 269 @UnsupportedAppUsage setRequestedOrientation(in IBinder token, int requestedOrientation)270 void setRequestedOrientation(in IBinder token, int requestedOrientation); unbindFinished(in IBinder token, in Intent service, boolean doRebind)271 void unbindFinished(in IBinder token, in Intent service, boolean doRebind); 272 @UnsupportedAppUsage setProcessImportant(in IBinder token, int pid, boolean isForeground, String reason)273 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, int foregroundServiceType)274 void setServiceForeground(in ComponentName className, in IBinder token, 275 int id, in Notification notification, int flags, int foregroundServiceType); getForegroundServiceType(in ComponentName className, in IBinder token)276 int getForegroundServiceType(in ComponentName className, in IBinder token); 277 @UnsupportedAppUsage moveActivityTaskToBack(in IBinder token, boolean nonRoot)278 boolean moveActivityTaskToBack(in IBinder token, boolean nonRoot); 279 @UnsupportedAppUsage getMemoryInfo(out ActivityManager.MemoryInfo outInfo)280 void getMemoryInfo(out ActivityManager.MemoryInfo outInfo); getProcessesInErrorState()281 List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState(); clearApplicationUserData(in String packageName, boolean keepState, in IPackageDataObserver observer, int userId)282 boolean clearApplicationUserData(in String packageName, boolean keepState, 283 in IPackageDataObserver observer, int userId); stopAppForUser(in String packageName, int userId)284 void stopAppForUser(in String packageName, int userId); 285 /** Returns {@code false} if the callback could not be registered, {@true} otherwise. */ registerForegroundServiceObserver(in IForegroundServiceObserver callback)286 boolean registerForegroundServiceObserver(in IForegroundServiceObserver callback); 287 @UnsupportedAppUsage forceStopPackage(in String packageName, int userId)288 void forceStopPackage(in String packageName, int userId); killPids(in int[] pids, in String reason, boolean secure)289 boolean killPids(in int[] pids, in String reason, boolean secure); 290 @UnsupportedAppUsage getServices(int maxNum, int flags)291 List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags); 292 // Retrieve running application processes in the system 293 @UnsupportedAppUsage getRunningAppProcesses()294 List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses(); peekService(in Intent service, in String resolvedType, in String callingPackage)295 IBinder peekService(in Intent service, in String resolvedType, in String callingPackage); 296 // Turn on/off profiling in a particular process. 297 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) profileControl(in String process, int userId, boolean start, in ProfilerInfo profilerInfo, int profileType)298 boolean profileControl(in String process, int userId, boolean start, 299 in ProfilerInfo profilerInfo, int profileType); 300 @UnsupportedAppUsage shutdown(int timeout)301 boolean shutdown(int timeout); 302 @UnsupportedAppUsage stopAppSwitches()303 void stopAppSwitches(); 304 @UnsupportedAppUsage resumeAppSwitches()305 void resumeAppSwitches(); bindBackupAgent(in String packageName, int backupRestoreMode, int targetUserId, int operationType)306 boolean bindBackupAgent(in String packageName, int backupRestoreMode, int targetUserId, 307 int operationType); backupAgentCreated(in String packageName, in IBinder agent, int userId)308 void backupAgentCreated(in String packageName, in IBinder agent, int userId); unbindBackupAgent(in ApplicationInfo appInfo)309 void unbindBackupAgent(in ApplicationInfo appInfo); handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll, boolean requireFull, in String name, in String callerPackage)310 int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll, 311 boolean requireFull, in String name, in String callerPackage); addPackageDependency(in String packageName)312 void addPackageDependency(in String packageName); killApplication(in String pkg, int appId, int userId, in String reason)313 void killApplication(in String pkg, int appId, int userId, in String reason); 314 @UnsupportedAppUsage closeSystemDialogs(in String reason)315 void closeSystemDialogs(in String reason); 316 @UnsupportedAppUsage getProcessMemoryInfo(in int[] pids)317 Debug.MemoryInfo[] getProcessMemoryInfo(in int[] pids); killApplicationProcess(in String processName, int uid)318 void killApplicationProcess(in String processName, int uid); 319 // Special low-level communication with activity manager. handleApplicationWtf(in IBinder app, in String tag, boolean system, in ApplicationErrorReport.ParcelableCrashInfo crashInfo, int immediateCallerPid)320 boolean handleApplicationWtf(in IBinder app, in String tag, boolean system, 321 in ApplicationErrorReport.ParcelableCrashInfo crashInfo, int immediateCallerPid); 322 @UnsupportedAppUsage killBackgroundProcesses(in String packageName, int userId)323 void killBackgroundProcesses(in String packageName, int userId); isUserAMonkey()324 boolean isUserAMonkey(); 325 // Retrieve info of applications installed on external media that are currently 326 // running. getRunningExternalApplications()327 List<ApplicationInfo> getRunningExternalApplications(); 328 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) finishHeavyWeightApp()329 void finishHeavyWeightApp(); 330 // A StrictMode violation to be handled. 331 @UnsupportedAppUsage handleApplicationStrictModeViolation(in IBinder app, int penaltyMask, in StrictMode.ViolationInfo crashInfo)332 void handleApplicationStrictModeViolation(in IBinder app, int penaltyMask, 333 in StrictMode.ViolationInfo crashInfo); isTopActivityImmersive()334 boolean isTopActivityImmersive(); crashApplicationWithType(int uid, int initialPid, in String packageName, int userId, in String message, boolean force, int exceptionTypeId)335 void crashApplicationWithType(int uid, int initialPid, in String packageName, int userId, 336 in String message, boolean force, int exceptionTypeId); crashApplicationWithTypeWithExtras(int uid, int initialPid, in String packageName, int userId, in String message, boolean force, int exceptionTypeId, in Bundle extras)337 void crashApplicationWithTypeWithExtras(int uid, int initialPid, in String packageName, 338 int userId, in String message, boolean force, int exceptionTypeId, in Bundle extras); 339 /** @deprecated -- use getProviderMimeTypeAsync */ 340 @UnsupportedAppUsage(maxTargetSdk = 29, publicAlternatives = 341 "Use {@link android.content.ContentResolver#getType} public API instead.") getProviderMimeType(in Uri uri, int userId)342 String getProviderMimeType(in Uri uri, int userId); 343 getProviderMimeTypeAsync(in Uri uri, int userId, in RemoteCallback resultCallback)344 oneway void getProviderMimeTypeAsync(in Uri uri, int userId, in RemoteCallback resultCallback); 345 346 // Cause the specified process to dump the specified heap. dumpHeap(in String process, int userId, boolean managed, boolean mallocInfo, boolean runGc, in String path, in ParcelFileDescriptor fd, in RemoteCallback finishCallback)347 boolean dumpHeap(in String process, int userId, boolean managed, boolean mallocInfo, 348 boolean runGc, in String path, in ParcelFileDescriptor fd, 349 in RemoteCallback finishCallback); 350 @UnsupportedAppUsage isUserRunning(int userid, int flags)351 boolean isUserRunning(int userid, int flags); 352 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) setPackageScreenCompatMode(in String packageName, int mode)353 void setPackageScreenCompatMode(in String packageName, int mode); 354 @UnsupportedAppUsage switchUser(int userid)355 boolean switchUser(int userid); getSwitchingFromUserMessage()356 String getSwitchingFromUserMessage(); getSwitchingToUserMessage()357 String getSwitchingToUserMessage(); 358 @UnsupportedAppUsage setStopUserOnSwitch(int value)359 void setStopUserOnSwitch(int value); removeTask(int taskId)360 boolean removeTask(int taskId); 361 @UnsupportedAppUsage registerProcessObserver(in IProcessObserver observer)362 void registerProcessObserver(in IProcessObserver observer); 363 @UnsupportedAppUsage unregisterProcessObserver(in IProcessObserver observer)364 void unregisterProcessObserver(in IProcessObserver observer); isIntentSenderTargetedToPackage(in IIntentSender sender)365 boolean isIntentSenderTargetedToPackage(in IIntentSender sender); 366 @UnsupportedAppUsage updatePersistentConfiguration(in Configuration values)367 void updatePersistentConfiguration(in Configuration values); updatePersistentConfigurationWithAttribution(in Configuration values, String callingPackageName, String callingAttributionTag)368 void updatePersistentConfigurationWithAttribution(in Configuration values, 369 String callingPackageName, String callingAttributionTag); 370 @UnsupportedAppUsage getProcessPss(in int[] pids)371 long[] getProcessPss(in int[] pids); showBootMessage(in CharSequence msg, boolean always)372 void showBootMessage(in CharSequence msg, boolean always); 373 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) killAllBackgroundProcesses()374 void killAllBackgroundProcesses(); getContentProviderExternal(in String name, int userId, in IBinder token, String tag)375 ContentProviderHolder getContentProviderExternal(in String name, int userId, 376 in IBinder token, String tag); 377 /** @deprecated - Use {@link #removeContentProviderExternalAsUser} which takes a user ID. */ 378 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) removeContentProviderExternal(in String name, in IBinder token)379 void removeContentProviderExternal(in String name, in IBinder token); removeContentProviderExternalAsUser(in String name, in IBinder token, int userId)380 void removeContentProviderExternalAsUser(in String name, in IBinder token, int userId); 381 // Get memory information about the calling process. getMyMemoryState(out ActivityManager.RunningAppProcessInfo outInfo)382 void getMyMemoryState(out ActivityManager.RunningAppProcessInfo outInfo); killProcessesBelowForeground(in String reason)383 boolean killProcessesBelowForeground(in String reason); 384 @UnsupportedAppUsage getCurrentUser()385 UserInfo getCurrentUser(); getCurrentUserId()386 int getCurrentUserId(); 387 // This is not public because you need to be very careful in how you 388 // manage your activity to make sure it is always the uid you expect. 389 @UnsupportedAppUsage getLaunchedFromUid(in IBinder activityToken)390 int getLaunchedFromUid(in IBinder activityToken); 391 @UnsupportedAppUsage unstableProviderDied(in IBinder connection)392 void unstableProviderDied(in IBinder connection); 393 @UnsupportedAppUsage isIntentSenderAnActivity(in IIntentSender sender)394 boolean isIntentSenderAnActivity(in IIntentSender sender); 395 /** @deprecated Use {@link startActivityAsUserWithFeature} instead */ 396 @UnsupportedAppUsage(maxTargetSdk=29, publicAlternatives="Use {@code android.content.Context#createContextAsUser(android.os.UserHandle, int)} and {@link android.content.Context#startActivity(android.content.Intent)} instead") 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)397 int startActivityAsUser(in IApplicationThread caller, in String callingPackage, 398 in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho, 399 int requestCode, int flags, in ProfilerInfo profilerInfo, 400 in Bundle options, int userId); startActivityAsUserWithFeature(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)401 int startActivityAsUserWithFeature(in IApplicationThread caller, in String callingPackage, 402 in String callingFeatureId, in Intent intent, in String resolvedType, 403 in IBinder resultTo, in String resultWho, int requestCode, int flags, 404 in ProfilerInfo profilerInfo, in Bundle options, int userId); 405 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) stopUser(int userid, boolean force, in IStopUserCallback callback)406 int stopUser(int userid, boolean force, in IStopUserCallback callback); 407 /** 408 * Check {@link com.android.server.am.ActivityManagerService#stopUserWithDelayedLocking(int, boolean, IStopUserCallback)} 409 * for details. 410 */ stopUserWithDelayedLocking(int userid, boolean force, in IStopUserCallback callback)411 int stopUserWithDelayedLocking(int userid, boolean force, in IStopUserCallback callback); 412 413 @UnsupportedAppUsage registerUserSwitchObserver(in IUserSwitchObserver observer, in String name)414 void registerUserSwitchObserver(in IUserSwitchObserver observer, in String name); unregisterUserSwitchObserver(in IUserSwitchObserver observer)415 void unregisterUserSwitchObserver(in IUserSwitchObserver observer); getRunningUserIds()416 int[] getRunningUserIds(); 417 418 // Request a heap dump for the system server. requestSystemServerHeapDump()419 void requestSystemServerHeapDump(); 420 requestBugReport(int bugreportType)421 void requestBugReport(int bugreportType); requestBugReportWithDescription(in @ullable String shareTitle, in @nullable String shareDescription, int bugreportType)422 void requestBugReportWithDescription(in @nullable String shareTitle, 423 in @nullable String shareDescription, int bugreportType); 424 425 /** 426 * Takes a telephony bug report and notifies the user with the title and description 427 * that are passed to this API as parameters 428 * 429 * @param shareTitle should be a valid legible string less than 50 chars long 430 * @param shareDescription should be less than 150 chars long 431 * 432 * @throws IllegalArgumentException if shareTitle or shareDescription is too big or if the 433 * paremeters cannot be encoding to an UTF-8 charset. 434 */ requestTelephonyBugReport(in String shareTitle, in String shareDescription)435 void requestTelephonyBugReport(in String shareTitle, in String shareDescription); 436 437 /** 438 * This method is only used by Wifi. 439 * 440 * Takes a minimal bugreport of Wifi-related state. 441 * 442 * @param shareTitle should be a valid legible string less than 50 chars long 443 * @param shareDescription should be less than 150 chars long 444 * 445 * @throws IllegalArgumentException if shareTitle or shareDescription is too big or if the 446 * parameters cannot be encoding to an UTF-8 charset. 447 */ requestWifiBugReport(in String shareTitle, in String shareDescription)448 void requestWifiBugReport(in String shareTitle, in String shareDescription); requestInteractiveBugReportWithDescription(in String shareTitle, in String shareDescription)449 void requestInteractiveBugReportWithDescription(in String shareTitle, 450 in String shareDescription); 451 requestInteractiveBugReport()452 void requestInteractiveBugReport(); requestFullBugReport()453 void requestFullBugReport(); requestRemoteBugReport(long nonce)454 void requestRemoteBugReport(long nonce); launchBugReportHandlerApp()455 boolean launchBugReportHandlerApp(); getBugreportWhitelistedPackages()456 List<String> getBugreportWhitelistedPackages(); 457 458 @UnsupportedAppUsage getIntentForIntentSender(in IIntentSender sender)459 Intent getIntentForIntentSender(in IIntentSender sender); 460 // This is not public because you need to be very careful in how you 461 // manage your activity to make sure it is always the uid you expect. 462 @UnsupportedAppUsage getLaunchedFromPackage(in IBinder activityToken)463 String getLaunchedFromPackage(in IBinder activityToken); killUid(int appId, int userId, in String reason)464 void killUid(int appId, int userId, in String reason); setUserIsMonkey(boolean monkey)465 void setUserIsMonkey(boolean monkey); 466 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) hang(in IBinder who, boolean allowRestart)467 void hang(in IBinder who, boolean allowRestart); 468 getAllRootTaskInfos()469 List<ActivityTaskManager.RootTaskInfo> getAllRootTaskInfos(); moveTaskToRootTask(int taskId, int rootTaskId, boolean toTop)470 void moveTaskToRootTask(int taskId, int rootTaskId, boolean toTop); setFocusedRootTask(int taskId)471 void setFocusedRootTask(int taskId); getFocusedRootTaskInfo()472 ActivityTaskManager.RootTaskInfo getFocusedRootTaskInfo(); 473 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) restart()474 void restart(); performIdleMaintenance()475 void performIdleMaintenance(); appNotRespondingViaProvider(in IBinder connection)476 void appNotRespondingViaProvider(in IBinder connection); 477 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) getTaskBounds(int taskId)478 Rect getTaskBounds(int taskId); 479 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) setProcessMemoryTrimLevel(in String process, int userId, int level)480 boolean setProcessMemoryTrimLevel(in String process, int userId, int level); 481 482 483 // Start of L transactions getTagForIntentSender(in IIntentSender sender, in String prefix)484 String getTagForIntentSender(in IIntentSender sender, in String prefix); 485 @UnsupportedAppUsage startUserInBackground(int userid)486 boolean startUserInBackground(int userid); 487 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) isInLockTaskMode()488 boolean isInLockTaskMode(); 489 @UnsupportedAppUsage startActivityFromRecents(int taskId, in Bundle options)490 int startActivityFromRecents(int taskId, in Bundle options); 491 @UnsupportedAppUsage startSystemLockTaskMode(int taskId)492 void startSystemLockTaskMode(int taskId); 493 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) isTopOfTask(in IBinder token)494 boolean isTopOfTask(in IBinder token); bootAnimationComplete()495 void bootAnimationComplete(); 496 @UnsupportedAppUsage registerTaskStackListener(in ITaskStackListener listener)497 void registerTaskStackListener(in ITaskStackListener listener); unregisterTaskStackListener(in ITaskStackListener listener)498 void unregisterTaskStackListener(in ITaskStackListener listener); notifyCleartextNetwork(int uid, in byte[] firstPacket)499 void notifyCleartextNetwork(int uid, in byte[] firstPacket); 500 @UnsupportedAppUsage setTaskResizeable(int taskId, int resizeableMode)501 void setTaskResizeable(int taskId, int resizeableMode); 502 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) resizeTask(int taskId, in Rect bounds, int resizeMode)503 void resizeTask(int taskId, in Rect bounds, int resizeMode); 504 @UnsupportedAppUsage getLockTaskModeState()505 int getLockTaskModeState(); 506 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) setDumpHeapDebugLimit(in String processName, int uid, long maxMemSize, in String reportPackage)507 void setDumpHeapDebugLimit(in String processName, int uid, long maxMemSize, 508 in String reportPackage); dumpHeapFinished(in String path)509 void dumpHeapFinished(in String path); updateLockTaskPackages(int userId, in String[] packages)510 void updateLockTaskPackages(int userId, in String[] packages); noteAlarmStart(in IIntentSender sender, in WorkSource workSource, int sourceUid, in String tag)511 void noteAlarmStart(in IIntentSender sender, in WorkSource workSource, int sourceUid, in String tag); noteAlarmFinish(in IIntentSender sender, in WorkSource workSource, int sourceUid, in String tag)512 void noteAlarmFinish(in IIntentSender sender, in WorkSource workSource, int sourceUid, in String tag); 513 @UnsupportedAppUsage getPackageProcessState(in String packageName, in String callingPackage)514 int getPackageProcessState(in String packageName, in String callingPackage); 515 516 // Start of N transactions 517 // Start Binder transaction tracking for all applications. 518 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) startBinderTracking()519 boolean startBinderTracking(); 520 // Stop Binder transaction tracking for all applications and dump trace data to the given file 521 // descriptor. 522 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) stopBinderTrackingAndDump(in ParcelFileDescriptor fd)523 boolean stopBinderTrackingAndDump(in ParcelFileDescriptor fd); 524 525 /** Enables server-side binder tracing for the calling uid. */ enableBinderTracing()526 void enableBinderTracing(); 527 528 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) suppressResizeConfigChanges(boolean suppress)529 void suppressResizeConfigChanges(boolean suppress); 530 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) unlockUser(int userid, in byte[] token, in byte[] secret, in IProgressListener listener)531 boolean unlockUser(int userid, in byte[] token, in byte[] secret, 532 in IProgressListener listener); killPackageDependents(in String packageName, int userId)533 void killPackageDependents(in String packageName, int userId); makePackageIdle(String packageName, int userId)534 void makePackageIdle(String packageName, int userId); getMemoryTrimLevel()535 int getMemoryTrimLevel(); isVrModePackageEnabled(in ComponentName packageName)536 boolean isVrModePackageEnabled(in ComponentName packageName); notifyLockedProfile(int userId)537 void notifyLockedProfile(int userId); startConfirmDeviceCredentialIntent(in Intent intent, in Bundle options)538 void startConfirmDeviceCredentialIntent(in Intent intent, in Bundle options); 539 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) sendIdleJobTrigger()540 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)541 int sendIntentSender(in IIntentSender target, in IBinder whitelistToken, int code, 542 in Intent intent, in String resolvedType, in IIntentReceiver finishedReceiver, 543 in String requiredPermission, in Bundle options); isBackgroundRestricted(in String packageName)544 boolean isBackgroundRestricted(in String packageName); 545 546 // Start of N MR1 transactions setRenderThread(int tid)547 void setRenderThread(int tid); 548 /** 549 * Lets activity manager know whether the calling process is currently showing "top-level" UI 550 * that is not an activity, i.e. windows on the screen the user is currently interacting with. 551 * 552 * <p>This flag can only be set for persistent processes. 553 * 554 * @param hasTopUi Whether the calling process has "top-level" UI. 555 */ setHasTopUi(boolean hasTopUi)556 void setHasTopUi(boolean hasTopUi); 557 558 // Start of O transactions restartUserInBackground(int userId)559 int restartUserInBackground(int userId); 560 /** Cancels the window transitions for the given task. */ 561 @UnsupportedAppUsage cancelTaskWindowTransition(int taskId)562 void cancelTaskWindowTransition(int taskId); scheduleApplicationInfoChanged(in List<String> packageNames, int userId)563 void scheduleApplicationInfoChanged(in List<String> packageNames, int userId); setPersistentVrThread(int tid)564 void setPersistentVrThread(int tid); 565 waitForNetworkStateUpdate(long procStateSeq)566 void waitForNetworkStateUpdate(long procStateSeq); 567 /** 568 * Add a bare uid to the background restrictions whitelist. Only the system uid may call this. 569 */ backgroundAllowlistUid(int uid)570 void backgroundAllowlistUid(int uid); 571 572 // Start of P transactions 573 /** 574 * Similar to {@link #startUserInBackground(int userId), but with a listener to report 575 * user unlock progress. 576 */ startUserInBackgroundWithListener(int userid, IProgressListener unlockProgressListener)577 boolean startUserInBackgroundWithListener(int userid, IProgressListener unlockProgressListener); 578 579 /** 580 * Method for the shell UID to start deletating its permission identity to an 581 * active instrumenation. The shell can delegate permissions only to one active 582 * instrumentation at a time. An active instrumentation is one running and 583 * started from the shell. 584 */ startDelegateShellPermissionIdentity(int uid, in String[] permissions)585 void startDelegateShellPermissionIdentity(int uid, in String[] permissions); 586 587 /** 588 * Method for the shell UID to stop deletating its permission identity to an 589 * active instrumenation. An active instrumentation is one running and 590 * started from the shell. 591 */ stopDelegateShellPermissionIdentity()592 void stopDelegateShellPermissionIdentity(); 593 594 /** 595 * Method for the shell UID to get currently adopted permissions for an active instrumentation. 596 * An active instrumentation is one running and started from the shell. 597 */ getDelegatedShellPermissions()598 List<String> getDelegatedShellPermissions(); 599 600 /** Returns a file descriptor that'll be closed when the system server process dies. */ getLifeMonitor()601 ParcelFileDescriptor getLifeMonitor(); 602 603 /** 604 * Start user, if it us not already running, and bring it to foreground. 605 * unlockProgressListener can be null if monitoring progress is not necessary. 606 */ startUserInForegroundWithListener(int userid, IProgressListener unlockProgressListener)607 boolean startUserInForegroundWithListener(int userid, IProgressListener unlockProgressListener); 608 609 /** 610 * Method for the app to tell system that it's wedged and would like to trigger an ANR. 611 */ appNotResponding(String reason)612 void appNotResponding(String reason); 613 614 /** 615 * Return a list of {@link ApplicationExitInfo} records. 616 * 617 * <p class="note"> Note: System stores these historical information in a ring buffer, older 618 * records would be overwritten by newer records. </p> 619 * 620 * <p class="note"> Note: In the case that this application bound to an external service with 621 * flag {@link android.content.Context#BIND_EXTERNAL_SERVICE}, the process of that external 622 * service will be included in this package's exit info. </p> 623 * 624 * @param packageName Optional, an empty value means match all packages belonging to the 625 * caller's UID. If this package belongs to another UID, you must hold 626 * {@link android.Manifest.permission#DUMP} in order to retrieve it. 627 * @param pid Optional, it could be a process ID that used to belong to this package but 628 * died later; A value of 0 means to ignore this parameter and return all 629 * matching records. 630 * @param maxNum Optional, the maximum number of results should be returned; A value of 0 631 * means to ignore this parameter and return all matching records 632 * @param userId The userId in the multi-user environment. 633 * 634 * @return a list of {@link ApplicationExitInfo} records with the matching criteria, sorted in 635 * the order from most recent to least recent. 636 */ getHistoricalProcessExitReasons(String packageName, int pid, int maxNum, int userId)637 ParceledListSlice<ApplicationExitInfo> getHistoricalProcessExitReasons(String packageName, 638 int pid, int maxNum, int userId); 639 640 /* 641 * Kill the given PIDs, but the killing will be delayed until the device is idle 642 * and the given process is imperceptible. 643 */ killProcessesWhenImperceptible(in int[] pids, String reason)644 void killProcessesWhenImperceptible(in int[] pids, String reason); 645 646 /** 647 * Set locus context for a given activity. 648 * @param activity 649 * @param locusId a unique, stable id that identifies this activity instance from others. 650 * @param appToken ActivityRecord's appToken. 651 */ setActivityLocusContext(in ComponentName activity, in LocusId locusId, in IBinder appToken)652 void setActivityLocusContext(in ComponentName activity, in LocusId locusId, 653 in IBinder appToken); 654 655 /** 656 * Set custom state data for this process. It will be included in the record of 657 * {@link ApplicationExitInfo} on the death of the current calling process; the new process 658 * of the app can retrieve this state data by calling 659 * {@link ApplicationExitInfo#getProcessStateSummary} on the record returned by 660 * {@link #getHistoricalProcessExitReasons}. 661 * 662 * <p> This would be useful for the calling app to save its stateful data: if it's 663 * killed later for any reason, the new process of the app can know what the 664 * previous process of the app was doing. For instance, you could use this to encode 665 * the current level in a game, or a set of features/experiments that were enabled. Later you 666 * could analyze under what circumstances the app tends to crash or use too much memory. 667 * However, it's not suggested to rely on this to restore the applications previous UI state 668 * or so, it's only meant for analyzing application healthy status.</p> 669 * 670 * <p> System might decide to throttle the calls to this API; so call this API in a reasonable 671 * manner, excessive calls to this API could result a {@link java.lang.RuntimeException}. 672 * </p> 673 * 674 * @param state The customized state data 675 */ setProcessStateSummary(in byte[] state)676 void setProcessStateSummary(in byte[] state); 677 678 /** 679 * Return whether the app freezer is supported (true) or not (false) by this system. 680 */ isAppFreezerSupported()681 boolean isAppFreezerSupported(); 682 683 /** 684 * Return whether the app freezer is enabled (true) or not (false) by this system. 685 */ isAppFreezerEnabled()686 boolean isAppFreezerEnabled(); 687 688 /** 689 * Kills uid with the reason of permission change. 690 */ killUidForPermissionChange(int appId, int userId, String reason)691 void killUidForPermissionChange(int appId, int userId, String reason); 692 693 /** 694 * Resets the state of the {@link com.android.server.am.AppErrors} instance. 695 * This is intended for testing within the CTS only and is protected by 696 * android.permission.RESET_APP_ERRORS. 697 */ resetAppErrors()698 void resetAppErrors(); 699 700 /** 701 * Control the app freezer state. Returns true in case of success, false if the operation 702 * didn't succeed (for example, when the app freezer isn't supported). 703 * Handling the freezer state via this method is reentrant, that is it can be 704 * disabled and re-enabled multiple times in parallel. As long as there's a 1:1 disable to 705 * enable match, the freezer is re-enabled at last enable only. 706 * @param enable set it to true to enable the app freezer, false to disable it. 707 */ enableAppFreezer(in boolean enable)708 boolean enableAppFreezer(in boolean enable); 709 710 /** 711 * Suppress or reenable the rate limit on foreground service notification deferral. 712 * This is for use within CTS and is protected by android.permission.WRITE_DEVICE_CONFIG. 713 * 714 * @param enable false to suppress rate-limit policy; true to reenable it. 715 */ enableFgsNotificationRateLimit(in boolean enable)716 boolean enableFgsNotificationRateLimit(in boolean enable); 717 718 /** 719 * Holds the AM lock for the specified amount of milliseconds. 720 * This is intended for use by the tests that need to imitate lock contention. 721 * The token should be obtained by 722 * {@link android.content.pm.PackageManager#getHoldLockToken()}. 723 */ holdLock(in IBinder token, in int durationMs)724 void holdLock(in IBinder token, in int durationMs); 725 726 /** 727 * Starts a profile. 728 * @param userId the user id of the profile. 729 * @return true if the profile has been successfully started or if the profile is already 730 * running, false if profile failed to start. 731 * @throws IllegalArgumentException if the user is not a profile. 732 */ startProfile(int userId)733 boolean startProfile(int userId); 734 735 /** 736 * Stops a profile. 737 * @param userId the user id of the profile. 738 * @return true if the profile has been successfully stopped or is already stopped. Otherwise 739 * the exceptions listed below are thrown. 740 * @throws IllegalArgumentException if the user is not a profile. 741 */ stopProfile(int userId)742 boolean stopProfile(int userId); 743 744 /** Called by PendingIntent.queryIntentComponents() */ queryIntentComponentsForIntentSender(in IIntentSender sender, int matchFlags)745 ParceledListSlice queryIntentComponentsForIntentSender(in IIntentSender sender, int matchFlags); 746 747 @JavaPassthrough(annotation= 748 "@android.annotation.RequiresPermission(allOf = {android.Manifest.permission.PACKAGE_USAGE_STATS, android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}, conditional = true)") getUidProcessCapabilities(int uid, in String callingPackage)749 int getUidProcessCapabilities(int uid, in String callingPackage); 750 751 /** Blocks until all broadcast queues become idle. */ waitForBroadcastIdle()752 void waitForBroadcastIdle(); 753 754 /** 755 * @return The reason code of whether or not the given UID should be exempted from background 756 * restrictions here. 757 * 758 * <p> 759 * Note: Call it with caution as it'll try to acquire locks in other services. 760 * </p> 761 */ getBackgroundRestrictionExemptionReason(int uid)762 int getBackgroundRestrictionExemptionReason(int uid); 763 } 764