public static class PackageInstaller.SessionParams extends Object implements Parcelable
PackageInstaller.Session
.Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
String |
abiOverride |
Bitmap |
appIcon |
long |
appIconLastModified |
String |
appLabel |
String |
appPackageName |
static Parcelable.Creator<PackageInstaller.SessionParams> |
CREATOR |
String[] |
grantedRuntimePermissions |
int |
installFlags |
int |
installLocation |
int |
mode |
static int |
MODE_FULL_INSTALL
Mode for an install session whose staged APKs should fully replace any
existing APKs for the target app.
|
static int |
MODE_INHERIT_EXISTING
Mode for an install session that should inherit any existing APKs for the
target app, unless they have been explicitly overridden (based on split
name) by the session.
|
static int |
MODE_INVALID |
int |
originatingUid |
Uri |
originatingUri |
Uri |
referrerUri |
long |
sizeBytes |
static int |
UID_UNKNOWN |
String |
volumeUuid |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
SessionParams(int mode)
Construct parameters for a new package install session.
|
SessionParams(Parcel source) |
Modifier and Type | Method and Description |
---|---|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
void |
dump(IndentingPrintWriter pw) |
void |
setAllowDowngrade(boolean allowDowngrade) |
void |
setAppIcon(Bitmap appIcon)
Optionally set an icon representing the app being installed.
|
void |
setAppLabel(CharSequence appLabel)
Optionally set a label representing the app being installed.
|
void |
setAppPackageName(String appPackageName)
Optionally set the package name of the app being installed.
|
void |
setDontKillApp(boolean dontKillApp) |
void |
setGrantedRuntimePermissions(String[] permissions)
Sets which runtime permissions to be granted to the package at installation.
|
void |
setInstallFlagsExternal() |
void |
setInstallFlagsForcePermissionPrompt() |
void |
setInstallFlagsInternal() |
void |
setInstallLocation(int installLocation)
Provide value of
PackageInfo.installLocation , which may be used
to determine where the app will be staged. |
void |
setOriginatingUid(int originatingUid)
Sets the UID that initiated package installation.
|
void |
setOriginatingUri(Uri originatingUri)
Optionally set the URI where this package was downloaded from.
|
void |
setReferrerUri(Uri referrerUri)
Optionally set the URI that referred you to install this package.
|
void |
setSize(long sizeBytes)
Optionally indicate the total size (in bytes) of all APKs that will be
delivered in this session.
|
void |
writeToParcel(Parcel dest,
int flags)
Flatten this object in to a Parcel.
|
public static final int MODE_INVALID
public static final int MODE_FULL_INSTALL
public static final int MODE_INHERIT_EXISTING
If there are no existing APKs for the target app, this behaves like
MODE_FULL_INSTALL
.
public static final int UID_UNKNOWN
public int mode
public int installFlags
public int installLocation
public long sizeBytes
public String appPackageName
public Bitmap appIcon
public String appLabel
public long appIconLastModified
public Uri originatingUri
public int originatingUid
public Uri referrerUri
public String abiOverride
public String volumeUuid
public String[] grantedRuntimePermissions
public static final Parcelable.Creator<PackageInstaller.SessionParams> CREATOR
public SessionParams(int mode)
mode
- one of MODE_FULL_INSTALL
or
MODE_INHERIT_EXISTING
describing how the session
should interact with an existing app.public SessionParams(Parcel source)
public void setInstallLocation(int installLocation)
PackageInfo.installLocation
, which may be used
to determine where the app will be staged. Defaults to
PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY
.public void setSize(long sizeBytes)
public void setAppPackageName(String appPackageName)
If the APKs staged in the session aren't consistent with this package name, the install will fail. Regardless of this value, all APKs in the app must have the same package name.
public void setAppIcon(Bitmap appIcon)
ActivityManager.getLauncherLargeIconSize()
in both
dimensions.public void setAppLabel(CharSequence appLabel)
public void setOriginatingUri(Uri originatingUri)
Intent.EXTRA_ORIGINATING_URI
public void setOriginatingUid(int originatingUid)
public void setReferrerUri(Uri referrerUri)
Intent.EXTRA_REFERRER
public void setGrantedRuntimePermissions(String[] permissions)
#INSTALL_GRANT_RUNTIME_PERMISSIONS
permissions
- The permissions to grant or null to grant all runtime
permissions.public void setInstallFlagsInternal()
public void setAllowDowngrade(boolean allowDowngrade)
public void setInstallFlagsExternal()
public void setInstallFlagsForcePermissionPrompt()
public void setDontKillApp(boolean dontKillApp)
public void dump(IndentingPrintWriter pw)
public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel dest, int flags)
Parcelable
writeToParcel
in interface Parcelable
dest
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.