1 /* 2 * Copyright (C) 2006 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.content.ComponentName; 20 import android.content.ContentProviderNative; 21 import android.content.IContentProvider; 22 import android.content.IIntentReceiver; 23 import android.content.IIntentSender; 24 import android.content.Intent; 25 import android.content.IntentFilter; 26 import android.content.IntentSender; 27 import android.content.pm.ApplicationInfo; 28 import android.content.pm.ConfigurationInfo; 29 import android.content.pm.IPackageDataObserver; 30 import android.content.pm.ProviderInfo; 31 import android.content.res.Configuration; 32 import android.graphics.Bitmap; 33 import android.net.Uri; 34 import android.os.Bundle; 35 import android.os.Debug; 36 import android.os.IBinder; 37 import android.os.IInterface; 38 import android.os.Parcel; 39 import android.os.ParcelFileDescriptor; 40 import android.os.Parcelable; 41 import android.os.RemoteException; 42 import android.os.StrictMode; 43 44 import java.util.List; 45 46 /** 47 * System private API for talking with the activity manager service. This 48 * provides calls from the application back to the activity manager. 49 * 50 * {@hide} 51 */ 52 public interface IActivityManager extends IInterface { 53 /** 54 * Returned by startActivity() if the start request was canceled because 55 * app switches are temporarily canceled to ensure the user's last request 56 * (such as pressing home) is performed. 57 */ 58 public static final int START_SWITCHES_CANCELED = 4; 59 /** 60 * Returned by startActivity() if an activity wasn't really started, but 61 * the given Intent was given to the existing top activity. 62 */ 63 public static final int START_DELIVERED_TO_TOP = 3; 64 /** 65 * Returned by startActivity() if an activity wasn't really started, but 66 * a task was simply brought to the foreground. 67 */ 68 public static final int START_TASK_TO_FRONT = 2; 69 /** 70 * Returned by startActivity() if the caller asked that the Intent not 71 * be executed if it is the recipient, and that is indeed the case. 72 */ 73 public static final int START_RETURN_INTENT_TO_CALLER = 1; 74 /** 75 * Activity was started successfully as normal. 76 */ 77 public static final int START_SUCCESS = 0; 78 public static final int START_INTENT_NOT_RESOLVED = -1; 79 public static final int START_CLASS_NOT_FOUND = -2; 80 public static final int START_FORWARD_AND_REQUEST_CONFLICT = -3; 81 public static final int START_PERMISSION_DENIED = -4; 82 public static final int START_NOT_ACTIVITY = -5; 83 public static final int START_CANCELED = -6; startActivity(IApplicationThread caller, Intent intent, String resolvedType, Uri[] grantedUriPermissions, int grantedMode, IBinder resultTo, String resultWho, int requestCode, boolean onlyIfNeeded, boolean debug, String profileFile, ParcelFileDescriptor profileFd, boolean autoStopProfiler)84 public int startActivity(IApplicationThread caller, 85 Intent intent, String resolvedType, Uri[] grantedUriPermissions, 86 int grantedMode, IBinder resultTo, String resultWho, int requestCode, 87 boolean onlyIfNeeded, boolean debug, String profileFile, 88 ParcelFileDescriptor profileFd, boolean autoStopProfiler) throws RemoteException; startActivityAndWait(IApplicationThread caller, Intent intent, String resolvedType, Uri[] grantedUriPermissions, int grantedMode, IBinder resultTo, String resultWho, int requestCode, boolean onlyIfNeeded, boolean debug, String profileFile, ParcelFileDescriptor profileFd, boolean autoStopProfiler)89 public WaitResult startActivityAndWait(IApplicationThread caller, 90 Intent intent, String resolvedType, Uri[] grantedUriPermissions, 91 int grantedMode, IBinder resultTo, String resultWho, int requestCode, 92 boolean onlyIfNeeded, boolean debug, String profileFile, 93 ParcelFileDescriptor profileFd, boolean autoStopProfiler) throws RemoteException; startActivityWithConfig(IApplicationThread caller, Intent intent, String resolvedType, Uri[] grantedUriPermissions, int grantedMode, IBinder resultTo, String resultWho, int requestCode, boolean onlyIfNeeded, boolean debug, Configuration newConfig)94 public int startActivityWithConfig(IApplicationThread caller, 95 Intent intent, String resolvedType, Uri[] grantedUriPermissions, 96 int grantedMode, IBinder resultTo, String resultWho, int requestCode, 97 boolean onlyIfNeeded, boolean debug, Configuration newConfig) throws RemoteException; startActivityIntentSender(IApplicationThread caller, IntentSender intent, Intent fillInIntent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int flagsMask, int flagsValues)98 public int startActivityIntentSender(IApplicationThread caller, 99 IntentSender intent, Intent fillInIntent, String resolvedType, 100 IBinder resultTo, String resultWho, int requestCode, 101 int flagsMask, int flagsValues) throws RemoteException; startNextMatchingActivity(IBinder callingActivity, Intent intent)102 public boolean startNextMatchingActivity(IBinder callingActivity, 103 Intent intent) throws RemoteException; finishActivity(IBinder token, int code, Intent data)104 public boolean finishActivity(IBinder token, int code, Intent data) 105 throws RemoteException; finishSubActivity(IBinder token, String resultWho, int requestCode)106 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException; willActivityBeVisible(IBinder token)107 public boolean willActivityBeVisible(IBinder token) throws RemoteException; registerReceiver(IApplicationThread caller, String callerPackage, IIntentReceiver receiver, IntentFilter filter, String requiredPermission)108 public Intent registerReceiver(IApplicationThread caller, String callerPackage, 109 IIntentReceiver receiver, IntentFilter filter, 110 String requiredPermission) throws RemoteException; unregisterReceiver(IIntentReceiver receiver)111 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException; 112 public static final int BROADCAST_SUCCESS = 0; 113 public static final int BROADCAST_STICKY_CANT_HAVE_PERMISSION = -1; broadcastIntent(IApplicationThread caller, Intent intent, String resolvedType, IIntentReceiver resultTo, int resultCode, String resultData, Bundle map, String requiredPermission, boolean serialized, boolean sticky)114 public int broadcastIntent(IApplicationThread caller, Intent intent, 115 String resolvedType, IIntentReceiver resultTo, int resultCode, 116 String resultData, Bundle map, String requiredPermission, 117 boolean serialized, boolean sticky) throws RemoteException; unbroadcastIntent(IApplicationThread caller, Intent intent)118 public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException; 119 /* oneway */ finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast)120 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException; attachApplication(IApplicationThread app)121 public void attachApplication(IApplicationThread app) throws RemoteException; 122 /* oneway */ activityIdle(IBinder token, Configuration config, boolean stopProfiling)123 public void activityIdle(IBinder token, Configuration config, 124 boolean stopProfiling) throws RemoteException; activityPaused(IBinder token)125 public void activityPaused(IBinder token) throws RemoteException; 126 /* oneway */ activityStopped(IBinder token, Bundle state, Bitmap thumbnail, CharSequence description)127 public void activityStopped(IBinder token, Bundle state, 128 Bitmap thumbnail, CharSequence description) throws RemoteException; 129 /* oneway */ activitySlept(IBinder token)130 public void activitySlept(IBinder token) throws RemoteException; 131 /* oneway */ activityDestroyed(IBinder token)132 public void activityDestroyed(IBinder token) throws RemoteException; getCallingPackage(IBinder token)133 public String getCallingPackage(IBinder token) throws RemoteException; getCallingActivity(IBinder token)134 public ComponentName getCallingActivity(IBinder token) throws RemoteException; getTasks(int maxNum, int flags, IThumbnailReceiver receiver)135 public List getTasks(int maxNum, int flags, 136 IThumbnailReceiver receiver) throws RemoteException; getRecentTasks(int maxNum, int flags)137 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum, 138 int flags) throws RemoteException; getTaskThumbnails(int taskId)139 public ActivityManager.TaskThumbnails getTaskThumbnails(int taskId) throws RemoteException; getServices(int maxNum, int flags)140 public List getServices(int maxNum, int flags) throws RemoteException; getProcessesInErrorState()141 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState() 142 throws RemoteException; moveTaskToFront(int task, int flags)143 public void moveTaskToFront(int task, int flags) throws RemoteException; moveTaskToBack(int task)144 public void moveTaskToBack(int task) throws RemoteException; moveActivityTaskToBack(IBinder token, boolean nonRoot)145 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) throws RemoteException; moveTaskBackwards(int task)146 public void moveTaskBackwards(int task) throws RemoteException; getTaskForActivity(IBinder token, boolean onlyRoot)147 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException; finishOtherInstances(IBinder token, ComponentName className)148 public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException; 149 /* oneway */ reportThumbnail(IBinder token, Bitmap thumbnail, CharSequence description)150 public void reportThumbnail(IBinder token, 151 Bitmap thumbnail, CharSequence description) throws RemoteException; getContentProvider(IApplicationThread caller, String name)152 public ContentProviderHolder getContentProvider(IApplicationThread caller, 153 String name) throws RemoteException; removeContentProvider(IApplicationThread caller, String name)154 public void removeContentProvider(IApplicationThread caller, 155 String name) throws RemoteException; publishContentProviders(IApplicationThread caller, List<ContentProviderHolder> providers)156 public void publishContentProviders(IApplicationThread caller, 157 List<ContentProviderHolder> providers) throws RemoteException; getRunningServiceControlPanel(ComponentName service)158 public PendingIntent getRunningServiceControlPanel(ComponentName service) 159 throws RemoteException; startService(IApplicationThread caller, Intent service, String resolvedType)160 public ComponentName startService(IApplicationThread caller, Intent service, 161 String resolvedType) throws RemoteException; stopService(IApplicationThread caller, Intent service, String resolvedType)162 public int stopService(IApplicationThread caller, Intent service, 163 String resolvedType) throws RemoteException; stopServiceToken(ComponentName className, IBinder token, int startId)164 public boolean stopServiceToken(ComponentName className, IBinder token, 165 int startId) throws RemoteException; setServiceForeground(ComponentName className, IBinder token, int id, Notification notification, boolean keepNotification)166 public void setServiceForeground(ComponentName className, IBinder token, 167 int id, Notification notification, boolean keepNotification) throws RemoteException; bindService(IApplicationThread caller, IBinder token, Intent service, String resolvedType, IServiceConnection connection, int flags)168 public int bindService(IApplicationThread caller, IBinder token, 169 Intent service, String resolvedType, 170 IServiceConnection connection, int flags) throws RemoteException; unbindService(IServiceConnection connection)171 public boolean unbindService(IServiceConnection connection) throws RemoteException; publishService(IBinder token, Intent intent, IBinder service)172 public void publishService(IBinder token, 173 Intent intent, IBinder service) throws RemoteException; unbindFinished(IBinder token, Intent service, boolean doRebind)174 public void unbindFinished(IBinder token, Intent service, 175 boolean doRebind) throws RemoteException; 176 /* oneway */ serviceDoneExecuting(IBinder token, int type, int startId, int res)177 public void serviceDoneExecuting(IBinder token, int type, int startId, 178 int res) throws RemoteException; peekService(Intent service, String resolvedType)179 public IBinder peekService(Intent service, String resolvedType) throws RemoteException; 180 bindBackupAgent(ApplicationInfo appInfo, int backupRestoreMode)181 public boolean bindBackupAgent(ApplicationInfo appInfo, int backupRestoreMode) 182 throws RemoteException; backupAgentCreated(String packageName, IBinder agent)183 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException; unbindBackupAgent(ApplicationInfo appInfo)184 public void unbindBackupAgent(ApplicationInfo appInfo) throws RemoteException; killApplicationProcess(String processName, int uid)185 public void killApplicationProcess(String processName, int uid) throws RemoteException; 186 startInstrumentation(ComponentName className, String profileFile, int flags, Bundle arguments, IInstrumentationWatcher watcher)187 public boolean startInstrumentation(ComponentName className, String profileFile, 188 int flags, Bundle arguments, IInstrumentationWatcher watcher) 189 throws RemoteException; finishInstrumentation(IApplicationThread target, int resultCode, Bundle results)190 public void finishInstrumentation(IApplicationThread target, 191 int resultCode, Bundle results) throws RemoteException; 192 getConfiguration()193 public Configuration getConfiguration() throws RemoteException; updateConfiguration(Configuration values)194 public void updateConfiguration(Configuration values) throws RemoteException; setRequestedOrientation(IBinder token, int requestedOrientation)195 public void setRequestedOrientation(IBinder token, 196 int requestedOrientation) throws RemoteException; getRequestedOrientation(IBinder token)197 public int getRequestedOrientation(IBinder token) throws RemoteException; 198 getActivityClassForToken(IBinder token)199 public ComponentName getActivityClassForToken(IBinder token) throws RemoteException; getPackageForToken(IBinder token)200 public String getPackageForToken(IBinder token) throws RemoteException; 201 202 public static final int INTENT_SENDER_BROADCAST = 1; 203 public static final int INTENT_SENDER_ACTIVITY = 2; 204 public static final int INTENT_SENDER_ACTIVITY_RESULT = 3; 205 public static final int INTENT_SENDER_SERVICE = 4; getIntentSender(int type, String packageName, IBinder token, String resultWho, int requestCode, Intent[] intents, String[] resolvedTypes, int flags)206 public IIntentSender getIntentSender(int type, 207 String packageName, IBinder token, String resultWho, 208 int requestCode, Intent[] intents, String[] resolvedTypes, 209 int flags) throws RemoteException; cancelIntentSender(IIntentSender sender)210 public void cancelIntentSender(IIntentSender sender) throws RemoteException; clearApplicationUserData(final String packageName, final IPackageDataObserver observer)211 public boolean clearApplicationUserData(final String packageName, 212 final IPackageDataObserver observer) throws RemoteException; getPackageForIntentSender(IIntentSender sender)213 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException; 214 setProcessLimit(int max)215 public void setProcessLimit(int max) throws RemoteException; getProcessLimit()216 public int getProcessLimit() throws RemoteException; 217 setProcessForeground(IBinder token, int pid, boolean isForeground)218 public void setProcessForeground(IBinder token, int pid, 219 boolean isForeground) throws RemoteException; 220 checkPermission(String permission, int pid, int uid)221 public int checkPermission(String permission, int pid, int uid) 222 throws RemoteException; 223 checkUriPermission(Uri uri, int pid, int uid, int mode)224 public int checkUriPermission(Uri uri, int pid, int uid, int mode) 225 throws RemoteException; grantUriPermission(IApplicationThread caller, String targetPkg, Uri uri, int mode)226 public void grantUriPermission(IApplicationThread caller, String targetPkg, 227 Uri uri, int mode) throws RemoteException; revokeUriPermission(IApplicationThread caller, Uri uri, int mode)228 public void revokeUriPermission(IApplicationThread caller, Uri uri, 229 int mode) throws RemoteException; 230 showWaitingForDebugger(IApplicationThread who, boolean waiting)231 public void showWaitingForDebugger(IApplicationThread who, boolean waiting) 232 throws RemoteException; 233 getMemoryInfo(ActivityManager.MemoryInfo outInfo)234 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException; 235 killBackgroundProcesses(final String packageName)236 public void killBackgroundProcesses(final String packageName) throws RemoteException; forceStopPackage(final String packageName)237 public void forceStopPackage(final String packageName) throws RemoteException; 238 239 // Note: probably don't want to allow applications access to these. goingToSleep()240 public void goingToSleep() throws RemoteException; wakingUp()241 public void wakingUp() throws RemoteException; 242 unhandledBack()243 public void unhandledBack() throws RemoteException; openContentUri(Uri uri)244 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException; setDebugApp( String packageName, boolean waitForDebugger, boolean persistent)245 public void setDebugApp( 246 String packageName, boolean waitForDebugger, boolean persistent) 247 throws RemoteException; setAlwaysFinish(boolean enabled)248 public void setAlwaysFinish(boolean enabled) throws RemoteException; setActivityController(IActivityController watcher)249 public void setActivityController(IActivityController watcher) 250 throws RemoteException; 251 enterSafeMode()252 public void enterSafeMode() throws RemoteException; 253 noteWakeupAlarm(IIntentSender sender)254 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException; 255 killPids(int[] pids, String reason, boolean secure)256 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException; 257 258 // Special low-level communication with activity manager. startRunning(String pkg, String cls, String action, String data)259 public void startRunning(String pkg, String cls, String action, 260 String data) throws RemoteException; handleApplicationCrash(IBinder app, ApplicationErrorReport.CrashInfo crashInfo)261 public void handleApplicationCrash(IBinder app, 262 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException; handleApplicationWtf(IBinder app, String tag, ApplicationErrorReport.CrashInfo crashInfo)263 public boolean handleApplicationWtf(IBinder app, String tag, 264 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException; 265 266 // A StrictMode violation to be handled. The violationMask is a 267 // subset of the original StrictMode policy bitmask, with only the 268 // bit violated and penalty bits to be executed by the 269 // ActivityManagerService remaining set. handleApplicationStrictModeViolation(IBinder app, int violationMask, StrictMode.ViolationInfo crashInfo)270 public void handleApplicationStrictModeViolation(IBinder app, int violationMask, 271 StrictMode.ViolationInfo crashInfo) throws RemoteException; 272 273 /* 274 * This will deliver the specified signal to all the persistent processes. Currently only 275 * SIGUSR1 is delivered. All others are ignored. 276 */ signalPersistentProcesses(int signal)277 public void signalPersistentProcesses(int signal) throws RemoteException; 278 // Retrieve info of applications installed on external media that are currently 279 // running. getRunningAppProcesses()280 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses() 281 throws RemoteException; 282 // Retrieve running application processes in the system getRunningExternalApplications()283 public List<ApplicationInfo> getRunningExternalApplications() 284 throws RemoteException; 285 // Get device configuration getDeviceConfigurationInfo()286 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException; 287 288 // Turn on/off profiling in a particular process. profileControl(String process, boolean start, String path, ParcelFileDescriptor fd, int profileType)289 public boolean profileControl(String process, boolean start, 290 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException; 291 shutdown(int timeout)292 public boolean shutdown(int timeout) throws RemoteException; 293 stopAppSwitches()294 public void stopAppSwitches() throws RemoteException; resumeAppSwitches()295 public void resumeAppSwitches() throws RemoteException; 296 registerActivityWatcher(IActivityWatcher watcher)297 public void registerActivityWatcher(IActivityWatcher watcher) 298 throws RemoteException; unregisterActivityWatcher(IActivityWatcher watcher)299 public void unregisterActivityWatcher(IActivityWatcher watcher) 300 throws RemoteException; 301 startActivityInPackage(int uid, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, boolean onlyIfNeeded)302 public int startActivityInPackage(int uid, 303 Intent intent, String resolvedType, IBinder resultTo, 304 String resultWho, int requestCode, boolean onlyIfNeeded) 305 throws RemoteException; 306 killApplicationWithUid(String pkg, int uid)307 public void killApplicationWithUid(String pkg, int uid) throws RemoteException; 308 closeSystemDialogs(String reason)309 public void closeSystemDialogs(String reason) throws RemoteException; 310 getProcessMemoryInfo(int[] pids)311 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids) 312 throws RemoteException; 313 overridePendingTransition(IBinder token, String packageName, int enterAnim, int exitAnim)314 public void overridePendingTransition(IBinder token, String packageName, 315 int enterAnim, int exitAnim) throws RemoteException; 316 isUserAMonkey()317 public boolean isUserAMonkey() throws RemoteException; 318 finishHeavyWeightApp()319 public void finishHeavyWeightApp() throws RemoteException; 320 setImmersive(IBinder token, boolean immersive)321 public void setImmersive(IBinder token, boolean immersive) throws RemoteException; isImmersive(IBinder token)322 public boolean isImmersive(IBinder token) throws RemoteException; isTopActivityImmersive()323 public boolean isTopActivityImmersive() throws RemoteException; 324 crashApplication(int uid, int initialPid, String packageName, String message)325 public void crashApplication(int uid, int initialPid, String packageName, 326 String message) throws RemoteException; 327 getProviderMimeType(Uri uri)328 public String getProviderMimeType(Uri uri) throws RemoteException; 329 newUriPermissionOwner(String name)330 public IBinder newUriPermissionOwner(String name) throws RemoteException; grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg, Uri uri, int mode)331 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg, 332 Uri uri, int mode) throws RemoteException; revokeUriPermissionFromOwner(IBinder owner, Uri uri, int mode)333 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri, 334 int mode) throws RemoteException; 335 checkGrantUriPermission(int callingUid, String targetPkg, Uri uri, int modeFlags)336 public int checkGrantUriPermission(int callingUid, String targetPkg, 337 Uri uri, int modeFlags) throws RemoteException; 338 339 // Cause the specified process to dump the specified heap. dumpHeap(String process, boolean managed, String path, ParcelFileDescriptor fd)340 public boolean dumpHeap(String process, boolean managed, String path, 341 ParcelFileDescriptor fd) throws RemoteException; 342 startActivities(IApplicationThread caller, Intent[] intents, String[] resolvedTypes, IBinder resultTo)343 public int startActivities(IApplicationThread caller, 344 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException; startActivitiesInPackage(int uid, Intent[] intents, String[] resolvedTypes, IBinder resultTo)345 public int startActivitiesInPackage(int uid, 346 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException; 347 getFrontActivityScreenCompatMode()348 public int getFrontActivityScreenCompatMode() throws RemoteException; setFrontActivityScreenCompatMode(int mode)349 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException; getPackageScreenCompatMode(String packageName)350 public int getPackageScreenCompatMode(String packageName) throws RemoteException; setPackageScreenCompatMode(String packageName, int mode)351 public void setPackageScreenCompatMode(String packageName, int mode) 352 throws RemoteException; getPackageAskScreenCompat(String packageName)353 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException; setPackageAskScreenCompat(String packageName, boolean ask)354 public void setPackageAskScreenCompat(String packageName, boolean ask) 355 throws RemoteException; 356 357 // Multi-user APIs switchUser(int userid)358 public boolean switchUser(int userid) throws RemoteException; 359 removeSubTask(int taskId, int subTaskIndex)360 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException; 361 removeTask(int taskId, int flags)362 public boolean removeTask(int taskId, int flags) throws RemoteException; 363 registerProcessObserver(IProcessObserver observer)364 public void registerProcessObserver(IProcessObserver observer) throws RemoteException; unregisterProcessObserver(IProcessObserver observer)365 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException; 366 isIntentSenderTargetedToPackage(IIntentSender sender)367 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException; 368 updatePersistentConfiguration(Configuration values)369 public void updatePersistentConfiguration(Configuration values) throws RemoteException; 370 getProcessPss(int[] pids)371 public long[] getProcessPss(int[] pids) throws RemoteException; 372 showBootMessage(CharSequence msg, boolean always)373 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException; 374 dismissKeyguardOnNextActivity()375 public void dismissKeyguardOnNextActivity() throws RemoteException; 376 377 /* 378 * Private non-Binder interfaces 379 */ testIsSystemReady()380 /* package */ boolean testIsSystemReady(); 381 382 /** Information you can retrieve about a particular application. */ 383 public static class ContentProviderHolder implements Parcelable { 384 public final ProviderInfo info; 385 public IContentProvider provider; 386 public boolean noReleaseNeeded; 387 ContentProviderHolder(ProviderInfo _info)388 public ContentProviderHolder(ProviderInfo _info) { 389 info = _info; 390 } 391 describeContents()392 public int describeContents() { 393 return 0; 394 } 395 writeToParcel(Parcel dest, int flags)396 public void writeToParcel(Parcel dest, int flags) { 397 info.writeToParcel(dest, 0); 398 if (provider != null) { 399 dest.writeStrongBinder(provider.asBinder()); 400 } else { 401 dest.writeStrongBinder(null); 402 } 403 dest.writeInt(noReleaseNeeded ? 1:0); 404 } 405 406 public static final Parcelable.Creator<ContentProviderHolder> CREATOR 407 = new Parcelable.Creator<ContentProviderHolder>() { 408 public ContentProviderHolder createFromParcel(Parcel source) { 409 return new ContentProviderHolder(source); 410 } 411 412 public ContentProviderHolder[] newArray(int size) { 413 return new ContentProviderHolder[size]; 414 } 415 }; 416 ContentProviderHolder(Parcel source)417 private ContentProviderHolder(Parcel source) { 418 info = ProviderInfo.CREATOR.createFromParcel(source); 419 provider = ContentProviderNative.asInterface( 420 source.readStrongBinder()); 421 noReleaseNeeded = source.readInt() != 0; 422 } 423 }; 424 425 /** Information returned after waiting for an activity start. */ 426 public static class WaitResult implements Parcelable { 427 public int result; 428 public boolean timeout; 429 public ComponentName who; 430 public long thisTime; 431 public long totalTime; 432 WaitResult()433 public WaitResult() { 434 } 435 describeContents()436 public int describeContents() { 437 return 0; 438 } 439 writeToParcel(Parcel dest, int flags)440 public void writeToParcel(Parcel dest, int flags) { 441 dest.writeInt(result); 442 dest.writeInt(timeout ? 1 : 0); 443 ComponentName.writeToParcel(who, dest); 444 dest.writeLong(thisTime); 445 dest.writeLong(totalTime); 446 } 447 448 public static final Parcelable.Creator<WaitResult> CREATOR 449 = new Parcelable.Creator<WaitResult>() { 450 public WaitResult createFromParcel(Parcel source) { 451 return new WaitResult(source); 452 } 453 454 public WaitResult[] newArray(int size) { 455 return new WaitResult[size]; 456 } 457 }; 458 WaitResult(Parcel source)459 private WaitResult(Parcel source) { 460 result = source.readInt(); 461 timeout = source.readInt() != 0; 462 who = ComponentName.readFromParcel(source); 463 thisTime = source.readLong(); 464 totalTime = source.readLong(); 465 } 466 }; 467 468 String descriptor = "android.app.IActivityManager"; 469 470 // Please keep these transaction codes the same -- they are also 471 // sent by C++ code. 472 int START_RUNNING_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION; 473 int HANDLE_APPLICATION_CRASH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+1; 474 int START_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+2; 475 int UNHANDLED_BACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+3; 476 int OPEN_CONTENT_URI_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+4; 477 478 // Remaining non-native transaction codes. 479 int FINISH_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+10; 480 int REGISTER_RECEIVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+11; 481 int UNREGISTER_RECEIVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+12; 482 int BROADCAST_INTENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+13; 483 int UNBROADCAST_INTENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+14; 484 int FINISH_RECEIVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+15; 485 int ATTACH_APPLICATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+16; 486 int ACTIVITY_IDLE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+17; 487 int ACTIVITY_PAUSED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+18; 488 int ACTIVITY_STOPPED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+19; 489 int GET_CALLING_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+20; 490 int GET_CALLING_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+21; 491 int GET_TASKS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+22; 492 int MOVE_TASK_TO_FRONT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+23; 493 int MOVE_TASK_TO_BACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+24; 494 int MOVE_TASK_BACKWARDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+25; 495 int GET_TASK_FOR_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+26; 496 int REPORT_THUMBNAIL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+27; 497 int GET_CONTENT_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+28; 498 int PUBLISH_CONTENT_PROVIDERS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+29; 499 500 int FINISH_SUB_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+31; 501 int GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+32; 502 int START_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+33; 503 int STOP_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+34; 504 int BIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+35; 505 int UNBIND_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+36; 506 int PUBLISH_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+37; 507 int FINISH_OTHER_INSTANCES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+38; 508 int GOING_TO_SLEEP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+39; 509 int WAKING_UP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+40; 510 int SET_DEBUG_APP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+41; 511 int SET_ALWAYS_FINISH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+42; 512 int START_INSTRUMENTATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+43; 513 int FINISH_INSTRUMENTATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+44; 514 int GET_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+45; 515 int UPDATE_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+46; 516 int STOP_SERVICE_TOKEN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+47; 517 int GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+48; 518 int GET_PACKAGE_FOR_TOKEN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+49; 519 int SET_PROCESS_LIMIT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+50; 520 int GET_PROCESS_LIMIT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+51; 521 int CHECK_PERMISSION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+52; 522 int CHECK_URI_PERMISSION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+53; 523 int GRANT_URI_PERMISSION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+54; 524 int REVOKE_URI_PERMISSION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+55; 525 int SET_ACTIVITY_CONTROLLER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+56; 526 int SHOW_WAITING_FOR_DEBUGGER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+57; 527 int SIGNAL_PERSISTENT_PROCESSES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+58; 528 int GET_RECENT_TASKS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+59; 529 int SERVICE_DONE_EXECUTING_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+60; 530 int ACTIVITY_DESTROYED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+61; 531 int GET_INTENT_SENDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+62; 532 int CANCEL_INTENT_SENDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+63; 533 int GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+64; 534 int ENTER_SAFE_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+65; 535 int START_NEXT_MATCHING_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+66; 536 int NOTE_WAKEUP_ALARM_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+67; 537 int REMOVE_CONTENT_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+68; 538 int SET_REQUESTED_ORIENTATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+69; 539 int GET_REQUESTED_ORIENTATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+70; 540 int UNBIND_FINISHED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+71; 541 int SET_PROCESS_FOREGROUND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+72; 542 int SET_SERVICE_FOREGROUND_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+73; 543 int MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+74; 544 int GET_MEMORY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+75; 545 int GET_PROCESSES_IN_ERROR_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+76; 546 int CLEAR_APP_DATA_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+77; 547 int FORCE_STOP_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+78; 548 int KILL_PIDS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+79; 549 int GET_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+80; 550 int GET_TASK_THUMBNAILS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+81; 551 int GET_RUNNING_APP_PROCESSES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+82; 552 int GET_DEVICE_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+83; 553 int PEEK_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+84; 554 int PROFILE_CONTROL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+85; 555 int SHUTDOWN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+86; 556 int STOP_APP_SWITCHES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+87; 557 int RESUME_APP_SWITCHES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+88; 558 int START_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+89; 559 int BACKUP_AGENT_CREATED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+90; 560 int UNBIND_BACKUP_AGENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+91; 561 int REGISTER_ACTIVITY_WATCHER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+92; 562 int UNREGISTER_ACTIVITY_WATCHER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+93; 563 int START_ACTIVITY_IN_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+94; 564 int KILL_APPLICATION_WITH_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+95; 565 int CLOSE_SYSTEM_DIALOGS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+96; 566 int GET_PROCESS_MEMORY_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+97; 567 int KILL_APPLICATION_PROCESS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+98; 568 int START_ACTIVITY_INTENT_SENDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+99; 569 int OVERRIDE_PENDING_TRANSITION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+100; 570 int HANDLE_APPLICATION_WTF_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+101; 571 int KILL_BACKGROUND_PROCESSES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+102; 572 int IS_USER_A_MONKEY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+103; 573 int START_ACTIVITY_AND_WAIT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+104; 574 int WILL_ACTIVITY_BE_VISIBLE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+105; 575 int START_ACTIVITY_WITH_CONFIG_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+106; 576 int GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+107; 577 int FINISH_HEAVY_WEIGHT_APP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+108; 578 int HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+109; 579 int IS_IMMERSIVE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+110; 580 int SET_IMMERSIVE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+111; 581 int IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+112; 582 int CRASH_APPLICATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+113; 583 int GET_PROVIDER_MIME_TYPE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+114; 584 int NEW_URI_PERMISSION_OWNER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+115; 585 int GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+116; 586 int REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+117; 587 int CHECK_GRANT_URI_PERMISSION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+118; 588 int DUMP_HEAP_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+119; 589 int START_ACTIVITIES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+120; 590 int START_ACTIVITIES_IN_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+121; 591 int ACTIVITY_SLEPT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+122; 592 int GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+123; 593 int SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+124; 594 int GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+125; 595 int SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+126; 596 int GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+127; 597 int SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+128; 598 int SWITCH_USER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+129; 599 int REMOVE_SUB_TASK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+130; 600 int REMOVE_TASK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+131; 601 int REGISTER_PROCESS_OBSERVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+132; 602 int UNREGISTER_PROCESS_OBSERVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+133; 603 int IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+134; 604 int UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+135; 605 int GET_PROCESS_PSS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+136; 606 int SHOW_BOOT_MESSAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+137; 607 int DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+138; 608 } 609