1/*
2 * Copyright (C) 2017 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
17syntax = "proto2";
18
19package android.app;
20
21option java_outer_classname = "AppProtoEnums";
22option java_multiple_files = true;
23
24// ActivityManagerInternal.java's APP_TRANSITION reasons.
25enum AppTransitionReasonEnum {
26    APP_TRANSITION_REASON_UNKNOWN = 0;
27    // The transition was started because we drew the splash screen.
28    APP_TRANSITION_SPLASH_SCREEN = 1;
29    // The transition was started because all app windows were drawn.
30    APP_TRANSITION_WINDOWS_DRAWN = 2;
31    // The transition was started because of a timeout.
32    APP_TRANSITION_TIMEOUT = 3;
33    // The transition was started because we drew a task snapshot.
34    APP_TRANSITION_SNAPSHOT = 4;
35    // The transition was started because it was a recents animation and we only needed to wait on
36    // the wallpaper.
37    APP_TRANSITION_RECENTS_ANIM = 5;
38}
39
40// ActivityManager.java PROCESS_STATEs
41// Next tag: 1021
42enum ProcessStateEnum {
43    // Unlike the ActivityManager PROCESS_STATE values, the ordering and numerical values
44    // here are completely fixed and arbitrary. Order is irrelevant.
45    // No attempt need be made to keep them in sync.
46    // The values here must not be modified. Any new process states can be appended to the end.
47
48    // Process state that is unknown to this proto file (i.e. is not mapped
49    // by ActivityManager.processStateAmToProto()). Can only happen if there's a bug in the mapping.
50    PROCESS_STATE_UNKNOWN_TO_PROTO = 998;
51    // Not a real process state.
52    PROCESS_STATE_UNKNOWN = 999;
53    // Process is a persistent system process.
54    PROCESS_STATE_PERSISTENT = 1000;
55    // Process is a persistent system process and is doing UI.
56    PROCESS_STATE_PERSISTENT_UI = 1001;
57    // Process is hosting the current top activities. Note that this covers
58    // all activities that are visible to the user.
59    PROCESS_STATE_TOP = 1002;
60    // Process is bound to a TOP app.
61    PROCESS_STATE_BOUND_TOP = 1020;
62    // Process is hosting a foreground service.
63    PROCESS_STATE_FOREGROUND_SERVICE = 1003;
64    // Process is hosting a service bound by the system or another foreground app.
65    PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 1004;
66    // Process is important to the user, and something they are aware of.
67    PROCESS_STATE_IMPORTANT_FOREGROUND = 1005;
68    // Process is important to the user, but not something they are aware of.
69    PROCESS_STATE_IMPORTANT_BACKGROUND = 1006;
70    // Process is in the background transient so we will try to keep running.
71    PROCESS_STATE_TRANSIENT_BACKGROUND = 1007;
72    // Process is in the background running a backup/restore operation.
73    PROCESS_STATE_BACKUP = 1008;
74    // Process is in the background running a service. Unlike oom_adj, this
75    // level is used for both the normal running in background state and the
76    // executing operations state.
77    PROCESS_STATE_SERVICE = 1009;
78    // Process is in the background running a receiver. Note that from the
79    // perspective of oom_adj, receivers run at a higher foreground level, but
80    // for our prioritization here that is not necessary and putting them
81    // below services means many fewer changes in some process states as they
82    // receive broadcasts.
83    PROCESS_STATE_RECEIVER = 1010;
84    // Same as PROCESS_STATE_TOP but while device is sleeping.
85    PROCESS_STATE_TOP_SLEEPING = 1011;
86    // Process is in the background, but it can't restore its state so we want
87    // to try to avoid killing it.
88    PROCESS_STATE_HEAVY_WEIGHT = 1012;
89    // Process is in the background but hosts the home activity.
90    PROCESS_STATE_HOME = 1013;
91    // Process is in the background but hosts the last shown activity.
92    PROCESS_STATE_LAST_ACTIVITY = 1014;
93    // Process is being cached for later use and contains activities.
94    PROCESS_STATE_CACHED_ACTIVITY = 1015;
95    // Process is being cached for later use and is a client of another cached
96    // process that contains activities.
97    PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 1016;
98    // Process is being cached for later use and has an activity that corresponds
99    // to an existing recent task.
100    PROCESS_STATE_CACHED_RECENT = 1017;
101    // Process is being cached for later use and is empty.
102    PROCESS_STATE_CACHED_EMPTY = 1018;
103    // Process does not exist.
104    PROCESS_STATE_NONEXISTENT = 1019;
105}
106
107// frameworks/base/services/core/java/com/android/server/am/OomAdjuster.java
108// Proto enum equivalents for "OomAdjReason"
109enum OomChangeReasonEnum {
110    OOM_ADJ_REASON_UNKNOWN_TO_PROTO = -1;
111    OOM_ADJ_REASON_NONE = 0;
112    OOM_ADJ_REASON_ACTIVITY = 1;
113    OOM_ADJ_REASON_FINISH_RECEIVER = 2;
114    OOM_ADJ_REASON_START_RECEIVER = 3;
115    OOM_ADJ_REASON_BIND_SERVICE = 4;
116    OOM_ADJ_REASON_UNBIND_SERVICE = 5;
117    OOM_ADJ_REASON_START_SERVICE = 6;
118    OOM_ADJ_REASON_GET_PROVIDER = 7;
119    OOM_ADJ_REASON_REMOVE_PROVIDER = 8;
120    OOM_ADJ_REASON_UI_VISIBILITY = 9;
121    OOM_ADJ_REASON_ALLOWLIST = 10;
122    OOM_ADJ_REASON_PROCESS_BEGIN = 11;
123    OOM_ADJ_REASON_PROCESS_END = 12;
124    OOM_ADJ_REASON_SHORT_FGS_TIMEOUT = 13;
125    OOM_ADJ_REASON_SYSTEM_INIT = 14;
126    OOM_ADJ_REASON_BACKUP = 15;
127    OOM_ADJ_REASON_SHELL = 16;
128    OOM_ADJ_REASON_REMOVE_TASK = 17;
129    OOM_ADJ_REASON_UID_IDLE = 18;
130    OOM_ADJ_REASON_STOP_SERVICE = 19;
131    OOM_ADJ_REASON_EXECUTING_SERVICE = 20;
132    OOM_ADJ_REASON_RESTRICTION_CHANGE = 21;
133    OOM_ADJ_REASON_COMPONENT_DISABLED = 22;
134    OOM_ADJ_REASON_FOLLOW_UP = 23;
135}
136
137// AppOpsManager.java - operation ids for logging
138enum AppOpEnum {
139    APP_OP_NONE = -1;
140    APP_OP_COARSE_LOCATION = 0;
141    APP_OP_FINE_LOCATION = 1;
142    APP_OP_GPS = 2;
143    APP_OP_VIBRATE = 3;
144    APP_OP_READ_CONTACTS = 4;
145    APP_OP_WRITE_CONTACTS = 5;
146    APP_OP_READ_CALL_LOG = 6;
147    APP_OP_WRITE_CALL_LOG = 7;
148    APP_OP_READ_CALENDAR = 8;
149    APP_OP_WRITE_CALENDAR = 9;
150    APP_OP_WIFI_SCAN = 10;
151    APP_OP_POST_NOTIFICATION = 11;
152    APP_OP_NEIGHBORING_CELLS = 12;
153    APP_OP_CALL_PHONE = 13;
154    APP_OP_READ_SMS = 14;
155    APP_OP_WRITE_SMS = 15;
156    APP_OP_RECEIVE_SMS = 16;
157    APP_OP_RECEIVE_EMERGENCY_SMS = 17;
158    APP_OP_RECEIVE_MMS = 18;
159    APP_OP_RECEIVE_WAP_PUSH = 19;
160    APP_OP_SEND_SMS = 20;
161    APP_OP_READ_ICC_SMS = 21;
162    APP_OP_WRITE_ICC_SMS = 22;
163    APP_OP_WRITE_SETTINGS = 23;
164    APP_OP_SYSTEM_ALERT_WINDOW = 24;
165    APP_OP_ACCESS_NOTIFICATIONS = 25;
166    APP_OP_CAMERA = 26;
167    APP_OP_RECORD_AUDIO = 27;
168    APP_OP_PLAY_AUDIO = 28;
169    APP_OP_READ_CLIPBOARD = 29;
170    APP_OP_WRITE_CLIPBOARD = 30;
171    APP_OP_TAKE_MEDIA_BUTTONS = 31;
172    APP_OP_TAKE_AUDIO_FOCUS = 32;
173    APP_OP_AUDIO_MASTER_VOLUME = 33;
174    APP_OP_AUDIO_VOICE_VOLUME = 34;
175    APP_OP_AUDIO_RING_VOLUME = 35;
176    APP_OP_AUDIO_MEDIA_VOLUME = 36;
177    APP_OP_AUDIO_ALARM_VOLUME = 37;
178    APP_OP_AUDIO_NOTIFICATION_VOLUME = 38;
179    APP_OP_AUDIO_BLUETOOTH_VOLUME = 39;
180    APP_OP_WAKE_LOCK = 40;
181    APP_OP_MONITOR_LOCATION = 41;
182    APP_OP_MONITOR_HIGH_POWER_LOCATION = 42;
183    APP_OP_GET_USAGE_STATS = 43;
184    APP_OP_MUTE_MICROPHONE = 44;
185    APP_OP_TOAST_WINDOW = 45;
186    APP_OP_PROJECT_MEDIA = 46;
187    APP_OP_ACTIVATE_VPN = 47;
188    APP_OP_WRITE_WALLPAPER = 48;
189    APP_OP_ASSIST_STRUCTURE = 49;
190    APP_OP_ASSIST_SCREENSHOT = 50;
191    APP_OP_READ_PHONE_STATE = 51;
192    APP_OP_ADD_VOICEMAIL = 52;
193    APP_OP_USE_SIP = 53;
194    APP_OP_PROCESS_OUTGOING_CALLS = 54;
195    APP_OP_USE_FINGERPRINT = 55;
196    APP_OP_BODY_SENSORS = 56;
197    APP_OP_READ_CELL_BROADCASTS = 57;
198    APP_OP_MOCK_LOCATION = 58;
199    APP_OP_READ_EXTERNAL_STORAGE = 59;
200    APP_OP_WRITE_EXTERNAL_STORAGE = 60;
201    APP_OP_TURN_SCREEN_ON = 61;
202    APP_OP_GET_ACCOUNTS = 62;
203    APP_OP_RUN_IN_BACKGROUND = 63;
204    APP_OP_AUDIO_ACCESSIBILITY_VOLUME = 64;
205    APP_OP_READ_PHONE_NUMBERS = 65;
206    APP_OP_REQUEST_INSTALL_PACKAGES = 66;
207    APP_OP_PICTURE_IN_PICTURE = 67;
208    APP_OP_INSTANT_APP_START_FOREGROUND = 68;
209    APP_OP_ANSWER_PHONE_CALLS = 69;
210    APP_OP_RUN_ANY_IN_BACKGROUND = 70;
211    APP_OP_CHANGE_WIFI_STATE = 71;
212    APP_OP_REQUEST_DELETE_PACKAGES = 72;
213    APP_OP_BIND_ACCESSIBILITY_SERVICE = 73;
214    APP_OP_ACCEPT_HANDOVER = 74;
215    APP_OP_MANAGE_IPSEC_TUNNELS = 75;
216    APP_OP_START_FOREGROUND = 76;
217    APP_OP_BLUETOOTH_SCAN = 77;
218    APP_OP_USE_BIOMETRIC = 78;
219    APP_OP_ACTIVITY_RECOGNITION = 79;
220    APP_OP_SMS_FINANCIAL_TRANSACTIONS = 80;
221    APP_OP_READ_MEDIA_AUDIO = 81;
222    APP_OP_WRITE_MEDIA_AUDIO = 82;
223    APP_OP_READ_MEDIA_VIDEO = 83;
224    APP_OP_WRITE_MEDIA_VIDEO = 84;
225    APP_OP_READ_MEDIA_IMAGES = 85;
226    APP_OP_WRITE_MEDIA_IMAGES = 86;
227    APP_OP_LEGACY_STORAGE = 87;
228    APP_OP_ACCESS_ACCESSIBILITY = 88;
229    APP_OP_READ_DEVICE_IDENTIFIERS = 89;
230    APP_OP_ACCESS_MEDIA_LOCATION = 90;
231    APP_OP_QUERY_ALL_PACKAGES = 91;
232    APP_OP_MANAGE_EXTERNAL_STORAGE = 92;
233    APP_OP_INTERACT_ACROSS_PROFILES = 93;
234    APP_OP_ACTIVATE_PLATFORM_VPN = 94;
235    APP_OP_LOADER_USAGE_STATS = 95;
236    APP_OP_DEPRECATED_1 = 96 [deprecated = true];
237    APP_OP_AUTO_REVOKE_PERMISSIONS_IF_UNUSED = 97;
238    APP_OP_AUTO_REVOKE_MANAGED_BY_INSTALLER = 98;
239    APP_OP_NO_ISOLATED_STORAGE = 99;
240    APP_OP_PHONE_CALL_MICROPHONE = 100;
241    APP_OP_PHONE_CALL_CAMERA = 101;
242    APP_OP_RECORD_AUDIO_HOTWORD = 102;
243    APP_OP_MANAGE_ONGOING_CALLS = 103;
244    APP_OP_MANAGE_CREDENTIALS = 104;
245    APP_OP_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER = 105;
246    APP_OP_RECORD_AUDIO_OUTPUT = 106;
247    APP_OP_SCHEDULE_EXACT_ALARM = 107;
248    APP_OP_FINE_LOCATION_SOURCE = 108;
249    APP_OP_COARSE_LOCATION_SOURCE = 109;
250    APP_OP_MANAGE_MEDIA = 110;
251    APP_OP_BLUETOOTH_CONNECT = 111;
252    APP_OP_UWB_RANGING = 112;
253    APP_OP_ACTIVITY_RECOGNITION_SOURCE = 113;
254    APP_OP_BLUETOOTH_ADVERTISE = 114;
255    APP_OP_RECORD_INCOMING_PHONE_AUDIO = 115;
256    APP_OP_NEARBY_WIFI_DEVICES = 116;
257    APP_OP_ESTABLISH_VPN_SERVICE = 117;
258    APP_OP_ESTABLISH_VPN_MANAGER = 118;
259    APP_OP_ACCESS_RESTRICTED_SETTINGS = 119;
260    APP_OP_RECEIVE_AMBIENT_TRIGGER_AUDIO = 120;
261    APP_OP_RECEIVE_EXPLICIT_USER_INTERACTION_AUDIO = 121;
262    APP_OP_RUN_USER_INITIATED_JOBS = 122;
263    APP_OP_READ_MEDIA_VISUAL_USER_SELECTED = 123;
264    APP_OP_SYSTEM_EXEMPT_FROM_SUSPENSION = 124;
265    APP_OP_SYSTEM_EXEMPT_FROM_DISMISSIBLE_NOTIFICATIONS = 125;
266    APP_OP_READ_WRITE_HEALTH_DATA = 126;
267    APP_OP_FOREGROUND_SERVICE_SPECIAL_USE = 127;
268    APP_OP_SYSTEM_EXEMPT_FROM_POWER_RESTRICTIONS = 128;
269    APP_OP_SYSTEM_EXEMPT_FROM_HIBERNATION = 129;
270    APP_OP_SYSTEM_EXEMPT_FROM_ACTIVITY_BG_START_RESTRICTION = 130;
271    APP_OP_CAPTURE_CONSENTLESS_BUGREPORT_ON_USERDEBUG_BUILD = 131;
272    APP_OP_BODY_SENSORS_WRIST_TEMPERATURE = 132 [deprecated = true];
273    APP_OP_USE_FULL_SCREEN_INTENT = 133;
274    APP_OP_CAMERA_SANDBOXED = 134;
275    APP_OP_RECORD_AUDIO_SANDBOXED = 135;
276    APP_OP_RECEIVE_SANDBOX_TRIGGER_AUDIO = 136;
277    APP_OP_RECEIVE_SANDBOXED_DETECTION_TRAINING_DATA = 137 [deprecated = true];
278    APP_OP_CREATE_ACCESSIBILITY_OVERLAY = 138;
279    APP_OP_MEDIA_ROUTING_CONTROL = 139;
280    APP_OP_ENABLE_MOBILE_DATA_BY_USER = 140;
281    APP_OP_RESERVED_FOR_TESTING = 141;
282    APP_OP_RAPID_CLEAR_NOTIFICATIONS_BY_LISTENER = 142;
283    APP_OP_READ_SYSTEM_GRAMMATICAL_GENDER = 143;
284    APP_OP_RUN_BACKUP_JOBS = 144 [deprecated = true];
285    APP_OP_ARCHIVE_ICON_OVERLAY = 145;
286    APP_OP_UNARCHIVAL_CONFIRMATION = 146;
287    APP_OP_EMERGENCY_LOCATION = 147;
288    APP_OP_RECEIVE_SENSITIVE_NOTIFICATIONS = 148;
289}
290
291/**
292 * The reason code that why app process is killed.
293 */
294enum AppExitReasonCode {
295    /**
296     * Application process died due to unknown reason.
297     */
298    REASON_UNKNOWN = 0;
299
300    /**
301     * Application process exit normally by itself, for example,
302     * via {@link android.os.Process#exit}; {@link #status} will specify the exit code.
303     *
304     * <p>Applications should normally not do this, as the system has a better knowledge
305     * in terms of process management.</p>
306     */
307    REASON_EXIT_SELF = 1;
308
309    /**
310     * Application process died due to the result of an OS signal; for example,
311     * {@link android.os.Process#SIGNAL_KILL}; {@link #status} will specify the signum.
312     */
313    REASON_SIGNALED = 2;
314
315    /**
316     * Application process was killed by the system low memory killer, meaning the system was
317     * under memory pressure at the time of kill.
318     */
319    REASON_LOW_MEMORY = 3;
320
321    /**
322     * Application process died because of an unhandled exception in Java code.
323     */
324    REASON_CRASH = 4;
325
326    /**
327     * Application process died because it's crashed due to a native code crash.
328     */
329    REASON_CRASH_NATIVE = 5;
330
331    /**
332     * Application process was killed due to being unresponsive (ANR).
333     */
334    REASON_ANR = 6;
335
336    /**
337     * Application process was killed because it took too long to attach to the system
338     * during the start.
339     */
340    REASON_INITIALIZATION_FAILURE = 7;
341
342    /**
343     * Application process was killed because of initialization failure,
344     * for example, it took too long to attach to the system during the start,
345     * or there was an error during initialization.
346     */
347    REASON_PERMISSION_CHANGE = 8;
348
349    /**
350     * Application process was killed by the activity manager due to excessive resource usage.
351     */
352    REASON_EXCESSIVE_RESOURCE_USAGE = 9;
353
354    /**
355     * Application process was killed because of the user request, for example,
356     * user clicked the "Force stop" button of the application in the Settings,
357     * or swiped away the application from Recents.
358     * <p>
359     * Prior to {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}, one of the uses of this
360     * reason was indicate that an app was killed due to it being updated or any of its component states
361     * have changed without {@link android.content.pm.PackageManager#DONT_KILL_APP}
362     */
363    REASON_USER_REQUESTED = 10;
364
365    /**
366     * Application process was killed, because the user they are running as on devices
367     * with mutlple users, was stopped.
368     */
369    REASON_USER_STOPPED = 11;
370
371    /**
372     * Application process was killed because its dependency was going away, for example,
373     * a stable content provider connection's client will be killed if the provider is killed.
374     */
375    REASON_DEPENDENCY_DIED = 12;
376
377    /**
378     * Application process was killed by the system for various other reasons,
379     * for example, the application package got disabled by the user;
380     * {@link #description} will specify the cause given by the system.
381     */
382    REASON_OTHER = 13;
383
384    /**
385     * Application process was killed by App Freezer, for example, because it receives
386     * sync binder transactions while being frozen.
387     */
388    REASON_FREEZER = 14;
389
390    /**
391     * Application process was killed because the app was uninstalled, disabled, or any of its
392     * component states have changed without {@link android.content.pm.PackageManager#DONT_KILL_APP}
393     * <p>
394     * Prior to {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
395     * {@link #REASON_USER_REQUESTED} was used to indicate that an app was updated.
396     */
397    REASON_PACKAGE_STATE_CHANGE = 15;
398
399    /**
400     * Application process was killed because it was updated.
401     * <p>
402     * Prior to {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE},
403     * {@link #REASON_USER_REQUESTED} was used to indicate that an app was updated.
404     */
405    REASON_PACKAGE_UPDATED = 16;
406}
407
408/**
409 * The supplemental reason code that why app process is killed
410 */
411enum AppExitSubReasonCode {
412    /**
413     * Application process kills subReason is unknown.
414     */
415    SUBREASON_UNKNOWN = 0;
416
417    /**
418     * Application process was killed because user quit it on the "wait for debugger" dialog.
419     */
420    SUBREASON_WAIT_FOR_DEBUGGER = 1;
421
422    /**
423     * Application process was killed by the activity manager because there were too many cached
424     * processes.
425     */
426    SUBREASON_TOO_MANY_CACHED = 2;
427
428    /**
429     * Application process was killed by the activity manager because there were too many empty
430     * processes.
431     */
432    SUBREASON_TOO_MANY_EMPTY = 3;
433
434    /**
435     * Application process was killed by the activity manager because there were too many cached
436     * processes and this process had been in empty state for a long time.
437     */
438    SUBREASON_TRIM_EMPTY = 4;
439
440    /**
441     * Application process was killed by the activity manager because system was on
442     * memory pressure and this process took large amount of cached memory.
443     */
444    SUBREASON_LARGE_CACHED = 5;
445
446    /**
447     * Application process was killed by the activity manager because the system was on
448     * low memory pressure for a significant amount of time since last idle.
449     */
450    SUBREASON_MEMORY_PRESSURE = 6;
451
452    /**
453     * Application process was killed by the activity manager due to excessive CPU usage.
454     */
455    SUBREASON_EXCESSIVE_CPU = 7;
456
457    /**
458     * System update has done (so the system update process should be killed).
459     */
460    SUBREASON_SYSTEM_UPDATE_DONE = 8;
461
462    /**
463     * Kill all foreground services, for now it only occurs when enabling the quiet
464     * mode for the managed profile.
465     */
466    SUBREASON_KILL_ALL_FG = 9;
467
468    /**
469     * All background processes except certain ones were killed, for now it only occurs
470     * when the density of the default display is changed.
471     */
472    SUBREASON_KILL_ALL_BG_EXCEPT = 10;
473
474    /**
475     * The process associated with the UID was explicitly killed, for example,
476     * it could be because of permission changes.
477     */
478    SUBREASON_KILL_UID = 11;
479
480    /**
481     * The process was explicitly killed with its PID, typically because of
482     * the low memory for surfaces.
483     */
484    SUBREASON_KILL_PID = 12;
485
486    /**
487     * The start of the process was invalid.
488     */
489    SUBREASON_INVALID_START = 13;
490
491    /**
492     * The process was killed because it's in an invalid state, typically
493     * it's triggered from SHELL.
494     */
495    SUBREASON_INVALID_STATE = 14;
496
497    /**
498     * The process was killed when it's imperceptible to user, because it was
499     * in a bad state.
500     */
501    SUBREASON_IMPERCEPTIBLE = 15;
502
503    /**
504     * The process was killed because it's being moved out from LRU list.
505     */
506    SUBREASON_REMOVE_LRU = 16;
507
508    /**
509     * The process was killed because it's isolated and was in a cached state.
510     */
511    SUBREASON_ISOLATED_NOT_NEEDED = 17;
512
513    /**
514     * The process was killed because it's in forced-app-standby state, and it's cached and
515     * its uid state is idle; this would be set only when the reason is {@link #REASON_OTHER}.
516     */
517    SUBREASON_CACHED_IDLE_FORCED_APP_STANDBY = 18;
518
519    /**
520     * The process was killed because it fails to freeze/unfreeze binder
521     * or query binder frozen info while being frozen.
522     */
523    SUBREASON_FREEZER_BINDER_IOCTL = 19;
524
525    /**
526     * The process was killed because it receives sync binder transactions
527     * while being frozen.
528     */
529    SUBREASON_FREEZER_BINDER_TRANSACTION = 20;
530
531    /**
532     * The process was killed because of force-stop, it could be due to that
533     * the user clicked the "Force stop" button of the application in the Settings;
534     * this would be set only when the reason is {@link #REASON_USER_REQUESTED}.
535     */
536    SUBREASON_FORCE_STOP = 21;
537
538    /**
539     * The process was killed because the user removed the application away from Recents;
540     * this would be set only when the reason is {@link #REASON_USER_REQUESTED}.
541     */
542    SUBREASON_REMOVE_TASK = 22;
543
544    /**
545     * The process was killed because the user stopped the application from the task manager;
546     * this would be set only when the reason is {@link #REASON_USER_REQUESTED}.
547     */
548    SUBREASON_STOP_APP = 23;
549
550    /**
551     * The process was killed because the user stopped the application from developer options,
552     * or via the adb shell commmand interface; this would be set only when the reason is
553     * {@link #REASON_USER_REQUESTED}.
554     */
555    SUBREASON_KILL_BACKGROUND = 24;
556
557    /**
558     * The process was killed because of package update; this would be set only when the reason is
559     * {@link #REASON_PACKAGE_STATE_CHANGE}.
560     *
561     * @deprecated starting {@link android.os.Build.VERSION_CODES#TIRAMISU},
562     * an app being killed due to a package update will have the reason
563     * {@link #REASON_PACKAGE_UPDATED}
564     */
565    SUBREASON_PACKAGE_UPDATE = 25;
566
567    /**
568     * The process was killed because of undelivered broadcasts; this would be set only when the
569     * reason is {@link #REASON_OTHER}.
570     */
571    SUBREASON_UNDELIVERED_BROADCAST = 26;
572
573    /**
574     * The process was killed because its associated SDK sandbox process (where it had loaded SDKs)
575     * had died; this would be set only when the reason is {@link #REASON_DEPENDENCY_DIED}.
576     */
577    SUBREASON_SDK_SANDBOX_DIED = 27;
578
579    /**
580     * The process was killed because it was an SDK sandbox process that was either not usable or
581     * was no longer being used; this would be set only when the reason is {@link #REASON_OTHER}.
582     */
583     SUBREASON_SDK_SANDBOX_NOT_NEEDED = 28;
584
585    /**
586     * The process was killed because the binder proxy limit for system server was exceeded.
587     */
588     SUBREASON_EXCESSIVE_BINDER_OBJECTS = 29;
589
590    /**
591     * The process was killed by the [kernel] Out-of-memory (OOM) killer; this
592     * would be set only when the reason is {@link #REASON_LOW_MEMORY}.
593     */
594    SUBREASON_OOM_KILL = 30;
595
596    /**
597     * The process was killed because its async kernel binder buffer is running out
598     * while being frozen.
599     */
600    SUBREASON_FREEZER_BINDER_ASYNC_FULL = 31;
601
602    /**
603     * The process was killed because it was sending too many broadcasts while it is in the
604     * Cached state.
605     */
606    SUBREASON_EXCESSIVE_OUTGOING_BROADCASTS_WHILE_CACHED = 32;
607}
608
609/**
610 * The relative importance level that the system places on a process.
611 * Keep sync with the definitions in
612 * {@link android.app.ActivityManager.RunningAppProcessInfo}
613 */
614enum Importance {
615    option allow_alias = true;
616
617    IMPORTANCE_FOREGROUND = 100;
618    IMPORTANCE_FOREGROUND_SERVICE = 125;
619    IMPORTANCE_TOP_SLEEPING_PRE_28 = 150;
620    IMPORTANCE_VISIBLE = 200;
621    IMPORTANCE_PERCEPTIBLE_PRE_26 = 130;
622    IMPORTANCE_PERCEPTIBLE = 230;
623    IMPORTANCE_CANT_SAVE_STATE_PRE_26 = 170;
624    IMPORTANCE_SERVICE = 300;
625    IMPORTANCE_TOP_SLEEPING = 325;
626    IMPORTANCE_CANT_SAVE_STATE = 350;
627    IMPORTANCE_CACHED = 400;
628    IMPORTANCE_BACKGROUND = 400;
629    IMPORTANCE_EMPTY = 500;
630    IMPORTANCE_GONE = 1000;
631}
632
633/**
634 * The Resource APIs that are monitored.
635 */
636enum ResourceApiEnum {
637
638  RESOURCE_API_NONE = 0;
639  RESOURCE_API_GET_VALUE = 1;
640  RESOURCE_API_RETRIEVE_ATTRIBUTES = 2;
641}
642
643/**
644 * The game modes used by GameManager.
645 *
646 * <p>Also see {@link android.app.GameManager#GameMode}.
647 */
648enum GameMode {
649    GAME_MODE_UNSPECIFIED = 0;
650    GAME_MODE_UNSUPPORTED = 1;
651    GAME_MODE_STANDARD = 2;
652    GAME_MODE_PERFORMANCE = 3;
653    GAME_MODE_BATTERY = 4;
654    GAME_MODE_CUSTOM = 5;
655}
656
657/**
658 * The result code of foreground service type policy check.
659 */
660enum FgsTypePolicyCheckEnum {
661    FGS_TYPE_POLICY_CHECK_UNKNOWN = 0;
662    FGS_TYPE_POLICY_CHECK_OK = 1;
663    FGS_TYPE_POLICY_CHECK_DEPRECATED = 2;
664    FGS_TYPE_POLICY_CHECK_DISABLED = 3;
665    FGS_TYPE_POLICY_CHECK_PERMISSION_DENIED_PERMISSIVE = 4;
666    FGS_TYPE_POLICY_CHECK_PERMISSION_DENIED_ENFORCED = 5;
667}
668
669/**
670 * The type of the component this process is hosting.
671 */
672enum HostingComponentType {
673    HOSTING_COMPONENT_TYPE_EMPTY = 0x0;
674    HOSTING_COMPONENT_TYPE_SYSTEM = 0x0001;
675    HOSTING_COMPONENT_TYPE_PERSISTENT = 0x0002;
676    HOSTING_COMPONENT_TYPE_BACKUP = 0x0004;
677    HOSTING_COMPONENT_TYPE_INSTRUMENTATION = 0x0008;
678    HOSTING_COMPONENT_TYPE_ACTIVITY = 0x0010;
679    HOSTING_COMPONENT_TYPE_BROADCAST_RECEIVER = 0x0020;
680    HOSTING_COMPONENT_TYPE_PROVIDER = 0x0040;
681    HOSTING_COMPONENT_TYPE_STARTED_SERVICE = 0x0080;
682    HOSTING_COMPONENT_TYPE_FOREGROUND_SERVICE = 0x0100;
683    HOSTING_COMPONENT_TYPE_BOUND_SERVICE = 0x0200;
684}
685
686/**
687 * Types of broadcast.
688 */
689enum BroadcastType {
690    BROADCAST_TYPE_NONE                           = 0;
691    BROADCAST_TYPE_BACKGROUND                     = 0x0001; // 1 << 0
692    BROADCAST_TYPE_FOREGROUND                     = 0x0002; // 1 << 1
693    BROADCAST_TYPE_ALARM                          = 0x0004; // 1 << 2
694    BROADCAST_TYPE_INTERACTIVE                    = 0x0008; // 1 << 3
695    BROADCAST_TYPE_ORDERED                        = 0x0010; // 1 << 4
696    BROADCAST_TYPE_PRIORITIZED                    = 0x0020; // 1 << 5
697    BROADCAST_TYPE_RESULT_TO                      = 0x0040; // 1 << 6
698    BROADCAST_TYPE_DEFERRABLE_UNTIL_ACTIVE        = 0x0080; // 1 << 7
699    BROADCAST_TYPE_PUSH_MESSAGE                   = 0x0100; // 1 << 8
700    BROADCAST_TYPE_PUSH_MESSAGE_OVER_QUOTA        = 0x0200; // 1 << 9
701    BROADCAST_TYPE_STICKY                         = 0x0400; // 1 << 10
702    BROADCAST_TYPE_INITIAL_STICKY                 = 0x0800; // 1 << 11
703}
704
705/**
706 * Delivery group policy applied to a broadcast.
707 * Keep it in sync with BroadcastOptions#DeliveryGroupPolicy.
708 */
709enum BroadcastDeliveryGroupPolicy {
710    BROADCAST_DELIVERY_GROUP_POLICY_ALL = 0;
711    BROADCAST_DELIVERY_GROUP_POLICY_MOST_RECENT = 1;
712    BROADCAST_DELIVERY_GROUP_POLICY_MERGED = 2;
713}
714
715/**
716 * Most recent state of startup.
717 */
718enum AppStartStartupState {
719    STARTUP_STATE_STARTED = 0;
720    STARTUP_STATE_ERROR = 1;
721    STARTUP_STATE_FIRST_FRAME_DRAWN = 2;
722}
723
724/**
725 * The reason code of what triggered the process's start.
726 */
727enum AppStartReasonCode {
728    START_REASON_ALARM = 0;
729    START_REASON_BACKUP = 1;
730    START_REASON_BOOT_COMPLETE = 2;
731    START_REASON_BROADCAST = 3;
732    START_REASON_CONTENT_PROVIDER = 4;
733    START_REASON_JOB = 5;
734    START_REASON_LAUNCHER = 6;
735    START_REASON_OTHER = 7;
736    START_REASON_PUSH = 8;
737    START_REASON_RESUMED_ACTIVITY = 9;
738    START_REASON_SERVICE = 10;
739    START_REASON_START_ACTIVITY = 11;
740}
741
742/**
743 * Type of process start.
744 */
745enum AppStartStartType {
746    START_TYPE_COLD = 0;
747    START_TYPE_WARM = 1;
748    START_TYPE_HOT = 2;
749}
750
751/**
752 * An instruction on how the activity should be launched.
753 */
754enum AppStartLaunchMode {
755    LAUNCH_MODE_STANDARD = 0;
756    LAUNCH_MODE_SINGLE_TOP = 1;
757    LAUNCH_MODE_SINGLE_INSTANCE = 2;
758    LAUNCH_MODE_SINGLE_TASK = 3;
759    LAUNCH_MODE_SINGLE_INSTANCE_PER_TASK = 4;
760}
761