Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

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

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

Get the value set in PackageInstaller.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 PackageInstaller.SessionParams.

int getOriginatingUid()

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

Uri getOriginatingUri()

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

float getProgress()

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

Uri getReferrerUri()

Get the value set in PackageInstaller.SessionParams.setReferrerUri(Uri)

int getSessionId()

Return the ID for this session.

long getSize()

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

boolean isActive()

Return if this session is currently active.

boolean isSealed()

Return if this session is sealed.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Fields

CREATOR

added in API level 21
public static final Creator<PackageInstaller.SessionInfo> CREATOR

Public methods

createDetailsIntent

added in API level 21
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.

describeContents

added in API level 21
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(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.

getAppIcon

added in API level 21
public Bitmap getAppIcon ()

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

Returns
Bitmap

This value may be null.

getAppLabel

added in API level 21
public CharSequence getAppLabel ()

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

Returns
CharSequence

This value may be null.

getAppPackageName

added in API level 21
public String getAppPackageName ()

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

Returns
String

This value may be null.

getInstallLocation

added in API level 27
public int getInstallLocation ()

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

Returns
int

getInstallReason

added in API level 26
public int getInstallReason ()

Return the reason for installing this package.

Returns
int The install reason.

Value is INSTALL_REASON_UNKNOWN, INSTALL_REASON_POLICY, INSTALL_REASON_DEVICE_RESTORE, INSTALL_REASON_DEVICE_SETUP or INSTALL_REASON_USER.

getInstallerPackageName

added in API level 21
public String getInstallerPackageName ()

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

Returns
String

This value may be null.

getMode

added in API level 27
public int getMode ()

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

Returns
int One of PackageInstaller.SessionParams.MODE_FULL_INSTALL or PackageInstaller.SessionParams.MODE_INHERIT_EXISTING

getOriginatingUid

added in API level 27
public int getOriginatingUid ()

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

Returns
int

getOriginatingUri

added in API level 27
public Uri getOriginatingUri ()

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

Returns
Uri

This value may be null.

getProgress

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

added in API level 27
public Uri getReferrerUri ()

Get the value set in PackageInstaller.SessionParams.setReferrerUri(Uri)

Returns
Uri

This value may be null.

getSessionId

added in API level 21
public int getSessionId ()

Return the ID for this session.

Returns
int

getSize

added in API level 27
public long getSize ()

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

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

Returns
long

isActive

added in API level 21
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 PackageInstaller.Session instance while streaming data into place, or the system optimizing code as the result of PackageInstaller.Session.commit(IntentSender).

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

Returns
boolean

isSealed

added in API level 26
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 PackageInstaller.Session.commit(IntentSender) is called.

Returns
boolean

writeToParcel

added in API level 21
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.