Added in API level 21

SessionInfo


open class SessionInfo : Parcelable
kotlin.Any
   ↳ android.content.pm.PackageInstaller.SessionInfo

Details for an active install session.

Summary

Constants
static Int

A session ID that does not exist or is invalid.

static Int

Constant indicating that an error occurred during the activation phase of this session.

static Int

Constant indicating that the session was in conflict with another session and had to be sacrificed for resolution.

static Int

Constant indicating that no error occurred during the preparation or the activation of this session.

static Int

Constant indicating that an unknown error occurred while processing this session.

static Int

Constant indicating that an error occurred during the verification phase of this session.

static Int

static Int

static Int

static Int

static Int

Inherited constants
Public methods
open Intent?

Return an Intent that can be started to view details about this install session.

open Int

open Bitmap?

Return an icon representing the app being installed.

open CharSequence?

Return a label representing the app being installed.

open String?

Return the package name this session is working with.

open IntArray

Returns the set of session IDs that will be committed when this session is committed if this session is a multi-package session.

open Long

The timestamp of the initial creation of the session.

open Boolean

Get the value set in SessionParams#setDontKillApp(boolean).

open Int

Get the value set in SessionParams#setInstallLocation(int).

open Int

Return the reason for installing this package.

open String?

open String?

Return the package name of the app that owns this session.

open Int

Returns the Uid of the owner of the session.

open Int

Get the mode of the session as set in the constructor of the SessionParams.

open Int

Get the value set in SessionParams#setOriginatingUid(int).

open Uri?

Get the value set in SessionParams#setOriginatingUri(Uri).

open Int

Get the package source that was set in PackageInstaller.SessionParams#setPackageSource(int).

open Int

Returns the parent multi-package session ID if this session belongs to one, INVALID_ID otherwise.

open Float

Return current overall progress of this session, between 0 and 1.

open Uri?

Get the value set in SessionParams#setReferrerUri(Uri) Note: This value will only be non-null for the owner of the session.

open Int

Whether user action was required by the installer.

open Int

Return the ID for this session.

open Long

Get the value as set in SessionParams#setSize(long).

open Int

If something went wrong with a staged session, clients can check this error code to understand which kind of failure happened.

open String

Text description of the error code returned by getStagedSessionErrorCode, or empty string if no error was encountered.

open Long

The timestamp of the last update that occurred to the session, including changing of states in case of staged sessions.

open UserHandle

Return the user associated with this session.

open Boolean

Returns true if session has a valid parent session, otherwise false.

open Boolean

Return if this session is currently active.

open Boolean

Returns true if this session will keep the existing application enabled setting after installation.

open Boolean

Returns true if Session#commit(IntentSender)} was called for this session.

open Boolean

Returns true if this session is a multi-package session containing references to other sessions.

open Boolean

Returns whether this session has requested user pre-approval.

open Boolean

open Boolean

Return if this session is sealed.

open Boolean

Returns true if this session is a staged session.

open Boolean

Returns true if this session is an active staged session.

open Boolean

Whether the staged session has been applied successfully, meaning that all of its packages have been activated and no further action is required.

open Boolean

Whether something went wrong and the staged session is declared as failed, meaning that it will be ignored at next reboot.

open Boolean

Whether the staged session is ready to be applied at next reboot.

open Boolean

Returns true if the session is an unarchival.

open Unit
writeToParcel(dest: Parcel, flags: Int)

Properties
static Parcelable.Creator<PackageInstaller.SessionInfo!>!

Constants

INVALID_ID

Added in API level 29
static val INVALID_ID: Int

A session ID that does not exist or is invalid.

Value: -1

SESSION_ACTIVATION_FAILED

Added in API level 33
static val SESSION_ACTIVATION_FAILED: Int

Constant indicating that an error occurred during the activation phase of this session.

Value: 2

SESSION_CONFLICT

Added in API level 33
static val SESSION_CONFLICT: Int

Constant indicating that the session was in conflict with another session and had to be sacrificed for resolution.

Value: 4

SESSION_NO_ERROR

Added in API level 33
static val SESSION_NO_ERROR: Int

Constant indicating that no error occurred during the preparation or the activation of this session.

Value: 0

SESSION_UNKNOWN_ERROR

Added in API level 33
static val SESSION_UNKNOWN_ERROR: Int

Constant indicating that an unknown error occurred while processing this session.

Value: 3

SESSION_VERIFICATION_FAILED

Added in API level 33
static val SESSION_VERIFICATION_FAILED: Int

Constant indicating that an error occurred during the verification phase of this session.

Value: 1

STAGED_SESSION_ACTIVATION_FAILED

