# Print output for @column tags ?> ApplicationExitInfo - Android SDK | Android Developers

Most visited

Recently visited

ApplicationExitInfo

public final class ApplicationExitInfo
extends Object implements Parcelable

java.lang.Object
   ↳ 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 ystem 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

int REASON_ANR

Application process was killed due to being unresponsive (ANR).

int REASON_CRASH

Application process died because of an unhandled exception in Java code.

int REASON_CRASH_NATIVE

Application process died because of a native code crash.

int REASON_DEPENDENCY_DIED

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.

int REASON_EXCESSIVE_RESOURCE_USAGE

Application process was killed by the system due to excessive resource usage.

int REASON_EXIT_SELF

Application process exit normally by itself, for example, via System.exit(int); getStatus() will specify the exit code.

int REASON_INITIALIZATION_FAILURE

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.

int REASON_LOW_MEMORY

Application process was killed by the system low memory killer, meaning the system was under memory pressure at the time of kill.

int REASON_OTHER

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.

int REASON_PERMISSION_CHANGE

Application process was killed due to a runtime permission change.

int REASON_SIGNALED

Application process died due to the result of an OS signal; for example, OsConstants.SIGKILL; getStatus() will specify the signal number.

int REASON_UNKNOWN

Application process died due to unknown reason.

int REASON_USER_REQUESTED

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.

int REASON_USER_STOPPED

Application process was killed, because the user it is running as on devices with mutlple users, was stopped.

Inherited constants

Fields

public static final Creator<ApplicationExitInfo> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

boolean equals(Object other)

Indicates whether some other object is "equal to" this one.

int getDefiningUid()

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 Context.BIND_EXTERNAL_SERVICE - in this case, this field here will be the kernel user identifier of the external service provider.

String getDescription()

The human readable description of the process's death, given by the system; could be null.

int getImportance()

The importance of the process that it used to have before the death.

int getPackageUid()

Similar to getRealUid(), it's the kernel user identifier that is assigned at the package installation time.

int getPid()

The process id of the process that died.

String getProcessName()

The actual process name it was running with.

byte[] getProcessStateSummary()

Return the state data set by calling ActivityManager.setProcessStateSummary(byte[]) from the process before its death.

long getPss()

Last proportional set size of the memory that the process had used in kB.

int getRealUid()

The kernel user identifier of the process, most of the time the system uses this to do access control checks.

int getReason()

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 getStatus()

The exit status argument of exit() if the application calls it, or the signal number if the application is signaled.

long getTimestamp()

The timestamp of the process's death, in milliseconds since the epoch, as returned by System.currentTimeMillis().

InputStream getTraceInputStream()

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.

UserHandle getUserHandle()

Return the user id of the record on a multi-user system.

int hashCode()

Returns a hash code value for the object.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

REASON_ANR

public static final int REASON_ANR

Application process was killed due to being unresponsive (ANR).

Constant Value: 6 (0x00000006)

REASON_CRASH

public static final int REASON_CRASH

Application process died because of an unhandled exception in Java code.

Constant Value: 4 (0x00000004)

REASON_CRASH_NATIVE

public static final int REASON_CRASH_NATIVE

Application process died because of a native code crash.

Constant Value: 5 (0x00000005)

REASON_DEPENDENCY_DIED

public static final int REASON_DEPENDENCY_DIED

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.

Constant Value: 12 (0x0000000c)

REASON_EXCESSIVE_RESOURCE_USAGE

public static final int REASON_EXCESSIVE_RESOURCE_USAGE

Application process was killed by the system due to excessive resource usage.

Constant Value: 9 (0x00000009)

REASON_EXIT_SELF

public static final int REASON_EXIT_SELF

Application process exit normally by itself, for example, via System.exit(int); getStatus() will specify the exit code.

Applications should normally not do this, as the system has a better knowledge in terms of process management.

Constant Value: 1 (0x00000001)

REASON_INITIALIZATION_FAILURE

public static final int REASON_INITIALIZATION_FAILURE

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.

Constant Value: 7 (0x00000007)

REASON_LOW_MEMORY

public static final int REASON_LOW_MEMORY

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 OsConstants.SIGKILL. Application should use ActivityManager.isLowMemoryKillReportSupported() to check if the device supports reporting REASON_LOW_MEMORY or not.

Constant Value: 3 (0x00000003)

