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 |
open Int |
Get the value set in |
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 |
getMode() Get the mode of the session as set in the constructor of the |
open Int |
Get the value set in |
open Uri? |
Get the value set in |
open Int |
Get the package source that was set in |
open Int |
Returns the parent multi-package session ID if this session belongs to one, |
open Float |
Return current overall progress of this session, between 0 and 1. |
open Uri? |
Get the value set in |
open Int |
Whether user action was required by the installer. |
open Int |
Return the ID for this session. |
open Long |
getSize() Get the value as set in |
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 |
open Long |
The timestamp of the last update that occurred to the session, including changing of states in case of staged sessions. |
open UserHandle |
getUser() Return the user associated with this session. |
open Boolean |
Returns true if session has a valid parent session, otherwise false. |
open Boolean |
isActive() Return if this session is currently active. |
open Boolean |
Returns |
open Boolean |
Returns |
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 |
isSealed() Return if this session is sealed. |
open Boolean |
isStaged() Returns true if this session is a staged session. |
open Boolean |
Returns |
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
static val INVALID_ID: Int
A session ID that does not exist or is invalid.
Value: -1
SESSION_ACTIVATION_FAILED
static val SESSION_ACTIVATION_FAILED: Int
Constant indicating that an error occurred during the activation phase of this session.
Value: 2
SESSION_CONFLICT
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
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
static val SESSION_UNKNOWN_ERROR: Int
Constant indicating that an unknown error occurred while processing this session.
Value: 3
SESSION_VERIFICATION_FAILED
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
static valSTAGED_SESSION_ACTIVATION_FAILED: Int
Deprecated: use SESSION_ACTIVATION_FAILED
.
Value: 2
STAGED_SESSION_CONFLICT
static valSTAGED_SESSION_CONFLICT: Int
Deprecated: use SESSION_CONFLICT
.
Value: 4
STAGED_SESSION_NO_ERROR
static valSTAGED_SESSION_NO_ERROR: Int
Deprecated: use SESSION_NO_ERROR
.
Value: 0
STAGED_SESSION_UNKNOWN
static valSTAGED_SESSION_UNKNOWN: Int
Deprecated: use SESSION_UNKNOWN_ERROR
.
Value: 3
STAGED_SESSION_VERIFICATION_FAILED
static valSTAGED_SESSION_VERIFICATION_FAILED: Int
Deprecated: use SESSION_VERIFICATION_FAILED
.
Value: 1
Public methods
createDetailsIntent
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
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
open fun getAppIcon(): Bitmap?
Return an icon representing the app being installed. May be null
if unavailable.
getAppLabel
open fun getAppLabel(): CharSequence?
Return a label representing the app being installed. May be null
if unavailable.
getAppPackageName
open fun getAppPackageName(): String?
Return the package name this session is working with. May be null
if unknown.
getChildSessionIds
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
open fun getCreatedMillis(): Long
The timestamp of the initial creation of the session.
getDontKillApp
open fun getDontKillApp(): Boolean
Get the value set in SessionParams.setDontKillApp(boolean)
.
getInstallLocation
open fun getInstallLocation(): Int
Get the value set in SessionParams.setInstallLocation(int)
.
getInstallReason
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
open fun getInstallerAttributionTag(): String?
Return | |
---|---|
String? |
attribution tag of the context that created this session This value may be null . |
getInstallerPackageName
open fun getInstallerPackageName(): String?
Return the package name of the app that owns this session.
Return | |
---|---|
String? |
This value may be null . |
getInstallerUid
open fun getInstallerUid(): Int
Returns the Uid of the owner of the session.
getMode
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
open fun getOriginatingUid(): Int
Get the value set in SessionParams.setOriginatingUid(int)
.
getOriginatingUri
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.
getPackageSource
open fun getPackageSource(): Int
Get the package source that was set in PackageInstaller.SessionParams.setPackageSource(int)
.
getParentSessionId
open fun getParentSessionId(): Int
Returns the parent multi-package session ID if this session belongs to one, INVALID_ID
otherwise.
getProgress
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
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
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.
getSize
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
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
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
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
open fun getUser(): UserHandle
Return the user associated with this session.
Return | |
---|---|
UserHandle |
This value cannot be null . |
hasParentSessionId
open fun hasParentSessionId(): Boolean
Returns true if session has a valid parent session, otherwise false.
isActive
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
open fun isApplicationEnabledSettingPersistent(): Boolean
Returns true
if this session will keep the existing application enabled setting after installation.
isCommitted
open fun isCommitted(): Boolean
Returns true
if Session.commit(IntentSender)
} was called for this session.
isMultiPackage
open fun isMultiPackage(): Boolean
Returns true if this session is a multi-package session containing references to other sessions.
isPreApprovalRequested
open fun isPreApprovalRequested(): Boolean
Returns whether this session has requested user pre-approval.
isRequestUpdateOwnership
open fun isRequestUpdateOwnership(): Boolean
Return | |
---|---|
Boolean |
true if the installer requested the update ownership enforcement for the packages in this session. |
isSealed
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
open fun isStaged(): Boolean
Returns true if this session is a staged session.
isStagedSessionActive
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:
- It is committed, i.e.
SessionInfo.isCommitted()
istrue
, and - it is not applied, i.e.
SessionInfo.isStagedSessionApplied()
isfalse
, and - it is not failed, i.e.
SessionInfo.isStagedSessionFailed()
isfalse
.
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
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
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
open fun isStagedSessionReady(): Boolean
Whether the staged session is ready to be applied at next reboot. Only meaningful if isStaged
is true.
isUnarchival
open fun isUnarchival(): Boolean
Returns true if the session is an unarchival.
writeToParcel
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
static val CREATOR: Parcelable.Creator<PackageInstaller.SessionInfo!>!