3

ApplicationExitInfo  |  Android Developers

 4 years ago
source link: https://developer.android.com/reference/kotlin/android/app/ApplicationExitInfo
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
ApplicationExitInfo  |  Android Developers
  • Android API Reference
  • Overview
  • Android Platform
  • Packages
    • Class Index
    • Package Index
    • android
    • android.accessibilityservice
    • android.accounts
    • android.animation
    • android.annotation
    • android.app
    • android.app.admin
    • android.app.appsearch
    • android.app.appsearch.exceptions
    • android.app.assist
    • android.app.backup
    • android.app.blob
    • android.app.job
    • android.app.people
    • android.app.role
    • android.app.slice
    • android.app.usage
    • android.appwidget
    • android.bluetooth
    • android.bluetooth.le
    • android.companion
    • android.content
    • android.content.pm
    • android.content.pm.verify.domain
    • android.content.res
    • android.content.res.loader
    • android.database
    • android.database.sqlite
    • android.drm
    • android.gesture
    • android.graphics
    • android.graphics.drawable
    • android.graphics.drawable.shapes
    • android.graphics.fonts
    • android.graphics.pdf
    • android.graphics.text
    • android.hardware
    • android.hardware.biometrics
    • android.hardware.camera2
    • android.hardware.camera2.params
    • android.hardware.display
    • android.hardware.fingerprint
    • android.hardware.input
    • android.hardware.lights
    • android.hardware.usb
    • android.icu.lang
    • android.icu.math
    • android.icu.number
    • android.icu.text
    • android.icu.util
    • android.inputmethodservice
    • android.location
    • android.location.provider
    • android.media
    • android.media.audiofx
    • android.media.browse
    • android.media.effect
    • android.media.metrics
    • android.media.midi
    • android.media.projection
    • android.media.session
    • android.media.tv
    • android.mtp
    • android.net
    • android.net.eap
    • android.net.http
    • android.net.ipsec.ike
    • android.net.ipsec.ike.exceptions
    • android.net.nsd
    • android.net.rtp
    • android.net.sip
    • android.net.ssl
    • android.net.vcn
    • android.net.wifi
    • android.net.wifi.aware
    • android.net.wifi.hotspot2
    • android.net.wifi.hotspot2.omadm
    • android.net.wifi.hotspot2.pps
    • android.net.wifi.p2p
    • android.net.wifi.p2p.nsd
    • android.net.wifi.rtt
    • android.nfc
    • android.nfc.cardemulation
    • android.nfc.tech
    • android.opengl
    • android.os
    • android.os.health
    • android.os.storage
    • android.os.strictmode
    • android.preference
    • android.print
    • android.print.pdf
    • android.printservice
    • android.provider
    • android.renderscript
    • android.sax
    • android.se.omapi
    • android.security
    • android.security.identity
    • android.security.keystore
    • android.service.autofill
    • android.service.carrier
    • android.service.chooser
    • android.service.controls
    • android.service.controls.actions
    • android.service.controls.templates
    • android.service.dreams
    • android.service.media
    • android.service.notification
    • android.service.quickaccesswallet
    • android.service.quicksettings
    • android.service.restrictions
    • android.service.textservice
    • android.service.voice
    • android.service.vr
    • android.service.wallpaper
    • android.speech
    • android.speech.tts
    • android.system
    • android.telecom
    • android.telephony
    • android.telephony.cdma
    • android.telephony.data
    • android.telephony.emergency
    • android.telephony.euicc
    • android.telephony.gsm
    • android.telephony.ims
    • android.telephony.ims.feature
    • android.telephony.mbms
    • android.test
    • android.test.mock
    • android.test.suitebuilder
    • android.test.suitebuilder.annotation
    • android.text
    • android.text.format
    • android.text.method
    • android.text.style
    • android.text.util
    • android.transition
    • android.util
    • android.util.proto
    • android.view
    • android.view.accessibility
    • android.view.animation
    • android.view.autofill
    • android.view.contentcapture
    • android.view.displayhash
    • android.view.inputmethod
    • android.view.inspector
    • android.view.textclassifier
    • android.view.textservice
    • android.webkit
    • android.widget
    • android.widget.inline
    • android.window
    • com.android.net.module.util
    • com.google.android.collect
    • com.google.android.gles_jni
    • com.google.android.util
    • dalvik.annotation
    • dalvik.bytecode
    • dalvik.system
    • java.awt.font
    • java.beans
    • java.io
    • java.lang
    • java.lang.annotation
    • java.lang.invoke
    • java.lang.ref
    • java.lang.reflect
    • java.math
    • java.net
    • java.nio
    • java.nio.channels
    • java.nio.channels.spi
    • java.nio.charset
    • java.nio.charset.spi
    • java.nio.file
    • java.nio.file.attribute
    • java.nio.file.spi
    • java.security
    • java.security.acl
    • java.security.cert
    • java.security.interfaces
    • java.security.spec
    • java.sql
    • java.text
    • java.time
    • java.time.chrono
    • java.time.format
    • java.time.temporal
    • java.time.zone
    • java.util
    • java.util.concurrent
    • java.util.concurrent.atomic
    • java.util.concurrent.locks
    • java.util.function
    • java.util.jar
    • java.util.logging
    • java.util.prefs
    • java.util.regex
    • java.util.stream
    • java.util.zip
    • javax.crypto
    • javax.crypto.interfaces
    • javax.crypto.spec
    • javax.microedition.khronos.egl
    • javax.microedition.khronos.opengles
    • javax.net
    • javax.net.ssl
    • javax.security.auth
    • javax.security.auth.callback
    • javax.security.auth.login
    • javax.security.auth.x500
    • javax.security.cert
    • javax.sql
    • javax.xml
    • javax.xml.datatype
    • javax.xml.namespace
    • javax.xml.parsers
    • javax.xml.transform
    • javax.xml.transform.dom
    • javax.xml.transform.sax
    • javax.xml.transform.stream
    • javax.xml.validation
    • javax.xml.xpath
    • junit.framework
    • junit.runner
    • org.apache.http.conn
    • org.apache.http.conn.scheme
    • org.apache.http.conn.ssl
    • org.apache.http.params
    • org.json
    • org.w3c.dom
    • org.w3c.dom.ls
    • org.xml.sax
    • org.xml.sax.ext
    • org.xml.sax.helpers
    • org.xmlpull.v1
    • org.xmlpull.v1.sax2