REASON_OTHER

public static final int REASON_OTHER

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.

Constant Value: 13 (0x0000000d)

REASON_PERMISSION_CHANGE

public static final int REASON_PERMISSION_CHANGE

Application process was killed due to a runtime permission change.

Constant Value: 8 (0x00000008)

REASON_SIGNALED

public static final int REASON_SIGNALED

Application process died due to the result of an OS signal; for example, OsConstants.SIGKILL; getStatus() will specify the signal number.

Constant Value: 2 (0x00000002)

REASON_UNKNOWN

public static final int REASON_UNKNOWN

Application process died due to unknown reason.

Constant Value: 0 (0x00000000)

REASON_USER_REQUESTED

public static final int REASON_USER_REQUESTED

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.

Constant Value: 10 (0x0000000a)

REASON_USER_STOPPED

public static final int REASON_USER_STOPPED

Application process was killed, because the user it is running as on devices with mutlple users, was stopped.

Constant Value: 11 (0x0000000b)

Fields

CREATOR

public static final Creator<ApplicationExitInfo> CREATOR

Public methods

describeContents

public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

equals

public boolean equals (Object other)

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 return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.

Parameters
other Object: the reference object with which to compare.

Returns
boolean true if this object is the same as the obj argument; false otherwise.

getDefiningUid

public int getDefiningUid ()

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 Context.BIND_EXTERNAL_SERVICE - in this case, this field here will be the kernel user identifier of the external service provider.

Returns
int

getDescription

public String getDescription ()

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.

Returns
String

getImportance

public int getImportance ()

The importance of the process that it used to have before the death.

Returns
int Value is ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND, ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND_SERVICE, ActivityManager.RunningAppProcessInfo.IMPORTANCE_TOP_SLEEPING, ActivityManager.RunningAppProcessInfo.IMPORTANCE_VISIBLE, ActivityManager.RunningAppProcessInfo.IMPORTANCE_PERCEPTIBLE, ActivityManager.RunningAppProcessInfo.IMPORTANCE_CANT_SAVE_STATE, ActivityManager.RunningAppProcessInfo.IMPORTANCE_SERVICE, ActivityManager.RunningAppProcessInfo.IMPORTANCE_CACHED, or ActivityManager.RunningAppProcessInfo.IMPORTANCE_GONE

getPackageUid

public int getPackageUid ()

Similar to getRealUid(), it's the kernel user identifier that is assigned at the package installation time.

Returns
int

getPid

public int getPid ()

The process id of the process that died.

Returns
int

getProcessName

public String getProcessName ()

The actual process name it was running with.

Returns
String This value cannot be null.

getProcessStateSummary

public byte[] getProcessStateSummary ()

Return the state data set by calling ActivityManager.setProcessStateSummary(byte[]) from the process before its death.

Returns
byte[] The process-customized data This value may be null.

See also:

getPss

public long getPss ()

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.

Returns
long

getRealUid

public int getRealUid ()

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.

Returns
int

getReason

public int getReason ()

The reason code of the process's death.

Returns
int Value is REASON_UNKNOWN, REASON_EXIT_SELF, REASON_SIGNALED, REASON_LOW_MEMORY, REASON_CRASH, REASON_CRASH_NATIVE, REASON_ANR, REASON_INITIALIZATION_FAILURE, REASON_PERMISSION_CHANGE, REASON_EXCESSIVE_RESOURCE_USAGE, REASON_USER_REQUESTED, REASON_USER_STOPPED, REASON_DEPENDENCY_DIED, or REASON_OTHER

getRss

public long getRss ()

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.

Returns
long

getStatus

public int getStatus ()

The exit status argument of exit() if the application calls it, or the signal number if the application is signaled.

Returns
int

getTimestamp

public long getTimestamp ()

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.

Returns
long Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.

getTraceInputStream

public InputStream getTraceInputStream ()

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.

Returns
InputStream The input stream to the traces that was taken by the system prior to the death of the process. This value may be null.

Throws
IOException

getUserHandle

public UserHandle getUserHandle ()

Return the user id of the record on a multi-user system.

Returns
UserHandle This value cannot be null.

hashCode

public int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.)

Returns
int a hash code value for this object.

toString

public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

writeToParcel

public void writeToParcel (Parcel dest, 
                int flags)

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.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES