ApplicationExitInfo
class ApplicationExitInfo : Parcelable
| kotlin.Any | |
| ↳ | android.app.ApplicationExitInfo |
Describes the information of an application process's death.
Application process could die for many reasons, for example REASON_LOW_MEMORY when it was killed by the system because it was running low on memory. Reason of the death can be retrieved via getReason. Besides the reason, there are a few other auxiliary APIs like getStatus and getImportance to help the caller with additional diagnostic information.
Summary
| Constants | |
|---|---|
| static Int |
Application process was killed due to being unresponsive (ANR). |
| static Int |
Application process died because of an unhandled exception in Java code. |
| static Int |
Application process died because of a native code crash. |
| static Int |
Application process was killed because its dependency was going away, for example, a stable content provider connection's client will be killed if the provider is killed. |
| static Int |
Application process was killed by the system due to excessive resource usage. |
| static Int |
Application process exit normally by itself, for example, via |
| static Int |
Application process was killed by App Freezer, for example, because it receives sync binder transactions while being frozen. |
| static Int |
Application process was killed because of initialization failure, for example, it took too long to attach to the system during the start, or there was an error during initialization. |
| static Int |
Application process was killed by the system low memory killer, meaning the system was under memory pressure at the time of kill. |
| static Int |
Application process was killed by the system for various other reasons which are not by problems in apps and not actionable by apps, for example, the system just finished updates; |
| static Int |
Application process was killed because the app was disabled, or any of its component states have changed without |
| static Int |
Application process was killed because it was updated. |
| static Int |
Application process was killed due to a runtime permission change. |
| static Int |
Application process died due to the result of an OS signal; for example, |
| static Int |
Application process died due to unknown reason. |
| static Int |
Application process was killed because of the user request, for example, user clicked the "Force stop" button of the application in the Settings, or removed the application away from Recents. |
| static Int |
Application process was killed, because the user it is running as on devices with multiple users, was stopped. |
| Inherited constants | |
|---|---|
| Public methods | |
|---|---|
| Int | |
| Boolean |
Indicates whether some other object is "equal to" this one. |
| Int |
Return the defining kernel user identifier, maybe different from |
| String? |
The human readable description of the process's death, given by the system; could be null. |
| Int |
The importance of the process that it used to have before the death. |
| Int |
Similar to |
| Int |
getPid()The process id of the process that died. |
| String |
The actual process name it was running with. |
| ByteArray? |
Return the state data set by calling |
| Long |
getPss()Last proportional set size of the memory that the process had used in kB. |
| Int |
The kernel user identifier of the process, most of the time the system uses this to do access control checks. |
| Int |
The reason code of the process's death. |
| Long |
getRss()Last resident set size of the memory that the process had used in kB. |
| Int |
The exit status argument of exit() if the application calls it, or the signal number if the application is signaled. |
| Long |
The timestamp of the process's death, in milliseconds since the epoch, as returned by |
| InputStream? |
Return the InputStream to the traces that was taken by the system prior to the death of the process; typically it'll be available when the reason is |
| UserHandle |
Return the user id of the record on a multi-user system. |
| Int |
hashCode() |
| String |
toString() |
| Unit |
writeToParcel(dest: Parcel, flags: Int)Flatten this object in to a Parcel. |
| Properties | |
|---|---|
| static Parcelable.Creator<ApplicationExitInfo!> | |
Constants
REASON_ANR
static val REASON_ANR: Int
Application process was killed due to being unresponsive (ANR).
Value: 6REASON_CRASH
static val REASON_CRASH: Int
Application process died because of an unhandled exception in Java code.
Value: 4REASON_CRASH_NATIVE
static val REASON_CRASH_NATIVE: Int
Application process died because of a native code crash.
Value: 5REASON_DEPENDENCY_DIED
static val REASON_DEPENDENCY_DIED: Int
Application process was killed because its dependency was going away, for example, a stable content provider connection's client will be killed if the provider is killed.
Value: 12REASON_EXCESSIVE_RESOURCE_USAGE
static val REASON_EXCESSIVE_RESOURCE_USAGE: Int
Application process was killed by the system due to excessive resource usage.
Value: 9REASON_EXIT_SELF
static val REASON_EXIT_SELF: Int
Application process exit normally by itself, for example, via java.lang.System#exit; getStatus will specify the exit code.
Applications should normally not do this, as the system has a better knowledge in terms of process management.
Value: 1REASON_FREEZER
static val REASON_FREEZER: Int
Application process was killed by App Freezer, for example, because it receives sync binder transactions while being frozen.
Value: 14REASON_INITIALIZATION_FAILURE
static val REASON_INITIALIZATION_FAILURE: Int
Application process was killed because of initialization failure, for example, it took too long to attach to the system during the start, or there was an error during initialization.
Value: 7REASON_LOW_MEMORY
static val REASON_LOW_MEMORY: Int
Application process was killed by the system low memory killer, meaning the system was under memory pressure at the time of kill.
Not all devices support reporting REASON_LOW_MEMORY; on a device with no such support, when a process is killed due to memory pressure, the getReason will return REASON_SIGNALED and getStatus will return the value android.system.OsConstants#SIGKILL. Application should use ActivityManager.isLowMemoryKillReportSupported() to check if the device supports reporting REASON_LOW_MEMORY or not.
Value: 3REASON_OTHER
static val REASON_OTHER: Int
Application process was killed by the system for various other reasons which are not by problems in apps and not actionable by apps, for example, the system just finished updates; getDescription will specify the cause given by the system.
Value: 13REASON_PACKAGE_STATE_CHANGE
static val REASON_PACKAGE_STATE_CHANGE: Int
Application process was killed because the app was disabled, or any of its component states have changed without android.content.pm.PackageManager#DONT_KILL_APP
Prior to android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE, REASON_USER_REQUESTED was used to indicate that an app was updated.
Value: 15REASON_PACKAGE_UPDATED
static val REASON_PACKAGE_UPDATED: Int
Application process was killed because it was updated.
Prior to android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE, REASON_USER_REQUESTED was used to indicate that an app was updated.
Value: 16REASON_PERMISSION_CHANGE
static val REASON_PERMISSION_CHANGE: Int
Application process was killed due to a runtime permission change.
Value: 8REASON_SIGNALED
static val REASON_SIGNALED: Int
Application process died due to the result of an OS signal; for example, android.system.OsConstants#SIGKILL; getStatus will specify the signal number.
Value: 2REASON_UNKNOWN
static val REASON_UNKNOWN: Int
Application process died due to unknown reason.
Value: 0REASON_USER_REQUESTED
static val REASON_USER_REQUESTED: Int
Application process was killed because of the user request, for example, user clicked the "Force stop" button of the application in the Settings, or removed the application away from Recents.
Prior to android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE, one of the uses of this reason was to indicate that an app was killed due to it being updated or any of its component states have changed without android.content.pm.PackageManager#DONT_KILL_APP
Value: 10REASON_USER_STOPPED
static val REASON_USER_STOPPED: Int
Application process was killed, because the user it is running as on devices with multiple users, was stopped.
Value: 11Public methods
describeContents
fun describeContents(): Int
| Return | |
|---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
equals
fun equals(other: Any?): Boolean
Indicates whether some other object is "equal to" this one.
The equals method implements an equivalence relation on non-null object references:
- It is reflexive: for any non-null reference value
x,x.equals(x)should returntrue. - It is symmetric: for any non-null reference values
xandy,x.equals(y)should returntrueif and only ify.equals(x)returnstrue. - It is transitive: for any non-null reference values
x,y, andz, ifx.equals(y)returnstrueandy.equals(z)returnstrue, thenx.equals(z)should returntrue. - It is consistent: for any non-null reference values
xandy, multiple invocations ofx.equals(y)consistently returntrueor consistently returnfalse, provided no information used inequalscomparisons on the objects is modified. - For any non-null reference value
x,x.equals(null)should returnfalse.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| Parameters | |
|---|---|
obj |
the reference object with which to compare. |
other |
Any?: This value may be null. |
| Return | |
|---|---|
Boolean |
true if this object is the same as the obj argument; false otherwise. |
getDefiningUid
fun getDefiningUid(): Int
Return the defining kernel user identifier, maybe different from getRealUid and getPackageUid, if an external service has the android:useAppZygote set to true and was bound with the flag android.content.Context#BIND_EXTERNAL_SERVICE - in this case, this field here will be the kernel user identifier of the external service provider.
getDescription
fun getDescription(): String?
The human readable description of the process's death, given by the system; could be null.
Note: only intended to be human-readable and the system provides no guarantees that the format is stable across devices or Android releases.
getImportance
fun getImportance(): Int
The importance of the process that it used to have before the death.
getPackageUid
fun getPackageUid(): Int
Similar to getRealUid, it's the kernel user identifier that is assigned at the package installation time.
getProcessName
fun getProcessName(): String
The actual process name it was running with.
| Return | |
|---|---|
String |
This value cannot be null. |
getProcessStateSummary
fun getProcessStateSummary(): ByteArray?
Return the state data set by calling ActivityManager.setProcessStateSummary(byte[]) from the process before its death.
| Return | |
|---|---|
ByteArray? |
The process-customized data This value may be null. |
getPss
fun getPss(): Long
Last proportional set size of the memory that the process had used in kB.
Note: This is the value from last sampling on the process, it's NOT the exact memory information prior to its death; and it'll be zero if the process died before system had a chance to take the sample.
getRealUid
fun getRealUid(): Int
The kernel user identifier of the process, most of the time the system uses this to do access control checks. It's typically the uid of the package where the component is running from, except the case of isolated process, where this field identifies the kernel user identifier that this process is actually running with, while the getPackageUid identifies the kernel user identifier that is assigned at the package installation time.
getReason
fun getReason(): Int
The reason code of the process's death.
getRss
fun getRss(): Long
Last resident set size of the memory that the process had used in kB.
Note: This is the value from last sampling on the process, it's NOT the exact memory information prior to its death; and it'll be zero if the process died before system had a chance to take the sample.
getStatus
fun getStatus(): Int
The exit status argument of exit() if the application calls it, or the signal number if the application is signaled.
getTimestamp
fun getTimestamp(): Long
The timestamp of the process's death, in milliseconds since the epoch, as returned by System.currentTimeMillis().
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.
| Return | |
|---|---|
Long |
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z. |
getTraceInputStream
fun getTraceInputStream(): InputStream?
Return the InputStream to the traces that was taken by the system prior to the death of the process; typically it'll be available when the reason is REASON_ANR, though if the process gets an ANR but recovers, and dies for another reason later, this trace will be included in the record of ApplicationExitInfo still. Beginning with API 31, tombstone traces will be returned for REASON_CRASH_NATIVE, with an InputStream containing a protobuf with this schema. Note that because these traces are kept in a separate global circular buffer, crashes may be overwritten by newer crashes (including from other applications), so this may still return null.
| Return | |
|---|---|
InputStream? |
The input stream to the traces that was taken by the system prior to the death of the process. |
getUserHandle
fun getUserHandle(): UserHandle
Return the user id of the record on a multi-user system.
| Return | |
|---|---|
UserHandle |
This value cannot be null. |
toString
fun toString(): String
| Return | |
|---|---|
String |
a string representation of the object. |
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
dest |
Parcel: This value cannot be null. |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |