Debian Codegraph @

core/java/android/app/IActivityManager.aidl

raw
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 ======================
98 ParcelFileDescriptor openContentUri(in String uriString);
99 void registerUidObserver(in IUidObserver observer, int which, int cutpoint,
100 String callingPackage);
101 void unregisterUidObserver(in IUidObserver observer);
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)")
105 int getUidProcessState(int uid, in String callingPackage);
106 @UnsupportedAppUsage
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.
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")
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);
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)
123 void unhandledBack();
124 @UnsupportedAppUsage
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")
127 Intent registerReceiver(in IApplicationThread caller, in String callerPackage,
128 in IIntentReceiver receiver, in IntentFilter filter,
129 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
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")
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);
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);
145 void unbroadcastIntent(in IApplicationThread caller, in Intent intent, int userId);
146 @UnsupportedAppUsage
147 oneway void finishReceiver(in IBinder who, int resultCode, in String resultData, in Bundle map,
148 boolean abortBroadcast, int flags);
149 void attachApplication(in IApplicationThread app, long startSeq);
150 List<ActivityManager.RunningTaskInfo> getTasks(int maxNum);
151 @UnsupportedAppUsage
152 void moveTaskToFront(in IApplicationThread caller, in String callingPackage, int task,
153 int flags, in Bundle options);
154 @UnsupportedAppUsage
155 int getTaskForActivity(in IBinder token, in boolean onlyRoot);
156 ContentProviderHolder getContentProvider(in IApplicationThread caller, in String callingPackage,
157 in String name, int userId, boolean stable);
158 @UnsupportedAppUsage
159 void publishContentProviders(in IApplicationThread caller,
160 in List<ContentProviderHolder> providers);
161 boolean refContentProvider(in IBinder connection, int stableDelta, int unstableDelta);
162 PendingIntent getRunningServiceControlPanel(in ComponentName service);
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
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
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);
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);
177 void updateServiceGroup(in IServiceConnection connection, int group, int importance);
178 @UnsupportedAppUsage
179 boolean unbindService(in IServiceConnection connection);
180 void publishService(in IBinder token, in Intent intent, in IBinder service);
181 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
182 void setDebugApp(in String packageName, boolean waitForDebugger, boolean persistent);
183 void setAgentApp(in String packageName, @nullable String agent);
184 @UnsupportedAppUsage
185 void setAlwaysFinish(boolean enabled);
186 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
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);
191 void addInstrumentationResults(in IApplicationThread target, 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
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)
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 */
219 boolean updateMccMncConfiguration(in String mcc, in String mnc);
220 boolean stopServiceToken(in ComponentName className, in IBinder token, int startId);
221 @UnsupportedAppUsage
222 void setProcessLimit(int max);
223 @UnsupportedAppUsage
224 int getProcessLimit();
225 int checkUriPermission(in Uri uri, int pid, int uid, int mode, int userId,
226 in IBinder callerToken);
227 int[] checkUriPermissions(in List<Uri> uris, int pid, int uid, int mode, int userId,
228 in IBinder callerToken);
229 void grantUriPermission(in IApplicationThread caller, in String targetPkg, in Uri uri,
230 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)
234 void setActivityController(in IActivityController watcher, boolean imAMonkey);
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 */
240 void signalPersistentProcesses(int signal);
241
242 @UnsupportedAppUsage
243 ParceledListSlice getRecentTasks(int maxNum, int flags, int userId);
244 @UnsupportedAppUsage
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")
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);
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);
254 void cancelIntentSender(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 */
262 boolean registerIntentSenderCancelListenerEx(in IIntentSender sender,
263 in IResultReceiver receiver);
264 void unregisterIntentSenderCancelListener(in IIntentSender sender, in IResultReceiver receiver);
265 void enterSafeMode();
266 void noteWakeupAlarm(in IIntentSender sender, in WorkSource workSource, int sourceUid,
267 in String sourcePkg, in String tag);
268 oneway void removeContentProvider(in IBinder connection, boolean stable);
269 @UnsupportedAppUsage
270 void setRequestedOrientation(in IBinder token, int requestedOrientation);
271 void unbindFinished(in IBinder token, in Intent service, boolean doRebind);
272 @UnsupportedAppUsage
273 void setProcessImportant(in IBinder token, int pid, boolean isForeground, String reason);
274 void setServiceForeground(in ComponentName className, in IBinder token,
275 int id, in Notification notification, int flags, int foregroundServiceType);
276 int getForegroundServiceType(in ComponentName className, in IBinder token);
277 @UnsupportedAppUsage
278 boolean moveActivityTaskToBack(in IBinder token, boolean nonRoot);
279 @UnsupportedAppUsage
280 void getMemoryInfo(out ActivityManager.MemoryInfo outInfo);
281 List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState();
282 boolean clearApplicationUserData(in String packageName, boolean keepState,
283 in IPackageDataObserver observer, int userId);
284 void stopAppForUser(in String packageName, int userId);
285 /** Returns {@code false} if the callback could not be registered, {@true} otherwise. */
286 boolean registerForegroundServiceObserver(in IForegroundServiceObserver callback);
287 @UnsupportedAppUsage
288 void forceStopPackage(in String packageName, int userId);
289 boolean killPids(in int[] pids, in String reason, boolean secure);
290 @UnsupportedAppUsage
291 List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags);
292 // Retrieve running application processes in the system
293 @UnsupportedAppUsage
294 List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses();
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)
298 boolean profileControl(in String process, int userId, boolean start,
299 in ProfilerInfo profilerInfo, int profileType);
300 @UnsupportedAppUsage
301 boolean shutdown(int timeout);
302 @UnsupportedAppUsage
303 void stopAppSwitches();
304 @UnsupportedAppUsage
305 void resumeAppSwitches();
306 boolean bindBackupAgent(in String packageName, int backupRestoreMode, int targetUserId,
307 int operationType);
308 void backupAgentCreated(in String packageName, in IBinder agent, int userId);
309 void unbindBackupAgent(in ApplicationInfo appInfo);
310 int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
311 boolean requireFull, in String name, in String callerPackage);
312 void addPackageDependency(in String packageName);
313 void killApplication(in String pkg, int appId, int userId, in String reason);
314 @UnsupportedAppUsage
315 void closeSystemDialogs(in String reason);
316 @UnsupportedAppUsage
317 Debug.MemoryInfo[] getProcessMemoryInfo(in int[] pids);
318 void killApplicationProcess(in String processName, int uid);
319 // Special low-level communication with activity manager.
320 boolean handleApplicationWtf(in IBinder app, in String tag, boolean system,
321 in ApplicationErrorReport.ParcelableCrashInfo crashInfo, int immediateCallerPid);
322 @UnsupportedAppUsage
323 void killBackgroundProcesses(in String packageName, int userId);
324 boolean isUserAMonkey();
325 // Retrieve info of applications installed on external media that are currently
326 // running.
327 List<ApplicationInfo> getRunningExternalApplications();
328 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
329 void finishHeavyWeightApp();
330 // A StrictMode violation to be handled.
331 @UnsupportedAppUsage
332 void handleApplicationStrictModeViolation(in IBinder app, int penaltyMask,
333 in StrictMode.ViolationInfo crashInfo);
334 boolean isTopActivityImmersive();
335 void crashApplicationWithType(int uid, int initialPid, in String packageName, int userId,
336 in String message, boolean force, int exceptionTypeId);
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.")
342 String getProviderMimeType(in Uri uri, int userId);
343
344 oneway void getProviderMimeTypeAsync(in Uri uri, int userId, in RemoteCallback resultCallback);
345
346 // Cause the specified process to dump the specified heap.
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
351 boolean isUserRunning(int userid, int flags);
352 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
353 void setPackageScreenCompatMode(in String packageName, int mode);
354 @UnsupportedAppUsage
355 boolean switchUser(int userid);
356 String getSwitchingFromUserMessage();
357 String getSwitchingToUserMessage();
358 @UnsupportedAppUsage
359 void setStopUserOnSwitch(int value);
360 boolean removeTask(int taskId);
361 @UnsupportedAppUsage
362 void registerProcessObserver(in IProcessObserver observer);
363 @UnsupportedAppUsage
364 void unregisterProcessObserver(in IProcessObserver observer);
365 boolean isIntentSenderTargetedToPackage(in IIntentSender sender);
366 @UnsupportedAppUsage
367 void updatePersistentConfiguration(in Configuration values);
368 void updatePersistentConfigurationWithAttribution(in Configuration values,
369 String callingPackageName, String callingAttributionTag);
370 @UnsupportedAppUsage
371 long[] getProcessPss(in int[] pids);
372 void showBootMessage(in CharSequence msg, boolean always);
373 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
374 void killAllBackgroundProcesses();
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)
379 void removeContentProviderExternal(in String name, in IBinder token);
380 void removeContentProviderExternalAsUser(in String name, in IBinder token, int userId);
381 // Get memory information about the calling process.
382 void getMyMemoryState(out ActivityManager.RunningAppProcessInfo outInfo);
383 boolean killProcessesBelowForeground(in String reason);
384 @UnsupportedAppUsage
385 UserInfo getCurrentUser();
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
390 int getLaunchedFromUid(in IBinder activityToken);
391 @UnsupportedAppUsage
392 void unstableProviderDied(in IBinder connection);
393 @UnsupportedAppUsage
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")
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);
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)
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 */
411 int stopUserWithDelayedLocking(int userid, boolean force, in IStopUserCallback callback);
412
413 @UnsupportedAppUsage
414 void registerUserSwitchObserver(in IUserSwitchObserver observer, in String name);
415 void unregisterUserSwitchObserver(in IUserSwitchObserver observer);
416 int[] getRunningUserIds();
417
418 // Request a heap dump for the system server.
419 void requestSystemServerHeapDump();
420
421 void requestBugReport(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 */
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 */
448 void requestWifiBugReport(in String shareTitle, in String shareDescription);
449 void requestInteractiveBugReportWithDescription(in String shareTitle,
450 in String shareDescription);
451
452 void requestInteractiveBugReport();
453 void requestFullBugReport();
454 void requestRemoteBugReport(long nonce);
455 boolean launchBugReportHandlerApp();
456 List<String> getBugreportWhitelistedPackages();
457
458 @UnsupportedAppUsage
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
463 String getLaunchedFromPackage(in IBinder activityToken);
464 void killUid(int appId, int userId, in String reason);
465 void setUserIsMonkey(boolean monkey);
466 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
467 void hang(in IBinder who, boolean allowRestart);
468
469 List<ActivityTaskManager.RootTaskInfo> getAllRootTaskInfos();
470 void moveTaskToRootTask(int taskId, int rootTaskId, boolean toTop);
471 void setFocusedRootTask(int taskId);
472 ActivityTaskManager.RootTaskInfo getFocusedRootTaskInfo();
473 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
474 void restart();
475 void performIdleMaintenance();
476 void appNotRespondingViaProvider(in IBinder connection);
477 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
478 Rect getTaskBounds(int taskId);
479 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
480 boolean setProcessMemoryTrimLevel(in String process, int userId, int level);
481
482
483 // Start of L transactions
484 String getTagForIntentSender(in IIntentSender sender, in String prefix);
485 @UnsupportedAppUsage
486 boolean startUserInBackground(int userid);
487 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
488 boolean isInLockTaskMode();
489 @UnsupportedAppUsage
490 int startActivityFromRecents(int taskId, in Bundle options);
491 @UnsupportedAppUsage
492 void startSystemLockTaskMode(int taskId);
493 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
494 boolean isTopOfTask(in IBinder token);
495 void bootAnimationComplete();
496 @UnsupportedAppUsage
497 void registerTaskStackListener(in ITaskStackListener listener);
498 void unregisterTaskStackListener(in ITaskStackListener listener);
499 void notifyCleartextNetwork(int uid, in byte[] firstPacket);
500 @UnsupportedAppUsage
501 void setTaskResizeable(int taskId, int resizeableMode);
502 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
503 void resizeTask(int taskId, in Rect bounds, int resizeMode);
504 @UnsupportedAppUsage
505 int getLockTaskModeState();
506 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
507 void setDumpHeapDebugLimit(in String processName, int uid, long maxMemSize,
508 in String reportPackage);
509 void dumpHeapFinished(in String path);
510 void updateLockTaskPackages(int userId, in String[] packages);
511 void noteAlarmStart(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
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)
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)
523 boolean stopBinderTrackingAndDump(in ParcelFileDescriptor fd);
524
525 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
526 void suppressResizeConfigChanges(boolean suppress);
527 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
528 boolean unlockUser(int userid, in byte[] token, in byte[] secret,
529 in IProgressListener listener);
530 void killPackageDependents(in String packageName, int userId);
531 void makePackageIdle(String packageName, int userId);
532 int getMemoryTrimLevel();
533 boolean isVrModePackageEnabled(in ComponentName packageName);
534 void notifyLockedProfile(int userId);
535 void startConfirmDeviceCredentialIntent(in Intent intent, in Bundle options);
536 @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
537 void sendIdleJobTrigger();
538 int sendIntentSender(in IIntentSender target, in IBinder whitelistToken, int code,
539 in Intent intent, in String resolvedType, in IIntentReceiver finishedReceiver,
540 in String requiredPermission, in Bundle options);
541 boolean isBackgroundRestricted(in String packageName);
542
543 // Start of N MR1 transactions
544 void setRenderThread(int tid);
545 /**
546 * Lets activity manager know whether the calling process is currently showing "top-level" UI
547 * that is not an activity, i.e. windows on the screen the user is currently interacting with.
548 *
549 * <p>This flag can only be set for persistent processes.
550 *
551 * @param hasTopUi Whether the calling process has "top-level" UI.
552 */
553 void setHasTopUi(boolean hasTopUi);
554
555 // Start of O transactions
556 int restartUserInBackground(int userId);
557 /** Cancels the window transitions for the given task. */
558 @UnsupportedAppUsage
559 void cancelTaskWindowTransition(int taskId);
560 void scheduleApplicationInfoChanged(in List<String> packageNames, int userId);
561 void setPersistentVrThread(int tid);
562
563 void waitForNetworkStateUpdate(long procStateSeq);
564 /**
565 * Add a bare uid to the background restrictions whitelist. Only the system uid may call this.
566 */
567 void backgroundAllowlistUid(int uid);
568
569 // Start of P transactions
570 /**
571 * Similar to {@link #startUserInBackground(int userId), but with a listener to report
572 * user unlock progress.
573 */
574 boolean startUserInBackgroundWithListener(int userid, IProgressListener unlockProgressListener);
575
576 /**
577 * Method for the shell UID to start deletating its permission identity to an
578 * active instrumenation. The shell can delegate permissions only to one active
579 * instrumentation at a time. An active instrumentation is one running and
580 * started from the shell.
581 */
582 void startDelegateShellPermissionIdentity(int uid, in String[] permissions);
583
584 /**
585 * Method for the shell UID to stop deletating its permission identity to an
586 * active instrumenation. An active instrumentation is one running and
587 * started from the shell.
588 */
589 void stopDelegateShellPermissionIdentity();
590
591 /**
592 * Method for the shell UID to get currently adopted permissions for an active instrumentation.
593 * An active instrumentation is one running and started from the shell.
594 */
595 List<String> getDelegatedShellPermissions();
596
597 /** Returns a file descriptor that'll be closed when the system server process dies. */
598 ParcelFileDescriptor getLifeMonitor();
599
600 /**
601 * Start user, if it us not already running, and bring it to foreground.
602 * unlockProgressListener can be null if monitoring progress is not necessary.
603 */
604 boolean startUserInForegroundWithListener(int userid, IProgressListener unlockProgressListener);
605
606 /**
607 * Method for the app to tell system that it's wedged and would like to trigger an ANR.
608 */
609 void appNotResponding(String reason);
610
611 /**
612 * Return a list of {@link ApplicationExitInfo} records.
613 *
614 * <p class="note"> Note: System stores these historical information in a ring buffer, older
615 * records would be overwritten by newer records. </p>
616 *
617 * <p class="note"> Note: In the case that this application bound to an external service with
618 * flag {@link android.content.Context#BIND_EXTERNAL_SERVICE}, the process of that external
619 * service will be included in this package's exit info. </p>
620 *
621 * @param packageName Optional, an empty value means match all packages belonging to the
622 * caller's UID. If this package belongs to another UID, you must hold
623 * {@link android.Manifest.permission#DUMP} in order to retrieve it.
624 * @param pid Optional, it could be a process ID that used to belong to this package but
625 * died later; A value of 0 means to ignore this parameter and return all
626 * matching records.
627 * @param maxNum Optional, the maximum number of results should be returned; A value of 0
628 * means to ignore this parameter and return all matching records
629 * @param userId The userId in the multi-user environment.
630 *
631 * @return a list of {@link ApplicationExitInfo} records with the matching criteria, sorted in
632 * the order from most recent to least recent.
633 */
634 ParceledListSlice<ApplicationExitInfo> getHistoricalProcessExitReasons(String packageName,
635 int pid, int maxNum, int userId);
636
637 /*
638 * Kill the given PIDs, but the killing will be delayed until the device is idle
639 * and the given process is imperceptible.
640 */
641 void killProcessesWhenImperceptible(in int[] pids, String reason);
642
643 /**
644 * Set locus context for a given activity.
645 * @param activity
646 * @param locusId a unique, stable id that identifies this activity instance from others.
647 * @param appToken ActivityRecord's appToken.
648 */
649 void setActivityLocusContext(in ComponentName activity, in LocusId locusId,
650 in IBinder appToken);
651
652 /**
653 * Set custom state data for this process. It will be included in the record of
654 * {@link ApplicationExitInfo} on the death of the current calling process; the new process
655 * of the app can retrieve this state data by calling
656 * {@link ApplicationExitInfo#getProcessStateSummary} on the record returned by
657 * {@link #getHistoricalProcessExitReasons}.
658 *
659 * <p> This would be useful for the calling app to save its stateful data: if it's
660 * killed later for any reason, the new process of the app can know what the
661 * previous process of the app was doing. For instance, you could use this to encode
662 * the current level in a game, or a set of features/experiments that were enabled. Later you
663 * could analyze under what circumstances the app tends to crash or use too much memory.
664 * However, it's not suggested to rely on this to restore the applications previous UI state
665 * or so, it's only meant for analyzing application healthy status.</p>
666 *
667 * <p> System might decide to throttle the calls to this API; so call this API in a reasonable
668 * manner, excessive calls to this API could result a {@link java.lang.RuntimeException}.
669 * </p>
670 *
671 * @param state The customized state data
672 */
673 void setProcessStateSummary(in byte[] state);
674
675 /**
676 * Return whether the app freezer is supported (true) or not (false) by this system.
677 */
678 boolean isAppFreezerSupported();
679
680 /**
681 * Return whether the app freezer is enabled (true) or not (false) by this system.
682 */
683 boolean isAppFreezerEnabled();
684
685 /**
686 * Kills uid with the reason of permission change.
687 */
688 void killUidForPermissionChange(int appId, int userId, String reason);
689
690 /**
691 * Resets the state of the {@link com.android.server.am.AppErrors} instance.
692 * This is intended for testing within the CTS only and is protected by
693 * android.permission.RESET_APP_ERRORS.
694 */
695 void resetAppErrors();
696
697 /**
698 * Control the app freezer state. Returns true in case of success, false if the operation
699 * didn't succeed (for example, when the app freezer isn't supported).
700 * Handling the freezer state via this method is reentrant, that is it can be
701 * disabled and re-enabled multiple times in parallel. As long as there's a 1:1 disable to
702 * enable match, the freezer is re-enabled at last enable only.
703 * @param enable set it to true to enable the app freezer, false to disable it.
704 */
705 boolean enableAppFreezer(in boolean enable);
706
707 /**
708 * Suppress or reenable the rate limit on foreground service notification deferral.
709 * This is for use within CTS and is protected by android.permission.WRITE_DEVICE_CONFIG.
710 *
711 * @param enable false to suppress rate-limit policy; true to reenable it.
712 */
713 boolean enableFgsNotificationRateLimit(in boolean enable);
714
715 /**
716 * Holds the AM lock for the specified amount of milliseconds.
717 * This is intended for use by the tests that need to imitate lock contention.
718 * The token should be obtained by
719 * {@link android.content.pm.PackageManager#getHoldLockToken()}.
720 */
721 void holdLock(in IBinder token, in int durationMs);
722
723 /**
724 * Starts a profile.
725 * @param userId the user id of the profile.
726 * @return true if the profile has been successfully started or if the profile is already
727 * running, false if profile failed to start.
728 * @throws IllegalArgumentException if the user is not a profile.
729 */
730 boolean startProfile(int userId);
731
732 /**
733 * Stops a profile.
734 * @param userId the user id of the profile.
735 * @return true if the profile has been successfully stopped or is already stopped. Otherwise
736 * the exceptions listed below are thrown.
737 * @throws IllegalArgumentException if the user is not a profile.
738 */
739 boolean stopProfile(int userId);
740
741 /** Called by PendingIntent.queryIntentComponents() */
742 ParceledListSlice queryIntentComponentsForIntentSender(in IIntentSender sender, int matchFlags);
743
744 @JavaPassthrough(annotation=
745 "@android.annotation.RequiresPermission(allOf = {android.Manifest.permission.PACKAGE_USAGE_STATS, android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}, conditional = true)")
746 int getUidProcessCapabilities(int uid, in String callingPackage);
747
748 /** Blocks until all broadcast queues become idle. */
749 void waitForBroadcastIdle();
750
751 /**
752 * @return The reason code of whether or not the given UID should be exempted from background
753 * restrictions here.
754 *
755 * <p>
756 * Note: Call it with caution as it'll try to acquire locks in other services.
757 * </p>
758 */
759 int getBackgroundRestrictionExemptionReason(int uid);
760 }