# Print output for @column tags ?> PackageInstaller.SessionInfo - Android SDK | Android Developers

Most visited

Recently visited

PackageInstaller.SessionInfo

public static class PackageInstaller.SessionInfo
extends Object implements Parcelable

java.lang.Object
   ↳ android.content.pm.PackageInstaller.SessionInfo


Details for an active install session.

Summary

Constants

int INVALID_ID

A session ID that does not exist or is invalid.

int STAGED_SESSION_ACTIVATION_FAILED

Constant indicating that an error occurred during the activation phase (post-reboot) of this staged session.

int STAGED_SESSION_NO_ERROR

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

int STAGED_SESSION_UNKNOWN

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

int STAGED_SESSION_VERIFICATION_FAILED

Constant indicating that an error occurred during the verification phase (pre-reboot) of this staged session.

Inherited constants

Fields

public static final Creator<PackageInstaller.SessionInfo> CREATOR

Public methods

Intent createDetailsIntent()

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

int describeContents()

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

Bitmap getAppIcon()

Return an icon representing the app being installed.

CharSequence getAppLabel()

Return a label representing the app being installed.

String getAppPackageName()

Return the package name this session is working with.

int[] getChildSessionIds()

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

long getCreatedMillis()

The timestamp of the initial creation of the session.

int getInstallLocation()

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

int getInstallReason()

Return the reason for installing this package.

String getInstallerPackageName()

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

int getMode()

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

int getOriginatingUid()

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

Uri getOriginatingUri()

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

int getParentSessionId()

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

float getProgress()

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

Uri getReferrerUri()

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

int getSessionId()

Return the ID for this session.

long getSize()

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

int getStagedSessionErrorCode()

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

String getStagedSessionErrorMessage()

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

long getUpdatedMillis()

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

UserHandle getUser()

Return the user associated with this session.

boolean hasParentSessionId()

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

boolean isActive()

Return if this session is currently active.

boolean isCommitted()

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

boolean isMultiPackage()

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

boolean isSealed()

Return if this session is sealed.

boolean isStaged()

Returns true if this session is a staged session.

boolean isStagedSessionActive()

Returns true if this session is an active staged session.

boolean isStagedSessionApplied()

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

boolean isStagedSessionFailed()

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

boolean isStagedSessionReady()

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

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

INVALID_ID

public static final int INVALID_ID

A session ID that does not exist or is invalid.

Constant Value: -1 (0xffffffff)

STAGED_SESSION_ACTIVATION_FAILED

public static final int STAGED_SESSION_ACTIVATION_FAILED

Constant indicating that an error occurred during the activation phase (post-reboot) of this staged session.

Constant Value: 2 (0x00000002)

STAGED_SESSION_NO_ERROR

public static final int STAGED_SESSION_NO_ERROR

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

Constant Value: 0 (0x00000000)

STAGED_SESSION_UNKNOWN

public static final int STAGED_SESSION_UNKNOWN

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

Constant Value: 3 (0x00000003)

STAGED_SESSION_VERIFICATION_FAILED

public static final int STAGED_SESSION_VERIFICATION_FAILED

Constant indicating that an error occurred during the verification phase (pre-reboot) of this staged session.

Constant Value: 1 (0x00000001)

Fields

CREATOR

public static final Creator<PackageInstaller.SessionInfo> CREATOR

Public methods

createDetailsIntent

public Intent createDetailsIntent ()

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.

Returns
Intent This value may be null.

See also:

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

getAppIcon

public Bitmap getAppIcon ()

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

Returns
Bitmap

getAppLabel

public CharSequence getAppLabel ()

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

Returns
CharSequence

getAppPackageName

public String getAppPackageName ()

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

Returns
String

getChildSessionIds

public int[] getChildSessionIds ()

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

Returns
int[] This value cannot be null.

getCreatedMillis

public long getCreatedMillis ()

The timestamp of the initial creation of the session.

Returns
long

getInstallLocation

public int getInstallLocation ()

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

Returns
int

getInstallReason

public int getInstallReason ()

Return the reason for installing this package.

Returns
int The install reason. Value is PackageManager.INSTALL_REASON_UNKNOWN, PackageManager.INSTALL_REASON_POLICY, PackageManager.INSTALL_REASON_DEVICE_RESTORE, PackageManager.INSTALL_REASON_DEVICE_SETUP, PackageManager.INSTALL_REASON_USER, or android.content.pm.PackageManager.INSTALL_REASON_ROLLBACK

getInstallerPackageName

public String getInstallerPackageName ()

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

Returns
String This value may be null.

getMode

public int getMode ()

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

Returns
int One of SessionParams#MODE_FULL_INSTALL or SessionParams#MODE_INHERIT_EXISTING

getOriginatingUid

public int getOriginatingUid ()

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

Returns
int

getOriginatingUri

public Uri getOriginatingUri ()

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

Returns
Uri

getParentSessionId

public int getParentSessionId ()

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

Returns
int

getProgress

public float getProgress ()

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.

Returns
float

getReferrerUri

public Uri getReferrerUri ()

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

Returns
Uri

getSessionId

public int getSessionId ()

Return the ID for this session.

Returns
int

getSize

public long getSize ()

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

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

Returns
long

getStagedSessionErrorCode

public int getStagedSessionErrorCode ()

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.

Returns
int Value is STAGED_SESSION_NO_ERROR, STAGED_SESSION_VERIFICATION_FAILED, STAGED_SESSION_ACTIVATION_FAILED, or STAGED_SESSION_UNKNOWN

getStagedSessionErrorMessage

public String getStagedSessionErrorMessage ()

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

Returns
String This value cannot be null.

getUpdatedMillis

public long getUpdatedMillis ()

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.

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

getUser

public UserHandle getUser ()

Return the user associated with this session.

Returns
UserHandle This value cannot be null.

hasParentSessionId

public boolean hasParentSessionId ()

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

Returns
boolean

isActive

public boolean isActive ()

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.

Returns
boolean

isCommitted

public boolean isCommitted ()

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

Returns
boolean

isMultiPackage

public boolean isMultiPackage ()

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

Returns
boolean

isSealed

public boolean isSealed ()

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.

Returns
boolean

isStaged

public boolean isStaged ()

Returns true if this session is a staged session.

Returns
boolean

isStagedSessionActive

public boolean isStagedSessionActive ()

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 Session#commit.

Returns
boolean

isStagedSessionApplied

public boolean isStagedSessionApplied ()

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.

Returns
boolean

isStagedSessionFailed

public boolean isStagedSessionFailed ()

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.

Returns
boolean

isStagedSessionReady

public boolean isStagedSessionReady ()

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

Returns
boolean

writeToParcel

public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written.

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