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 OOM_ADJ_REASON_RECONFIGURATION = 24; 136} 137 138/** 139 * The reason code that why app process is killed. 140 */ 141enum AppExitReasonCode { 142 /** 143 * Application process died due to unknown reason. 144 */ 145 REASON_UNKNOWN = 0; 146 147 /** 148 * Application process exit normally by itself, for example, 149 * via {@link android.os.Process#exit}; {@link #status} will specify the exit code. 150 * 151 * <p>Applications should normally not do this, as the system has a better knowledge 152 * in terms of process management.</p> 153 */ 154 REASON_EXIT_SELF = 1; 155 156 /** 157 * Application process died due to the result of an OS signal; for example, 158 * {@link android.os.Process#SIGNAL_KILL}; {@link #status} will specify the signum. 159 */ 160 REASON_SIGNALED = 2; 161 162 /** 163 * Application process was killed by the system low memory killer, meaning the system was 164 * under memory pressure at the time of kill. 165 */ 166 REASON_LOW_MEMORY = 3; 167 168 /** 169 * Application process died because of an unhandled exception in Java code. 170 */ 171 REASON_CRASH = 4; 172 173 /** 174 * Application process died because it's crashed due to a native code crash. 175 */ 176 REASON_CRASH_NATIVE = 5; 177 178 /** 179 * Application process was killed due to being unresponsive (ANR). 180 */ 181 REASON_ANR = 6; 182 183 /** 184 * Application process was killed because it took too long to attach to the system 185 * during the start. 186 */ 187 REASON_INITIALIZATION_FAILURE = 7; 188 189 /** 190 * Application process was killed because of initialization failure, 191 * for example, it took too long to attach to the system during the start, 192 * or there was an error during initialization. 193 */ 194 REASON_PERMISSION_CHANGE = 8; 195 196 /** 197 * Application process was killed by the activity manager due to excessive resource usage. 198 */ 199 REASON_EXCESSIVE_RESOURCE_USAGE = 9; 200 201 /** 202 * Application process was killed because of the user request, for example, 203 * user clicked the "Force stop" button of the application in the Settings, 204 * or swiped away the application from Recents. 205 * <p> 206 * Prior to {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}, one of the uses of this 207 * reason was indicate that an app was killed due to it being updated or any of its component states 208 * have changed without {@link android.content.pm.PackageManager#DONT_KILL_APP} 209 */ 210 REASON_USER_REQUESTED = 10; 211 212 /** 213 * Application process was killed, because the user they are running as on devices 214 * with mutlple users, was stopped. 215 */ 216 REASON_USER_STOPPED = 11; 217 218 /** 219 * Application process was killed because its dependency was going away, for example, 220 * a stable content provider connection's client will be killed if the provider is killed. 221 */ 222 REASON_DEPENDENCY_DIED = 12; 223 224 /** 225 * Application process was killed by the system for various other reasons, 226 * for example, the application package got disabled by the user; 227 * {@link #description} will specify the cause given by the system. 228 */ 229 REASON_OTHER = 13; 230 231 /** 232 * Application process was killed by App Freezer, for example, because it receives 233 * sync binder transactions while being frozen. 234 */ 235 REASON_FREEZER = 14; 236 237 /** 238 * Application process was killed because the app was uninstalled, disabled, or any of its 239 * component states have changed without {@link android.content.pm.PackageManager#DONT_KILL_APP} 240 * <p> 241 * Prior to {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}, 242 * {@link #REASON_USER_REQUESTED} was used to indicate that an app was updated. 243 */ 244 REASON_PACKAGE_STATE_CHANGE = 15; 245 246 /** 247 * Application process was killed because it was updated. 248 * <p> 249 * Prior to {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}, 250 * {@link #REASON_USER_REQUESTED} was used to indicate that an app was updated. 251 */ 252 REASON_PACKAGE_UPDATED = 16; 253} 254 255/** 256 * The supplemental reason code that why app process is killed 257 */ 258enum AppExitSubReasonCode { 259 /** 260 * Application process kills subReason is unknown. 261 */ 262 SUBREASON_UNKNOWN = 0; 263 264 /** 265 * Application process was killed because user quit it on the "wait for debugger" dialog. 266 */ 267 SUBREASON_WAIT_FOR_DEBUGGER = 1; 268 269 /** 270 * Application process was killed by the activity manager because there were too many cached 271 * processes. 272 */ 273 SUBREASON_TOO_MANY_CACHED = 2; 274 275 /** 276 * Application process was killed by the activity manager because there were too many empty 277 * processes. 278 */ 279 SUBREASON_TOO_MANY_EMPTY = 3; 280 281 /** 282 * Application process was killed by the activity manager because there were too many cached 283 * processes and this process had been in empty state for a long time. 284 */ 285 SUBREASON_TRIM_EMPTY = 4; 286 287 /** 288 * Application process was killed by the activity manager because system was on 289 * memory pressure and this process took large amount of cached memory. 290 */ 291 SUBREASON_LARGE_CACHED = 5; 292 293 /** 294 * Application process was killed by the activity manager because the system was on 295 * low memory pressure for a significant amount of time since last idle. 296 */ 297 SUBREASON_MEMORY_PRESSURE = 6; 298 299 /** 300 * Application process was killed by the activity manager due to excessive CPU usage. 301 */ 302 SUBREASON_EXCESSIVE_CPU = 7; 303 304 /** 305 * System update has done (so the system update process should be killed). 306 */ 307 SUBREASON_SYSTEM_UPDATE_DONE = 8; 308 309 /** 310 * Kill all foreground services, for now it only occurs when enabling the quiet 311 * mode for the managed profile. 312 */ 313 SUBREASON_KILL_ALL_FG = 9; 314 315 /** 316 * All background processes except certain ones were killed, for now it only occurs 317 * when the density of the default display is changed. 318 */ 319 SUBREASON_KILL_ALL_BG_EXCEPT = 10; 320 321 /** 322 * The process associated with the UID was explicitly killed, for example, 323 * it could be because of permission changes. 324 */ 325 SUBREASON_KILL_UID = 11; 326 327 /** 328 * The process was explicitly killed with its PID, typically because of 329 * the low memory for surfaces. 330 */ 331 SUBREASON_KILL_PID = 12; 332 333 /** 334 * The start of the process was invalid. 335 */ 336 SUBREASON_INVALID_START = 13; 337 338 /** 339 * The process was killed because it's in an invalid state, typically 340 * it's triggered from SHELL. 341 */ 342 SUBREASON_INVALID_STATE = 14; 343 344 /** 345 * The process was killed when it's imperceptible to user, because it was 346 * in a bad state. 347 */ 348 SUBREASON_IMPERCEPTIBLE = 15; 349 350 /** 351 * The process was killed because it's being moved out from LRU list. 352 */ 353 SUBREASON_REMOVE_LRU = 16; 354 355 /** 356 * The process was killed because it's isolated and was in a cached state. 357 */ 358 SUBREASON_ISOLATED_NOT_NEEDED = 17; 359 360 /** 361 * The process was killed because it's in forced-app-standby state, and it's cached and 362 * its uid state is idle; this would be set only when the reason is {@link #REASON_OTHER}. 363 */ 364 SUBREASON_CACHED_IDLE_FORCED_APP_STANDBY = 18; 365 366 /** 367 * The process was killed because it fails to freeze/unfreeze binder 368 * or query binder frozen info while being frozen. 369 */ 370 SUBREASON_FREEZER_BINDER_IOCTL = 19; 371 372 /** 373 * The process was killed because it receives sync binder transactions 374 * while being frozen. 375 */ 376 SUBREASON_FREEZER_BINDER_TRANSACTION = 20; 377 378 /** 379 * The process was killed because of force-stop, it could be due to that 380 * the user clicked the "Force stop" button of the application in the Settings; 381 * this would be set only when the reason is {@link #REASON_USER_REQUESTED}. 382 */ 383 SUBREASON_FORCE_STOP = 21; 384 385 /** 386 * The process was killed because the user removed the application away from Recents; 387 * this would be set only when the reason is {@link #REASON_USER_REQUESTED}. 388 */ 389 SUBREASON_REMOVE_TASK = 22; 390 391 /** 392 * The process was killed because the user stopped the application from the task manager; 393 * this would be set only when the reason is {@link #REASON_USER_REQUESTED}. 394 */ 395 SUBREASON_STOP_APP = 23; 396 397 /** 398 * The process was killed because the user stopped the application from developer options, 399 * or via the adb shell commmand interface; this would be set only when the reason is 400 * {@link #REASON_USER_REQUESTED}. 401 */ 402 SUBREASON_KILL_BACKGROUND = 24; 403 404 /** 405 * The process was killed because of package update; this would be set only when the reason is 406 * {@link #REASON_PACKAGE_STATE_CHANGE}. 407 * 408 * @deprecated starting {@link android.os.Build.VERSION_CODES#TIRAMISU}, 409 * an app being killed due to a package update will have the reason 410 * {@link #REASON_PACKAGE_UPDATED} 411 */ 412 SUBREASON_PACKAGE_UPDATE = 25; 413 414 /** 415 * The process was killed because of undelivered broadcasts; this would be set only when the 416 * reason is {@link #REASON_OTHER}. 417 */ 418 SUBREASON_UNDELIVERED_BROADCAST = 26; 419 420 /** 421 * The process was killed because its associated SDK sandbox process (where it had loaded SDKs) 422 * had died; this would be set only when the reason is {@link #REASON_DEPENDENCY_DIED}. 423 */ 424 SUBREASON_SDK_SANDBOX_DIED = 27; 425 426 /** 427 * The process was killed because it was an SDK sandbox process that was either not usable or 428 * was no longer being used; this would be set only when the reason is {@link #REASON_OTHER}. 429 */ 430 SUBREASON_SDK_SANDBOX_NOT_NEEDED = 28; 431 432 /** 433 * The process was killed because the binder proxy limit for system server was exceeded. 434 */ 435 SUBREASON_EXCESSIVE_BINDER_OBJECTS = 29; 436 437 /** 438 * The process was killed by the [kernel] Out-of-memory (OOM) killer; this 439 * would be set only when the reason is {@link #REASON_LOW_MEMORY}. 440 */ 441 SUBREASON_OOM_KILL = 30; 442 443 /** 444 * The process was killed because its async kernel binder buffer is running out 445 * while being frozen. 446 */ 447 SUBREASON_FREEZER_BINDER_ASYNC_FULL = 31; 448 449 /** 450 * The process was killed because it was sending too many broadcasts while it is in the 451 * Cached state. 452 */ 453 SUBREASON_EXCESSIVE_OUTGOING_BROADCASTS_WHILE_CACHED = 32; 454} 455 456/** 457 * The relative importance level that the system places on a process. 458 * Keep sync with the definitions in 459 * {@link android.app.ActivityManager.RunningAppProcessInfo} 460 */ 461enum Importance { 462 option allow_alias = true; 463 464 IMPORTANCE_FOREGROUND = 100; 465 IMPORTANCE_FOREGROUND_SERVICE = 125; 466 IMPORTANCE_TOP_SLEEPING_PRE_28 = 150; 467 IMPORTANCE_VISIBLE = 200; 468 IMPORTANCE_PERCEPTIBLE_PRE_26 = 130; 469 IMPORTANCE_PERCEPTIBLE = 230; 470 IMPORTANCE_CANT_SAVE_STATE_PRE_26 = 170; 471 IMPORTANCE_SERVICE = 300; 472 IMPORTANCE_TOP_SLEEPING = 325; 473 IMPORTANCE_CANT_SAVE_STATE = 350; 474 IMPORTANCE_CACHED = 400; 475 IMPORTANCE_BACKGROUND = 400; 476 IMPORTANCE_EMPTY = 500; 477 IMPORTANCE_GONE = 1000; 478} 479 480/** 481 * The Resource APIs that are monitored. 482 */ 483enum ResourceApiEnum { 484 485 RESOURCE_API_NONE = 0; 486 RESOURCE_API_GET_VALUE = 1; 487 RESOURCE_API_RETRIEVE_ATTRIBUTES = 2; 488} 489 490/** 491 * The game modes used by GameManager. 492 * 493 * <p>Also see {@link android.app.GameManager#GameMode}. 494 */ 495enum GameMode { 496 GAME_MODE_UNSPECIFIED = 0; 497 GAME_MODE_UNSUPPORTED = 1; 498 GAME_MODE_STANDARD = 2; 499 GAME_MODE_PERFORMANCE = 3; 500 GAME_MODE_BATTERY = 4; 501 GAME_MODE_CUSTOM = 5; 502} 503 504/** 505 * The result code of foreground service type policy check. 506 */ 507enum FgsTypePolicyCheckEnum { 508 FGS_TYPE_POLICY_CHECK_UNKNOWN = 0; 509 FGS_TYPE_POLICY_CHECK_OK = 1; 510 FGS_TYPE_POLICY_CHECK_DEPRECATED = 2; 511 FGS_TYPE_POLICY_CHECK_DISABLED = 3; 512 FGS_TYPE_POLICY_CHECK_PERMISSION_DENIED_PERMISSIVE = 4; 513 FGS_TYPE_POLICY_CHECK_PERMISSION_DENIED_ENFORCED = 5; 514} 515 516/** 517 * The type of the component this process is hosting. 518 */ 519enum HostingComponentType { 520 HOSTING_COMPONENT_TYPE_EMPTY = 0x0; 521 HOSTING_COMPONENT_TYPE_SYSTEM = 0x0001; 522 HOSTING_COMPONENT_TYPE_PERSISTENT = 0x0002; 523 HOSTING_COMPONENT_TYPE_BACKUP = 0x0004; 524 HOSTING_COMPONENT_TYPE_INSTRUMENTATION = 0x0008; 525 HOSTING_COMPONENT_TYPE_ACTIVITY = 0x0010; 526 HOSTING_COMPONENT_TYPE_BROADCAST_RECEIVER = 0x0020; 527 HOSTING_COMPONENT_TYPE_PROVIDER = 0x0040; 528 HOSTING_COMPONENT_TYPE_STARTED_SERVICE = 0x0080; 529 HOSTING_COMPONENT_TYPE_FOREGROUND_SERVICE = 0x0100; 530 HOSTING_COMPONENT_TYPE_BOUND_SERVICE = 0x0200; 531} 532 533/** 534 * Types of broadcast. 535 */ 536enum BroadcastType { 537 BROADCAST_TYPE_NONE = 0; 538 BROADCAST_TYPE_BACKGROUND = 0x0001; // 1 << 0 539 BROADCAST_TYPE_FOREGROUND = 0x0002; // 1 << 1 540 BROADCAST_TYPE_ALARM = 0x0004; // 1 << 2 541 BROADCAST_TYPE_INTERACTIVE = 0x0008; // 1 << 3 542 BROADCAST_TYPE_ORDERED = 0x0010; // 1 << 4 543 BROADCAST_TYPE_PRIORITIZED = 0x0020; // 1 << 5 544 BROADCAST_TYPE_RESULT_TO = 0x0040; // 1 << 6 545 BROADCAST_TYPE_DEFERRABLE_UNTIL_ACTIVE = 0x0080; // 1 << 7 546 BROADCAST_TYPE_PUSH_MESSAGE = 0x0100; // 1 << 8 547 BROADCAST_TYPE_PUSH_MESSAGE_OVER_QUOTA = 0x0200; // 1 << 9 548 BROADCAST_TYPE_STICKY = 0x0400; // 1 << 10 549 BROADCAST_TYPE_INITIAL_STICKY = 0x0800; // 1 << 11 550} 551 552/** 553 * Delivery group policy applied to a broadcast. 554 * Keep it in sync with BroadcastOptions#DeliveryGroupPolicy. 555 */ 556enum BroadcastDeliveryGroupPolicy { 557 BROADCAST_DELIVERY_GROUP_POLICY_ALL = 0; 558 BROADCAST_DELIVERY_GROUP_POLICY_MOST_RECENT = 1; 559 BROADCAST_DELIVERY_GROUP_POLICY_MERGED = 2; 560} 561 562/** 563 * Most recent state of startup. 564 */ 565enum AppStartStartupState { 566 STARTUP_STATE_STARTED = 0; 567 STARTUP_STATE_ERROR = 1; 568 STARTUP_STATE_FIRST_FRAME_DRAWN = 2; 569} 570 571/** 572 * The reason code of what triggered the process's start. 573 */ 574enum AppStartReasonCode { 575 START_REASON_ALARM = 0; 576 START_REASON_BACKUP = 1; 577 START_REASON_BOOT_COMPLETE = 2; 578 START_REASON_BROADCAST = 3; 579 START_REASON_CONTENT_PROVIDER = 4; 580 START_REASON_JOB = 5; 581 START_REASON_LAUNCHER = 6; 582 START_REASON_OTHER = 7; 583 START_REASON_PUSH = 8; 584 START_REASON_RESUMED_ACTIVITY = 9; 585 START_REASON_SERVICE = 10; 586 START_REASON_START_ACTIVITY = 11; 587} 588 589/** 590 * Type of process start. 591 */ 592enum AppStartStartType { 593 START_TYPE_COLD = 0; 594 START_TYPE_WARM = 1; 595 START_TYPE_HOT = 2; 596} 597 598/** 599 * An instruction on how the activity should be launched. 600 */ 601enum AppStartLaunchMode { 602 LAUNCH_MODE_STANDARD = 0; 603 LAUNCH_MODE_SINGLE_TOP = 1; 604 LAUNCH_MODE_SINGLE_INSTANCE = 2; 605 LAUNCH_MODE_SINGLE_TASK = 3; 606 LAUNCH_MODE_SINGLE_INSTANCE_PER_TASK = 4; 607} 608