Added in API level 29
Deprecated in API level 33
static val STAGED_SESSION_ACTIVATION_FAILED: Int

Deprecated: use SESSION_ACTIVATION_FAILED.

Value: 2

STAGED_SESSION_CONFLICT

Added in API level 31
Deprecated in API level 33
static val STAGED_SESSION_CONFLICT: Int

Deprecated: use SESSION_CONFLICT.

Value: 4

STAGED_SESSION_NO_ERROR

Added in API level 29
Deprecated in API level 33
static val STAGED_SESSION_NO_ERROR: Int

Deprecated: use SESSION_NO_ERROR.

Value: 0

STAGED_SESSION_UNKNOWN

Added in API level 29
Deprecated in API level 33
static val STAGED_SESSION_UNKNOWN: Int

Deprecated: use SESSION_UNKNOWN_ERROR.

Value: 3

STAGED_SESSION_VERIFICATION_FAILED

Added in API level 29
Deprecated in API level 33
static val STAGED_SESSION_VERIFICATION_FAILED: Int

Deprecated: use SESSION_VERIFICATION_FAILED.

Value: 1

Public methods

createDetailsIntent

Added in API level 21
open fun createDetailsIntent(): Intent?

Return an Intent that can be started to view details about this install session. This may surface actions such as pause, resume, or cancel.

In some cases, a matching Activity may not exist, so ensure you safeguard against this.

Return
Intent? This value may be null.

describeContents

Added in API level 21
open 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

getAppIcon

Added in API level 21
open fun getAppIcon(): Bitmap?

Return an icon representing the app being installed. May be null if unavailable.

getAppLabel

Added in API level 21
open fun getAppLabel(): CharSequence?

Return a label representing the app being installed. May be null if unavailable.

getAppPackageName

Added in API level 21
open fun getAppPackageName(): String?

Return the package name this session is working with. May be null if unknown.

getChildSessionIds

Added in API level 29
open fun getChildSessionIds(): IntArray

Returns the set of session IDs that will be committed when this session is committed if this session is a multi-package session.

Return
IntArray This value cannot be null.

getCreatedMillis

Added in API level 30
open fun getCreatedMillis(): Long

The timestamp of the initial creation of the session.

getDontKillApp

Added in API level 34
open fun getDontKillApp(): Boolean

Get the value set in SessionParams#setDontKillApp(boolean).

getInstallLocation

Added in API level 27
open fun getInstallLocation(): Int

Get the value set in SessionParams#setInstallLocation(int).

getInstallReason

Added in API level 26
open fun getInstallReason(): Int

Return the reason for installing this package.

Return
Int The install reason. Value is android.content.pm.PackageManager#INSTALL_REASON_UNKNOWN, android.content.pm.PackageManager#INSTALL_REASON_POLICY, android.content.pm.PackageManager#INSTALL_REASON_DEVICE_RESTORE, android.content.pm.PackageManager#INSTALL_REASON_DEVICE_SETUP, android.content.pm.PackageManager#INSTALL_REASON_USER, or android.content.pm.PackageManager.INSTALL_REASON_ROLLBACK

getInstallerAttributionTag

Added in API level 31
open fun getInstallerAttributionTag(): String?
Return
String? attribution tag of the context that created this session This value may be null.

getInstallerPackageName

Added in API level 21
open fun getInstallerPackageName(): String?

Return the package name of the app that owns this session.

Return
String? This value may be null.

getInstallerUid

Added in API level 34
open fun getInstallerUid(): Int

Returns the Uid of the owner of the session.

getMode

Added in API level 27
open fun getMode(): Int

Get the mode of the session as set in the constructor of the SessionParams.

Return
Int One of SessionParams#MODE_FULL_INSTALL or SessionParams#MODE_INHERIT_EXISTING

getOriginatingUid

Added in API level 27
open fun getOriginatingUid(): Int

Get the value set in SessionParams#setOriginatingUid(int).

getOriginatingUri

Added in API level 27
open fun getOriginatingUri(): Uri?

Get the value set in SessionParams#setOriginatingUri(Uri). Note: This value will only be non-null for the owner of the session.

getParentSessionId

Added in API level 29
open fun getParentSessionId(): Int

Returns the parent multi-package session ID if this session belongs to one, INVALID_ID otherwise.

getProgress

Added in API level 21
open fun getProgress(): Float

Return current overall progress of this session, between 0 and 1.

Note that this progress may not directly correspond to the value reported by PackageInstaller.Session#setStagingProgress(float), as the system may carve out a portion of the overall progress to represent its own internal installation work.

getReferrerUri

Added in API level 27
open fun getReferrerUri(): Uri?

Get the value set in SessionParams#setReferrerUri(Uri) Note: This value will only be non-null for the owner of the session.