Android 12 Developer Preview is here! Try it out, and give us your feedback!

ApplicationExitInfo

class ApplicationExitInfo : Parcelable

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 java.lang.System#exit; getStatus will specify the exit code.

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; getDescription will specify the cause given by the system.

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, android.system.OsConstants#SIGKILL; getStatus will specify the signal number.

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 mutlple users, was stopped.

Inherited constants From class Parcelable
Public methods Int Boolean

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

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.

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 getRealUid, it's the kernel user identifier that is assigned at the package installation time.

Int

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 ActivityManager.setProcessStateSummary(byte[]) from the process before its death.

Long

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

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 System.currentTimeMillis().

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.

UserHandle

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

Int String Unit

Flatten this object in to a Parcel.

Constants

REASON_ANR

static val REASON_ANR: Int

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

Value: 6

REASON_CRASH

static val REASON_CRASH: Int

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

Value: 4

REASON_CRASH_NATIVE

static val REASON_CRASH_NATIVE: Int

Application process died because of a native code crash.

Value: 5

REASON_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: 12

REASON_EXCESSIVE_RESOURCE_USAGE

static val REASON_EXCESSIVE_RESOURCE_USAGE: Int

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

Value: 9

REASON_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: 1

REASON_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: 7

REASON_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: 3

REASON_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: 13

REASON_PERMISSION_CHANGE

static val REASON_PERMISSION_CHANGE: Int

Application process was killed due to a runtime permission change.

Value: 8

REASON_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: 2

REASON_UNKNOWN

static val REASON_UNKNOWN: Int

Application process died due to unknown reason.

Value: 0

REASON_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.

Value: 10

REASON_USER_STOPPED

static val REASON_USER_STOPPED: Int

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

Value: 11

Public 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 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 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.

getPackageUid

fun getPackageUid(): Int

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

getPid

fun getPid(): Int

The process id of the process that died.

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.

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 thatbecause 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.

hashCode

fun hashCode(): Int
Return Int a hash code value for this object.

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

Properties

Rate and review

Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2021-03-17 UTC.

  • Follow @AndroidDev on Twitter
  • Check out Android Developers on YouTube

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK