• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.app;
18 
19 import android.app.ActivityManager;
20 import android.app.ApplicationErrorReport;
21 import android.app.ContentProviderHolder;
22 import android.app.GrantedUriPermission;
23 import android.app.IApplicationThread;
24 import android.app.IActivityController;
25 import android.app.IAppTask;
26 import android.app.IAssistDataReceiver;
27 import android.app.IInstrumentationWatcher;
28 import android.app.IProcessObserver;
29 import android.app.IServiceConnection;
30 import android.app.IStopUserCallback;
31 import android.app.ITaskStackListener;
32 import android.app.IUiAutomationConnection;
33 import android.app.IUidObserver;
34 import android.app.IUserSwitchObserver;
35 import android.app.Notification;
36 import android.app.PendingIntent;
37 import android.app.PictureInPictureParams;
38 import android.app.ProfilerInfo;
39 import android.app.WaitResult;
40 import android.app.assist.AssistContent;
41 import android.app.assist.AssistStructure;
42 import android.content.ComponentName;
43 import android.content.IIntentReceiver;
44 import android.content.IIntentSender;
45 import android.content.Intent;
46 import android.content.IntentFilter;
47 import android.content.IntentSender;
48 import android.content.pm.ApplicationInfo;
49 import android.content.pm.ConfigurationInfo;
50 import android.content.pm.IPackageDataObserver;
51 import android.content.pm.ParceledListSlice;
52 import android.content.pm.ProviderInfo;
53 import android.content.pm.UserInfo;
54 import android.content.res.Configuration;
55 import android.graphics.Bitmap;
56 import android.graphics.GraphicBuffer;
57 import android.graphics.Point;
58 import android.graphics.Rect;
59 import android.net.Uri;
60 import android.os.Bundle;
61 import android.os.Debug;
62 import android.os.IBinder;
63 import android.os.IProgressListener;
64 import android.os.ParcelFileDescriptor;
65 import android.os.PersistableBundle;
66 import android.os.RemoteCallback;
67 import android.os.StrictMode;
68 import android.os.WorkSource;
69 import android.service.voice.IVoiceInteractionSession;
70 import android.view.IRecentsAnimationRunner;
71 import android.view.RemoteAnimationDefinition;
72 import android.view.RemoteAnimationAdapter;
73 import com.android.internal.app.IVoiceInteractor;
74 import com.android.internal.os.IResultReceiver;
75 import com.android.internal.policy.IKeyguardDismissCallback;
76 
77 import java.util.List;
78 
79 /**
80  * System private API for talking with the activity manager service.  This
81  * provides calls from the application back to the activity manager.
82  *
83  * {@hide}
84  */
85 interface IActivityManager {
86     // WARNING: when these transactions are updated, check if they are any callers on the native
87     // side. If so, make sure they are using the correct transaction ids and arguments.
88     // If a transaction which will also be used on the native side is being inserted, add it to
89     // below block of transactions.
90 
91     // Since these transactions are also called from native code, these must be kept in sync with
92     // the ones in frameworks/native/libs/binder/include/binder/IActivityManager.h
93     // =============== Beginning of transactions used on native side as well ======================
openContentUri(in String uriString)94     ParcelFileDescriptor openContentUri(in String uriString);
registerUidObserver(in IUidObserver observer, int which, int cutpoint, String callingPackage)95     void registerUidObserver(in IUidObserver observer, int which, int cutpoint,
96             String callingPackage);
unregisterUidObserver(in IUidObserver observer)97     void unregisterUidObserver(in IUidObserver observer);
isUidActive(int uid, String callingPackage)98     boolean isUidActive(int uid, String callingPackage);
getUidProcessState(int uid, in String callingPackage)99     int getUidProcessState(int uid, in String callingPackage);
100     // =============== End of transactions used on native side as well ============================
101 
102     // Special low-level communication with activity manager.
handleApplicationCrash(in IBinder app, in ApplicationErrorReport.ParcelableCrashInfo crashInfo)103     void handleApplicationCrash(in IBinder app,
104             in ApplicationErrorReport.ParcelableCrashInfo crashInfo);
105     @UnsupportedAppUsage
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)106     int startActivity(in IApplicationThread caller, in String callingPackage, in Intent intent,
107             in String resolvedType, in IBinder resultTo, in String resultWho, int requestCode,
108             int flags, in ProfilerInfo profilerInfo, in Bundle options);
109     @UnsupportedAppUsage
unhandledBack()110     void unhandledBack();
111     @UnsupportedAppUsage
finishActivity(in IBinder token, int code, in Intent data, int finishTask)112     boolean finishActivity(in IBinder token, int code, in Intent data, int finishTask);
113     @UnsupportedAppUsage
registerReceiver(in IApplicationThread caller, in String callerPackage, in IIntentReceiver receiver, in IntentFilter filter, in String requiredPermission, int userId, int flags)114     Intent registerReceiver(in IApplicationThread caller, in String callerPackage,
115             in IIntentReceiver receiver, in IntentFilter filter,
116             in String requiredPermission, int userId, int flags);
117     @UnsupportedAppUsage
unregisterReceiver(in IIntentReceiver receiver)118     void unregisterReceiver(in IIntentReceiver receiver);
119     @UnsupportedAppUsage
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)120     int broadcastIntent(in IApplicationThread caller, in Intent intent,
121             in String resolvedType, in IIntentReceiver resultTo, int resultCode,
122             in String resultData, in Bundle map, in String[] requiredPermissions,
123             int appOp, in Bundle options, boolean serialized, boolean sticky, int userId);
unbroadcastIntent(in IApplicationThread caller, in Intent intent, int userId)124     void unbroadcastIntent(in IApplicationThread caller, in Intent intent, int userId);
finishReceiver(in IBinder who, int resultCode, in String resultData, in Bundle map, boolean abortBroadcast, int flags)125     oneway void finishReceiver(in IBinder who, int resultCode, in String resultData, in Bundle map,
126             boolean abortBroadcast, int flags);
attachApplication(in IApplicationThread app, long startSeq)127     void attachApplication(in IApplicationThread app, long startSeq);
getTasks(int maxNum)128     List<ActivityManager.RunningTaskInfo> getTasks(int maxNum);
129     @UnsupportedAppUsage
getFilteredTasks(int maxNum, int ignoreActivityType, int ignoreWindowingMode)130     List<ActivityManager.RunningTaskInfo> getFilteredTasks(int maxNum, int ignoreActivityType,
131             int ignoreWindowingMode);
132     @UnsupportedAppUsage
moveTaskToFront(in IApplicationThread caller, in String callingPackage, int task, int flags, in Bundle options)133     void moveTaskToFront(in IApplicationThread caller, in String callingPackage, int task,
134             int flags, in Bundle options);
135     @UnsupportedAppUsage
getTaskForActivity(in IBinder token, in boolean onlyRoot)136     int getTaskForActivity(in IBinder token, in boolean onlyRoot);
getContentProvider(in IApplicationThread caller, in String callingPackage, in String name, int userId, boolean stable)137     ContentProviderHolder getContentProvider(in IApplicationThread caller, in String callingPackage,
138             in String name, int userId, boolean stable);
139     @UnsupportedAppUsage
publishContentProviders(in IApplicationThread caller, in List<ContentProviderHolder> providers)140     void publishContentProviders(in IApplicationThread caller,
141             in List<ContentProviderHolder> providers);
refContentProvider(in IBinder connection, int stableDelta, int unstableDelta)142     boolean refContentProvider(in IBinder connection, int stableDelta, int unstableDelta);
getRunningServiceControlPanel(in ComponentName service)143     PendingIntent getRunningServiceControlPanel(in ComponentName service);
startService(in IApplicationThread caller, in Intent service, in String resolvedType, boolean requireForeground, in String callingPackage, int userId)144     ComponentName startService(in IApplicationThread caller, in Intent service,
145             in String resolvedType, boolean requireForeground, in String callingPackage, int userId);
146     @UnsupportedAppUsage
stopService(in IApplicationThread caller, in Intent service, in String resolvedType, int userId)147     int stopService(in IApplicationThread caller, in Intent service,
148             in String resolvedType, int userId);
149     // Currently keeping old bindService because it is on the greylist
150     @UnsupportedAppUsage
bindService(in IApplicationThread caller, in IBinder token, in Intent service, in String resolvedType, in IServiceConnection connection, int flags, in String callingPackage, int userId)151     int bindService(in IApplicationThread caller, in IBinder token, in Intent service,
152             in String resolvedType, in IServiceConnection connection, int flags,
153             in String callingPackage, int userId);
bindIsolatedService(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)154     int bindIsolatedService(in IApplicationThread caller, in IBinder token, in Intent service,
155             in String resolvedType, in IServiceConnection connection, int flags,
156             in String instanceName, in String callingPackage, int userId);
updateServiceGroup(in IServiceConnection connection, int group, int importance)157     void updateServiceGroup(in IServiceConnection connection, int group, int importance);
158     @UnsupportedAppUsage
unbindService(in IServiceConnection connection)159     boolean unbindService(in IServiceConnection connection);
publishService(in IBinder token, in Intent intent, in IBinder service)160     void publishService(in IBinder token, in Intent intent, in IBinder service);
161     @UnsupportedAppUsage
setDebugApp(in String packageName, boolean waitForDebugger, boolean persistent)162     void setDebugApp(in String packageName, boolean waitForDebugger, boolean persistent);
setAgentApp(in String packageName, @nullable String agent)163     void setAgentApp(in String packageName, @nullable String agent);
164     @UnsupportedAppUsage
setAlwaysFinish(boolean enabled)165     void setAlwaysFinish(boolean enabled);
166     @UnsupportedAppUsage
startInstrumentation(in ComponentName className, in String profileFile, int flags, in Bundle arguments, in IInstrumentationWatcher watcher, in IUiAutomationConnection connection, int userId, in String abiOverride)167     boolean startInstrumentation(in ComponentName className, in String profileFile,
168             int flags, in Bundle arguments, in IInstrumentationWatcher watcher,
169             in IUiAutomationConnection connection, int userId,
170             in String abiOverride);
addInstrumentationResults(in IApplicationThread target, in Bundle results)171     void addInstrumentationResults(in IApplicationThread target, in Bundle results);
finishInstrumentation(in IApplicationThread target, int resultCode, in Bundle results)172     void finishInstrumentation(in IApplicationThread target, int resultCode,
173             in Bundle results);
174     /**
175      * @return A copy of global {@link Configuration}, contains general settings for the entire
176      *         system. Corresponds to the configuration of the default display.
177      * @throws RemoteException
178      */
179     @UnsupportedAppUsage
getConfiguration()180     Configuration getConfiguration();
181     /**
182      * Updates global configuration and applies changes to the entire system.
183      * @param values Update values for global configuration. If null is passed it will request the
184      *               Window Manager to compute new config for the default display.
185      * @throws RemoteException
186      * @return Returns true if the configuration was updated.
187      */
188     @UnsupportedAppUsage
updateConfiguration(in Configuration values)189     boolean updateConfiguration(in Configuration values);
stopServiceToken(in ComponentName className, in IBinder token, int startId)190     boolean stopServiceToken(in ComponentName className, in IBinder token, int startId);
191     @UnsupportedAppUsage
setProcessLimit(int max)192     void setProcessLimit(int max);
193     @UnsupportedAppUsage
getProcessLimit()194     int getProcessLimit();
195     @UnsupportedAppUsage
checkPermission(in String permission, int pid, int uid)196     int checkPermission(in String permission, int pid, int uid);
checkUriPermission(in Uri uri, int pid, int uid, int mode, int userId, in IBinder callerToken)197     int checkUriPermission(in Uri uri, int pid, int uid, int mode, int userId,
198             in IBinder callerToken);
grantUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri, int mode, int userId)199     void grantUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri,
200             int mode, int userId);
revokeUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri, int mode, int userId)201     void revokeUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri,
202             int mode, int userId);
203     @UnsupportedAppUsage
setActivityController(in IActivityController watcher, boolean imAMonkey)204     void setActivityController(in IActivityController watcher, boolean imAMonkey);
showWaitingForDebugger(in IApplicationThread who, boolean waiting)205     void showWaitingForDebugger(in IApplicationThread who, boolean waiting);
206     /*
207      * This will deliver the specified signal to all the persistent processes. Currently only
208      * SIGUSR1 is delivered. All others are ignored.
209      */
signalPersistentProcesses(int signal)210     void signalPersistentProcesses(int signal);
211 
212     @UnsupportedAppUsage
getRecentTasks(int maxNum, int flags, int userId)213     ParceledListSlice getRecentTasks(int maxNum, int flags, int userId);
serviceDoneExecuting(in IBinder token, int type, int startId, int res)214     oneway void serviceDoneExecuting(in IBinder token, int type, int startId, int res);
215     @UnsupportedAppUsage
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)216     IIntentSender getIntentSender(int type, in String packageName, in IBinder token,
217             in String resultWho, int requestCode, in Intent[] intents, in String[] resolvedTypes,
218             int flags, in Bundle options, int userId);
cancelIntentSender(in IIntentSender sender)219     void cancelIntentSender(in IIntentSender sender);
getPackageForIntentSender(in IIntentSender sender)220     String getPackageForIntentSender(in IIntentSender sender);
registerIntentSenderCancelListener(in IIntentSender sender, in IResultReceiver receiver)221     void registerIntentSenderCancelListener(in IIntentSender sender, in IResultReceiver receiver);
unregisterIntentSenderCancelListener(in IIntentSender sender, in IResultReceiver receiver)222     void unregisterIntentSenderCancelListener(in IIntentSender sender, in IResultReceiver receiver);
enterSafeMode()223     void enterSafeMode();
noteWakeupAlarm(in IIntentSender sender, in WorkSource workSource, int sourceUid, in String sourcePkg, in String tag)224     void noteWakeupAlarm(in IIntentSender sender, in WorkSource workSource, int sourceUid,
225             in String sourcePkg, in String tag);
removeContentProvider(in IBinder connection, boolean stable)226     oneway void removeContentProvider(in IBinder connection, boolean stable);
227     @UnsupportedAppUsage
setRequestedOrientation(in IBinder token, int requestedOrientation)228     void setRequestedOrientation(in IBinder token, int requestedOrientation);
unbindFinished(in IBinder token, in Intent service, boolean doRebind)229     void unbindFinished(in IBinder token, in Intent service, boolean doRebind);
230     @UnsupportedAppUsage
setProcessImportant(in IBinder token, int pid, boolean isForeground, String reason)231     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)232     void setServiceForeground(in ComponentName className, in IBinder token,
233             int id, in Notification notification, int flags, int foregroundServiceType);
getForegroundServiceType(in ComponentName className, in IBinder token)234     int getForegroundServiceType(in ComponentName className, in IBinder token);
235     @UnsupportedAppUsage
moveActivityTaskToBack(in IBinder token, boolean nonRoot)236     boolean moveActivityTaskToBack(in IBinder token, boolean nonRoot);
237     @UnsupportedAppUsage
getMemoryInfo(out ActivityManager.MemoryInfo outInfo)238     void getMemoryInfo(out ActivityManager.MemoryInfo outInfo);
getProcessesInErrorState()239     List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState();
clearApplicationUserData(in String packageName, boolean keepState, in IPackageDataObserver observer, int userId)240     boolean clearApplicationUserData(in String packageName, boolean keepState,
241             in IPackageDataObserver observer, int userId);
242     @UnsupportedAppUsage
forceStopPackage(in String packageName, int userId)243     void forceStopPackage(in String packageName, int userId);
killPids(in int[] pids, in String reason, boolean secure)244     boolean killPids(in int[] pids, in String reason, boolean secure);
245     @UnsupportedAppUsage
getServices(int maxNum, int flags)246     List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags);
247     // Retrieve running application processes in the system
248     @UnsupportedAppUsage
getRunningAppProcesses()249     List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses();
peekService(in Intent service, in String resolvedType, in String callingPackage)250     IBinder peekService(in Intent service, in String resolvedType, in String callingPackage);
251     // Turn on/off profiling in a particular process.
252     @UnsupportedAppUsage
profileControl(in String process, int userId, boolean start, in ProfilerInfo profilerInfo, int profileType)253     boolean profileControl(in String process, int userId, boolean start,
254             in ProfilerInfo profilerInfo, int profileType);
255     @UnsupportedAppUsage
shutdown(int timeout)256     boolean shutdown(int timeout);
257     @UnsupportedAppUsage
stopAppSwitches()258     void stopAppSwitches();
259     @UnsupportedAppUsage
resumeAppSwitches()260     void resumeAppSwitches();
bindBackupAgent(in String packageName, int backupRestoreMode, int targetUserId)261     boolean bindBackupAgent(in String packageName, int backupRestoreMode, int targetUserId);
backupAgentCreated(in String packageName, in IBinder agent, int userId)262     void backupAgentCreated(in String packageName, in IBinder agent, int userId);
unbindBackupAgent(in ApplicationInfo appInfo)263     void unbindBackupAgent(in ApplicationInfo appInfo);
getUidForIntentSender(in IIntentSender sender)264     int getUidForIntentSender(in IIntentSender sender);
handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll, boolean requireFull, in String name, in String callerPackage)265     int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
266             boolean requireFull, in String name, in String callerPackage);
addPackageDependency(in String packageName)267     void addPackageDependency(in String packageName);
killApplication(in String pkg, int appId, int userId, in String reason)268     void killApplication(in String pkg, int appId, int userId, in String reason);
269     @UnsupportedAppUsage
closeSystemDialogs(in String reason)270     void closeSystemDialogs(in String reason);
271     @UnsupportedAppUsage
getProcessMemoryInfo(in int[] pids)272     Debug.MemoryInfo[] getProcessMemoryInfo(in int[] pids);
killApplicationProcess(in String processName, int uid)273     void killApplicationProcess(in String processName, int uid);
274     // Special low-level communication with activity manager.
handleApplicationWtf(in IBinder app, in String tag, boolean system, in ApplicationErrorReport.ParcelableCrashInfo crashInfo)275     boolean handleApplicationWtf(in IBinder app, in String tag, boolean system,
276             in ApplicationErrorReport.ParcelableCrashInfo crashInfo);
277     @UnsupportedAppUsage
killBackgroundProcesses(in String packageName, int userId)278     void killBackgroundProcesses(in String packageName, int userId);
isUserAMonkey()279     boolean isUserAMonkey();
280     // Retrieve info of applications installed on external media that are currently
281     // running.
getRunningExternalApplications()282     List<ApplicationInfo> getRunningExternalApplications();
283     @UnsupportedAppUsage
finishHeavyWeightApp()284     void finishHeavyWeightApp();
285     // A StrictMode violation to be handled.
286     @UnsupportedAppUsage
handleApplicationStrictModeViolation(in IBinder app, int penaltyMask, in StrictMode.ViolationInfo crashInfo)287     void handleApplicationStrictModeViolation(in IBinder app, int penaltyMask,
288             in StrictMode.ViolationInfo crashInfo);
isTopActivityImmersive()289     boolean isTopActivityImmersive();
crashApplication(int uid, int initialPid, in String packageName, int userId, in String message, boolean force)290     void crashApplication(int uid, int initialPid, in String packageName, int userId,
291             in String message, boolean force);
292     @UnsupportedAppUsage
getProviderMimeType(in Uri uri, int userId)293     String getProviderMimeType(in Uri uri, int userId);
294     // 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)295     boolean dumpHeap(in String process, int userId, boolean managed, boolean mallocInfo,
296             boolean runGc, in String path, in ParcelFileDescriptor fd,
297             in RemoteCallback finishCallback);
298     @UnsupportedAppUsage
isUserRunning(int userid, int flags)299     boolean isUserRunning(int userid, int flags);
300     @UnsupportedAppUsage
setPackageScreenCompatMode(in String packageName, int mode)301     void setPackageScreenCompatMode(in String packageName, int mode);
302     @UnsupportedAppUsage
switchUser(int userid)303     boolean switchUser(int userid);
304     @UnsupportedAppUsage
removeTask(int taskId)305     boolean removeTask(int taskId);
306     @UnsupportedAppUsage
registerProcessObserver(in IProcessObserver observer)307     void registerProcessObserver(in IProcessObserver observer);
308     @UnsupportedAppUsage
unregisterProcessObserver(in IProcessObserver observer)309     void unregisterProcessObserver(in IProcessObserver observer);
isIntentSenderTargetedToPackage(in IIntentSender sender)310     boolean isIntentSenderTargetedToPackage(in IIntentSender sender);
311     @UnsupportedAppUsage
updatePersistentConfiguration(in Configuration values)312     void updatePersistentConfiguration(in Configuration values);
313     @UnsupportedAppUsage
getProcessPss(in int[] pids)314     long[] getProcessPss(in int[] pids);
showBootMessage(in CharSequence msg, boolean always)315     void showBootMessage(in CharSequence msg, boolean always);
316     @UnsupportedAppUsage
killAllBackgroundProcesses()317     void killAllBackgroundProcesses();
getContentProviderExternal(in String name, int userId, in IBinder token, String tag)318     ContentProviderHolder getContentProviderExternal(in String name, int userId,
319             in IBinder token, String tag);
320     /** @deprecated - Use {@link #removeContentProviderExternalAsUser} which takes a user ID. */
321     @UnsupportedAppUsage
removeContentProviderExternal(in String name, in IBinder token)322     void removeContentProviderExternal(in String name, in IBinder token);
removeContentProviderExternalAsUser(in String name, in IBinder token, int userId)323     void removeContentProviderExternalAsUser(in String name, in IBinder token, int userId);
324     // Get memory information about the calling process.
getMyMemoryState(out ActivityManager.RunningAppProcessInfo outInfo)325     void getMyMemoryState(out ActivityManager.RunningAppProcessInfo outInfo);
killProcessesBelowForeground(in String reason)326     boolean killProcessesBelowForeground(in String reason);
327     @UnsupportedAppUsage
getCurrentUser()328     UserInfo getCurrentUser();
329     // This is not public because you need to be very careful in how you
330     // manage your activity to make sure it is always the uid you expect.
331     @UnsupportedAppUsage
getLaunchedFromUid(in IBinder activityToken)332     int getLaunchedFromUid(in IBinder activityToken);
333     @UnsupportedAppUsage
unstableProviderDied(in IBinder connection)334     void unstableProviderDied(in IBinder connection);
335     @UnsupportedAppUsage
isIntentSenderAnActivity(in IIntentSender sender)336     boolean isIntentSenderAnActivity(in IIntentSender sender);
isIntentSenderAForegroundService(in IIntentSender sender)337     boolean isIntentSenderAForegroundService(in IIntentSender sender);
isIntentSenderABroadcast(in IIntentSender sender)338     boolean isIntentSenderABroadcast(in IIntentSender sender);
339     @UnsupportedAppUsage
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)340     int startActivityAsUser(in IApplicationThread caller, in String callingPackage,
341             in Intent intent, in String resolvedType, in IBinder resultTo, in String resultWho,
342             int requestCode, int flags, in ProfilerInfo profilerInfo,
343             in Bundle options, int userId);
344     @UnsupportedAppUsage
stopUser(int userid, boolean force, in IStopUserCallback callback)345     int stopUser(int userid, boolean force, in IStopUserCallback callback);
346     @UnsupportedAppUsage
registerUserSwitchObserver(in IUserSwitchObserver observer, in String name)347     void registerUserSwitchObserver(in IUserSwitchObserver observer, in String name);
unregisterUserSwitchObserver(in IUserSwitchObserver observer)348     void unregisterUserSwitchObserver(in IUserSwitchObserver observer);
getRunningUserIds()349     int[] getRunningUserIds();
350 
351     // Request a heap dump for the system server.
requestSystemServerHeapDump()352     void requestSystemServerHeapDump();
353 
354     // Deprecated - This method is only used by a few internal components and it will soon be
355     // replaced by a proper bug report API (which will be restricted to a few, pre-defined apps).
356     // No new code should be calling it.
357     @UnsupportedAppUsage
requestBugReport(int bugreportType)358     void requestBugReport(int bugreportType);
359 
360     /**
361      *  Takes a telephony bug report and notifies the user with the title and description
362      *  that are passed to this API as parameters
363      *
364      *  @param shareTitle should be a valid legible string less than 50 chars long
365      *  @param shareDescription should be less than 91 bytes when encoded into UTF-8 format
366      *
367      *  @throws IllegalArgumentException if shareTitle or shareDescription is too big or if the
368      *          paremeters cannot be encoding to an UTF-8 charset.
369      */
requestTelephonyBugReport(in String shareTitle, in String shareDescription)370     void requestTelephonyBugReport(in String shareTitle, in String shareDescription);
371 
372     /**
373      *  Deprecated - This method is only used by Wifi, and it will soon be replaced by a proper
374      *  bug report API.
375      *
376      *  Takes a minimal bugreport of Wifi-related state.
377      *
378      *  @param shareTitle should be a valid legible string less than 50 chars long
379      *  @param shareDescription should be less than 91 bytes when encoded into UTF-8 format
380      *
381      *  @throws IllegalArgumentException if shareTitle or shareDescription is too big or if the
382      *          parameters cannot be encoding to an UTF-8 charset.
383      */
requestWifiBugReport(in String shareTitle, in String shareDescription)384     void requestWifiBugReport(in String shareTitle, in String shareDescription);
385 
386     @UnsupportedAppUsage
getIntentForIntentSender(in IIntentSender sender)387     Intent getIntentForIntentSender(in IIntentSender sender);
388     // This is not public because you need to be very careful in how you
389     // manage your activity to make sure it is always the uid you expect.
390     @UnsupportedAppUsage
getLaunchedFromPackage(in IBinder activityToken)391     String getLaunchedFromPackage(in IBinder activityToken);
killUid(int appId, int userId, in String reason)392     void killUid(int appId, int userId, in String reason);
setUserIsMonkey(boolean monkey)393     void setUserIsMonkey(boolean monkey);
394     @UnsupportedAppUsage
hang(in IBinder who, boolean allowRestart)395     void hang(in IBinder who, boolean allowRestart);
396 
397     @UnsupportedAppUsage
getAllStackInfos()398     List<ActivityManager.StackInfo> getAllStackInfos();
399     @UnsupportedAppUsage
moveTaskToStack(int taskId, int stackId, boolean toTop)400     void moveTaskToStack(int taskId, int stackId, boolean toTop);
401     /**
402      * Resizes the input stack id to the given bounds.
403      *
404      * @param stackId Id of the stack to resize.
405      * @param bounds Bounds to resize the stack to or {@code null} for fullscreen.
406      * @param allowResizeInDockedMode True if the resize should be allowed when the docked stack is
407      *                                active.
408      * @param preserveWindows True if the windows of activities contained in the stack should be
409      *                        preserved.
410      * @param animate True if the stack resize should be animated.
411      * @param animationDuration The duration of the resize animation in milliseconds or -1 if the
412      *                          default animation duration should be used.
413      * @throws RemoteException
414      */
415     @UnsupportedAppUsage
resizeStack(int stackId, in Rect bounds, boolean allowResizeInDockedMode, boolean preserveWindows, boolean animate, int animationDuration)416     void resizeStack(int stackId, in Rect bounds, boolean allowResizeInDockedMode,
417             boolean preserveWindows, boolean animate, int animationDuration);
setFocusedStack(int stackId)418     void setFocusedStack(int stackId);
getFocusedStackInfo()419     ActivityManager.StackInfo getFocusedStackInfo();
420     @UnsupportedAppUsage
restart()421     void restart();
performIdleMaintenance()422     void performIdleMaintenance();
appNotRespondingViaProvider(in IBinder connection)423     void appNotRespondingViaProvider(in IBinder connection);
424     @UnsupportedAppUsage
getTaskBounds(int taskId)425     Rect getTaskBounds(int taskId);
426     @UnsupportedAppUsage
setProcessMemoryTrimLevel(in String process, int uid, int level)427     boolean setProcessMemoryTrimLevel(in String process, int uid, int level);
428 
429 
430     // Start of L transactions
getTagForIntentSender(in IIntentSender sender, in String prefix)431     String getTagForIntentSender(in IIntentSender sender, in String prefix);
432     @UnsupportedAppUsage
startUserInBackground(int userid)433     boolean startUserInBackground(int userid);
434     @UnsupportedAppUsage
isInLockTaskMode()435     boolean isInLockTaskMode();
436     @UnsupportedAppUsage
startRecentsActivity(in Intent intent, in IAssistDataReceiver assistDataReceiver, in IRecentsAnimationRunner recentsAnimationRunner)437     void startRecentsActivity(in Intent intent, in IAssistDataReceiver assistDataReceiver,
438             in IRecentsAnimationRunner recentsAnimationRunner);
439     @UnsupportedAppUsage
cancelRecentsAnimation(boolean restoreHomeStackPosition)440     void cancelRecentsAnimation(boolean restoreHomeStackPosition);
441     @UnsupportedAppUsage
startActivityFromRecents(int taskId, in Bundle options)442     int startActivityFromRecents(int taskId, in Bundle options);
443     @UnsupportedAppUsage
startSystemLockTaskMode(int taskId)444     void startSystemLockTaskMode(int taskId);
445     @UnsupportedAppUsage
isTopOfTask(in IBinder token)446     boolean isTopOfTask(in IBinder token);
bootAnimationComplete()447     void bootAnimationComplete();
checkPermissionWithToken(in String permission, int pid, int uid, in IBinder callerToken)448     int checkPermissionWithToken(in String permission, int pid, int uid,
449             in IBinder callerToken);
450     @UnsupportedAppUsage
registerTaskStackListener(in ITaskStackListener listener)451     void registerTaskStackListener(in ITaskStackListener listener);
unregisterTaskStackListener(in ITaskStackListener listener)452     void unregisterTaskStackListener(in ITaskStackListener listener);
notifyCleartextNetwork(int uid, in byte[] firstPacket)453     void notifyCleartextNetwork(int uid, in byte[] firstPacket);
454     @UnsupportedAppUsage
setTaskResizeable(int taskId, int resizeableMode)455     void setTaskResizeable(int taskId, int resizeableMode);
456     @UnsupportedAppUsage
resizeTask(int taskId, in Rect bounds, int resizeMode)457     void resizeTask(int taskId, in Rect bounds, int resizeMode);
458     @UnsupportedAppUsage
getLockTaskModeState()459     int getLockTaskModeState();
460     @UnsupportedAppUsage
setDumpHeapDebugLimit(in String processName, int uid, long maxMemSize, in String reportPackage)461     void setDumpHeapDebugLimit(in String processName, int uid, long maxMemSize,
462             in String reportPackage);
dumpHeapFinished(in String path)463     void dumpHeapFinished(in String path);
updateLockTaskPackages(int userId, in String[] packages)464     void updateLockTaskPackages(int userId, in String[] packages);
noteAlarmStart(in IIntentSender sender, in WorkSource workSource, int sourceUid, in String tag)465     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)466     void noteAlarmFinish(in IIntentSender sender, in WorkSource workSource, int sourceUid, in String tag);
467     @UnsupportedAppUsage
getPackageProcessState(in String packageName, in String callingPackage)468     int getPackageProcessState(in String packageName, in String callingPackage);
updateDeviceOwner(in String packageName)469     void updateDeviceOwner(in String packageName);
470 
471     // Start of N transactions
472     // Start Binder transaction tracking for all applications.
473     @UnsupportedAppUsage
startBinderTracking()474     boolean startBinderTracking();
475     // Stop Binder transaction tracking for all applications and dump trace data to the given file
476     // descriptor.
477     @UnsupportedAppUsage
stopBinderTrackingAndDump(in ParcelFileDescriptor fd)478     boolean stopBinderTrackingAndDump(in ParcelFileDescriptor fd);
479     /**
480      * Try to place task to provided position. The final position might be different depending on
481      * current user and stacks state. The task will be moved to target stack if it's currently in
482      * different stack.
483      */
484     @UnsupportedAppUsage
positionTaskInStack(int taskId, int stackId, int position)485     void positionTaskInStack(int taskId, int stackId, int position);
486     @UnsupportedAppUsage
suppressResizeConfigChanges(boolean suppress)487     void suppressResizeConfigChanges(boolean suppress);
488     @UnsupportedAppUsage
moveTopActivityToPinnedStack(int stackId, in Rect bounds)489     boolean moveTopActivityToPinnedStack(int stackId, in Rect bounds);
isAppStartModeDisabled(int uid, in String packageName)490     boolean isAppStartModeDisabled(int uid, in String packageName);
491     @UnsupportedAppUsage
unlockUser(int userid, in byte[] token, in byte[] secret, in IProgressListener listener)492     boolean unlockUser(int userid, in byte[] token, in byte[] secret,
493             in IProgressListener listener);
killPackageDependents(in String packageName, int userId)494     void killPackageDependents(in String packageName, int userId);
495     /**
496      * Resizes the docked stack, and all other stacks as the result of the dock stack bounds change.
497      *
498      * @param dockedBounds The bounds for the docked stack.
499      * @param tempDockedTaskBounds The temporary bounds for the tasks in the docked stack, which
500      *                             might be different from the stack bounds to allow more
501      *                             flexibility while resizing, or {@code null} if they should be the
502      *                             same as the stack bounds.
503      * @param tempDockedTaskInsetBounds The temporary bounds for the tasks to calculate the insets.
504      *                                  When resizing, we usually "freeze" the layout of a task. To
505      *                                  achieve that, we also need to "freeze" the insets, which
506      *                                  gets achieved by changing task bounds but not bounds used
507      *                                  to calculate the insets in this transient state
508      * @param tempOtherTaskBounds The temporary bounds for the tasks in all other stacks, or
509      *                            {@code null} if they should be the same as the stack bounds.
510      * @param tempOtherTaskInsetBounds Like {@code tempDockedTaskInsetBounds}, but for the other
511      *                                 stacks.
512      * @throws RemoteException
513      */
514     @UnsupportedAppUsage
resizeDockedStack(in Rect dockedBounds, in Rect tempDockedTaskBounds, in Rect tempDockedTaskInsetBounds, in Rect tempOtherTaskBounds, in Rect tempOtherTaskInsetBounds)515     void resizeDockedStack(in Rect dockedBounds, in Rect tempDockedTaskBounds,
516             in Rect tempDockedTaskInsetBounds,
517             in Rect tempOtherTaskBounds, in Rect tempOtherTaskInsetBounds);
518     @UnsupportedAppUsage
removeStack(int stackId)519     void removeStack(int stackId);
makePackageIdle(String packageName, int userId)520     void makePackageIdle(String packageName, int userId);
getMemoryTrimLevel()521     int getMemoryTrimLevel();
isVrModePackageEnabled(in ComponentName packageName)522     boolean isVrModePackageEnabled(in ComponentName packageName);
notifyLockedProfile(int userId)523     void notifyLockedProfile(int userId);
startConfirmDeviceCredentialIntent(in Intent intent, in Bundle options)524     void startConfirmDeviceCredentialIntent(in Intent intent, in Bundle options);
525     @UnsupportedAppUsage
sendIdleJobTrigger()526     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)527     int sendIntentSender(in IIntentSender target, in IBinder whitelistToken, int code,
528             in Intent intent, in String resolvedType, in IIntentReceiver finishedReceiver,
529             in String requiredPermission, in Bundle options);
isBackgroundRestricted(in String packageName)530     boolean isBackgroundRestricted(in String packageName);
531 
532     // Start of N MR1 transactions
setRenderThread(int tid)533     void setRenderThread(int tid);
534     /**
535      * Lets activity manager know whether the calling process is currently showing "top-level" UI
536      * that is not an activity, i.e. windows on the screen the user is currently interacting with.
537      *
538      * <p>This flag can only be set for persistent processes.
539      *
540      * @param hasTopUi Whether the calling process has "top-level" UI.
541      */
setHasTopUi(boolean hasTopUi)542     void setHasTopUi(boolean hasTopUi);
543 
544     // Start of O transactions
restartUserInBackground(int userId)545     int restartUserInBackground(int userId);
546     /** Cancels the window transitions for the given task. */
547     @UnsupportedAppUsage
cancelTaskWindowTransition(int taskId)548     void cancelTaskWindowTransition(int taskId);
549     /**
550      * @param taskId the id of the task to retrieve the sAutoapshots for
551      * @param reducedResolution if set, if the snapshot needs to be loaded from disk, this will load
552      *                          a reduced resolution of it, which is much faster
553      * @return a graphic buffer representing a screenshot of a task
554      */
555     @UnsupportedAppUsage
getTaskSnapshot(int taskId, boolean reducedResolution)556     ActivityManager.TaskSnapshot getTaskSnapshot(int taskId, boolean reducedResolution);
scheduleApplicationInfoChanged(in List<String> packageNames, int userId)557     void scheduleApplicationInfoChanged(in List<String> packageNames, int userId);
setPersistentVrThread(int tid)558     void setPersistentVrThread(int tid);
559 
waitForNetworkStateUpdate(long procStateSeq)560     void waitForNetworkStateUpdate(long procStateSeq);
561     /**
562      * Add a bare uid to the background restrictions whitelist.  Only the system uid may call this.
563      */
backgroundWhitelistUid(int uid)564     void backgroundWhitelistUid(int uid);
565 
566     // Start of P transactions
567     /**
568      *  Similar to {@link #startUserInBackground(int userId), but with a listener to report
569      *  user unlock progress.
570      */
startUserInBackgroundWithListener(int userid, IProgressListener unlockProgressListener)571     boolean startUserInBackgroundWithListener(int userid, IProgressListener unlockProgressListener);
572 
573     /**
574      * Method for the shell UID to start deletating its permission identity to an
575      * active instrumenation. The shell can delegate permissions only to one active
576      * instrumentation at a time. An active instrumentation is one running and
577      * started from the shell.
578      */
startDelegateShellPermissionIdentity(int uid, in String[] permissions)579     void startDelegateShellPermissionIdentity(int uid, in String[] permissions);
580 
581     /**
582      * Method for the shell UID to stop deletating its permission identity to an
583      * active instrumenation. An active instrumentation is one running and
584      * started from the shell.
585      */
stopDelegateShellPermissionIdentity()586     void stopDelegateShellPermissionIdentity();
587 
588     /** Returns a file descriptor that'll be closed when the system server process dies. */
getLifeMonitor()589     ParcelFileDescriptor getLifeMonitor();
590 
591     /**
592      * Start user, if it us not already running, and bring it to foreground.
593      * unlockProgressListener can be null if monitoring progress is not necessary.
594      */
startUserInForegroundWithListener(int userid, IProgressListener unlockProgressListener)595     boolean startUserInForegroundWithListener(int userid, IProgressListener unlockProgressListener);
596 }
597