getRequireUserAction

Added in API level 31
open fun getRequireUserAction(): Int

Whether user action was required by the installer.

Note: a return value of USER_ACTION_NOT_REQUIRED does not guarantee that the install will not result in user action.

Return
Int SessionParams#USER_ACTION_NOT_REQUIRED, SessionParams#USER_ACTION_REQUIRED or SessionParams#USER_ACTION_UNSPECIFIED Value is android.content.pm.PackageInstaller.SessionParams#USER_ACTION_UNSPECIFIED, android.content.pm.PackageInstaller.SessionParams#USER_ACTION_REQUIRED, or android.content.pm.PackageInstaller.SessionParams#USER_ACTION_NOT_REQUIRED

getSessionId

Added in API level 21
open fun getSessionId(): Int

Return the ID for this session.

getSize

Added in API level 27
open fun getSize(): Long

Get the value as set in SessionParams#setSize(long).

The value is a hint and does not have to match the actual size.

getStagedSessionErrorCode

Added in API level 29
open fun getStagedSessionErrorCode(): Int

If something went wrong with a staged session, clients can check this error code to understand which kind of failure happened. Only meaningful if isStaged is true.

getStagedSessionErrorMessage

Added in API level 29
open fun getStagedSessionErrorMessage(): String

Text description of the error code returned by getStagedSessionErrorCode, or empty string if no error was encountered.

Return
String This value cannot be null.

getUpdatedMillis

Added in API level 29
open fun getUpdatedMillis(): Long

The timestamp of the last update that occurred to the session, including changing of states in case of staged sessions.
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.

getUser

Added in API level 29
open fun getUser(): UserHandle

Return the user associated with this session.

Return
UserHandle This value cannot be null.

hasParentSessionId

Added in API level 30
open fun hasParentSessionId(): Boolean

Returns true if session has a valid parent session, otherwise false.

isActive

Added in API level 21
open fun isActive(): Boolean

Return if this session is currently active.

A session is considered active whenever there is ongoing forward progress being made, such as the installer holding an open Session instance while streaming data into place, or the system optimizing code as the result of Session#commit(IntentSender).

If the installer closes the Session without committing, the session is considered inactive until the installer opens the session again.

isApplicationEnabledSettingPersistent

Added in API level 34
open fun isApplicationEnabledSettingPersistent(): Boolean

Returns true if this session will keep the existing application enabled setting after installation.

isCommitted

Added in API level 29
open fun isCommitted(): Boolean

Returns true if Session#commit(IntentSender)} was called for this session.

isMultiPackage

Added in API level 29
open fun isMultiPackage(): Boolean

Returns true if this session is a multi-package session containing references to other sessions.

isPreApprovalRequested

Added in API level 34
open fun isPreApprovalRequested(): Boolean

Returns whether this session has requested user pre-approval.

isRequestUpdateOwnership

Added in API level 34
open fun isRequestUpdateOwnership(): Boolean
Return
Boolean true if the installer requested the update ownership enforcement for the packages in this session.

isSealed

Added in API level 26
open fun isSealed(): Boolean

Return if this session is sealed.

Once sealed, no further changes may be made to the session. A session is sealed the moment Session#commit(IntentSender) is called.

isStaged

Added in API level 29
open fun isStaged(): Boolean

Returns true if this session is a staged session.

isStagedSessionActive

Added in API level 30
open fun isStagedSessionActive(): Boolean

Returns true if this session is an active staged session. We consider a session active if it has been committed and it is either pending verification, or will be applied at next reboot.

Staged session is active iff:

In case of a multi-package session, reasoning above is applied to the parent session, since that is the one that should have been committed.

isStagedSessionApplied

Added in API level 29
open fun isStagedSessionApplied(): Boolean

Whether the staged session has been applied successfully, meaning that all of its packages have been activated and no further action is required. Only meaningful if isStaged is true.

isStagedSessionFailed

Added in API level 29
open fun isStagedSessionFailed(): Boolean

Whether something went wrong and the staged session is declared as failed, meaning that it will be ignored at next reboot. Only meaningful if isStaged is true.

isStagedSessionReady

Added in API level 29
open fun isStagedSessionReady(): Boolean

Whether the staged session is ready to be applied at next reboot. Only meaningful if isStaged is true.

isUnarchival

Added in API level 35
open fun isUnarchival(): Boolean

Returns true if the session is an unarchival.

writeToParcel

Added in API level 21
open fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit
Parameters
dest Parcel: The Parcel in which the object should be written. 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

CREATOR

Added in API level 21
static val CREATOR: Parcelable.Creator<PackageInstaller.SessionInfo!>!