Adds an "install scenario" field to the appropriate datastructures am: d42204a865
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1465553 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ifeb0c921ec079202dba5b0b50eb147b09ea3042e
This commit is contained in:
@@ -37,6 +37,7 @@ import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
import android.content.pm.PackageManager.DeleteFlags;
|
||||
import android.content.pm.PackageManager.InstallReason;
|
||||
import android.content.pm.PackageManager.InstallScenario;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
@@ -1465,6 +1466,14 @@ public class PackageInstaller {
|
||||
public int installLocation = PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY;
|
||||
/** {@hide} */
|
||||
public @InstallReason int installReason = PackageManager.INSTALL_REASON_UNKNOWN;
|
||||
/**
|
||||
* {@hide}
|
||||
*
|
||||
* This flag indicates which installation scenario best describes this session. The system
|
||||
* may use this value when making decisions about how to handle the installation, such as
|
||||
* prioritizing system health or user experience.
|
||||
*/
|
||||
public @InstallScenario int installScenario = PackageManager.INSTALL_SCENARIO_DEFAULT;
|
||||
/** {@hide} */
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
||||
public long sizeBytes = -1;
|
||||
@@ -1528,6 +1537,7 @@ public class PackageInstaller {
|
||||
installFlags = source.readInt();
|
||||
installLocation = source.readInt();
|
||||
installReason = source.readInt();
|
||||
installScenario = source.readInt();
|
||||
sizeBytes = source.readLong();
|
||||
appPackageName = source.readString();
|
||||
appIcon = source.readParcelable(null);
|
||||
@@ -1559,6 +1569,7 @@ public class PackageInstaller {
|
||||
ret.installFlags = installFlags;
|
||||
ret.installLocation = installLocation;
|
||||
ret.installReason = installReason;
|
||||
ret.installScenario = installScenario;
|
||||
ret.sizeBytes = sizeBytes;
|
||||
ret.appPackageName = appPackageName;
|
||||
ret.appIcon = appIcon; // not a copy.
|
||||
@@ -1984,6 +1995,8 @@ public class PackageInstaller {
|
||||
pw.printPair("mode", mode);
|
||||
pw.printHexPair("installFlags", installFlags);
|
||||
pw.printPair("installLocation", installLocation);
|
||||
pw.printPair("installReason", installReason);
|
||||
pw.printPair("installScenario", installScenario);
|
||||
pw.printPair("sizeBytes", sizeBytes);
|
||||
pw.printPair("appPackageName", appPackageName);
|
||||
pw.printPair("appIcon", (appIcon != null));
|
||||
@@ -2017,6 +2030,7 @@ public class PackageInstaller {
|
||||
dest.writeInt(installFlags);
|
||||
dest.writeInt(installLocation);
|
||||
dest.writeInt(installReason);
|
||||
dest.writeInt(installScenario);
|
||||
dest.writeLong(sizeBytes);
|
||||
dest.writeString(appPackageName);
|
||||
dest.writeParcelable(appIcon, flags);
|
||||
@@ -2126,6 +2140,8 @@ public class PackageInstaller {
|
||||
/** {@hide} */
|
||||
public @InstallReason int installReason;
|
||||
/** {@hide} */
|
||||
public @InstallReason int installScenario;
|
||||
/** {@hide} */
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
|
||||
public long sizeBytes;
|
||||
/** {@hide} */
|
||||
@@ -2203,6 +2219,7 @@ public class PackageInstaller {
|
||||
|
||||
mode = source.readInt();
|
||||
installReason = source.readInt();
|
||||
installScenario = source.readInt();
|
||||
sizeBytes = source.readLong();
|
||||
appPackageName = source.readString();
|
||||
appIcon = source.readParcelable(null);
|
||||
@@ -2733,6 +2750,7 @@ public class PackageInstaller {
|
||||
|
||||
dest.writeInt(mode);
|
||||
dest.writeInt(installReason);
|
||||
dest.writeInt(installScenario);
|
||||
dest.writeLong(sizeBytes);
|
||||
dest.writeString(appPackageName);
|
||||
dest.writeParcelable(appIcon, flags);
|
||||
|
||||
@@ -1037,6 +1037,60 @@ public abstract class PackageManager {
|
||||
*/
|
||||
public static final int INSTALL_REASON_ROLLBACK = 5;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = { "INSTALL_SCENARIO_" }, value = {
|
||||
INSTALL_SCENARIO_DEFAULT,
|
||||
INSTALL_SCENARIO_FAST,
|
||||
INSTALL_SCENARIO_BULK,
|
||||
INSTALL_SCENARIO_BULK_SECONDARY,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface InstallScenario {}
|
||||
|
||||
/**
|
||||
* A value to indicate the lack of CUJ information, disabling all installation scenario logic.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int INSTALL_SCENARIO_DEFAULT = 0;
|
||||
|
||||
/**
|
||||
* Installation scenario providing the fastest “install button to launch" experience possible.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int INSTALL_SCENARIO_FAST = 1;
|
||||
|
||||
/**
|
||||
* Installation scenario indicating a bulk operation with the desired result of a fully
|
||||
* optimized application. If the system is busy or resources are scarce the system will
|
||||
* perform less work to avoid impacting system health.
|
||||
*
|
||||
* Examples of bulk installation scenarios might include device restore, background updates of
|
||||
* multiple applications, or user-triggered updates for all applications.
|
||||
*
|
||||
* The decision to use BULK or BULK_SECONDARY should be based on the desired user experience.
|
||||
* BULK_SECONDARY operations may take less time to complete but, when they do, will produce
|
||||
* less optimized applications. The device state (e.g. memory usage or battery status) should
|
||||
* not be considered when making this decision as those factors are taken into account by the
|
||||
* Package Manager when acting on the installation scenario.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int INSTALL_SCENARIO_BULK = 2;
|
||||
|
||||
/**
|
||||
* Installation scenario indicating a bulk operation that prioritizes minimal system health
|
||||
* impact over application optimization. The application may undergo additional optimization
|
||||
* if the system is idle and system resources are abundant. The more elements of a bulk
|
||||
* operation that are marked BULK_SECONDARY, the faster the entire bulk operation will be.
|
||||
*
|
||||
* See the comments for INSTALL_SCENARIO_BULK for more information.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int INSTALL_SCENARIO_BULK_SECONDARY = 3;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = { "UNINSTALL_REASON_" }, value = {
|
||||
UNINSTALL_REASON_UNKNOWN,
|
||||
|
||||
@@ -669,6 +669,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
|
||||
info.mode = params.mode;
|
||||
info.installReason = params.installReason;
|
||||
info.installScenario = params.installScenario;
|
||||
info.sizeBytes = params.sizeBytes;
|
||||
info.appPackageName = params.appPackageName;
|
||||
if (includeIcon) {
|
||||
|
||||
@@ -14861,6 +14861,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final VerificationInfo verificationInfo;
|
||||
final PackageParser.SigningDetails signingDetails;
|
||||
final int installReason;
|
||||
final int mInstallScenario;
|
||||
@Nullable
|
||||
MultiPackageInstallParams mParentInstallParams;
|
||||
final long requiredInstalledVersionCode;
|
||||
@@ -14889,6 +14890,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
this.autoRevokePermissionsMode = autoRevokePermissionsMode;
|
||||
this.signingDetails = signingDetails;
|
||||
this.installReason = installReason;
|
||||
this.mInstallScenario = PackageManager.INSTALL_SCENARIO_DEFAULT;
|
||||
this.requiredInstalledVersionCode = requiredInstalledVersionCode;
|
||||
this.forceQueryableOverride = false;
|
||||
this.mDataLoaderType = dataLoaderType;
|
||||
@@ -14916,6 +14918,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
activeInstallSession.getInstallSource().installerPackageName,
|
||||
activeInstallSession.getInstallerUid(),
|
||||
sessionParams.installReason);
|
||||
mInstallScenario = sessionParams.installScenario;
|
||||
observer = activeInstallSession.getObserver();
|
||||
installFlags = sessionParams.installFlags;
|
||||
installSource = activeInstallSession.getInstallSource();
|
||||
@@ -15553,6 +15556,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final int traceCookie;
|
||||
final PackageParser.SigningDetails signingDetails;
|
||||
final int installReason;
|
||||
final int mInstallScenario;
|
||||
final boolean forceQueryableOverride;
|
||||
@Nullable final MultiPackageInstallParams mMultiPackageInstallParams;
|
||||
final int mDataLoaderType;
|
||||
@@ -15569,7 +15573,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
List<String> whitelistedRestrictedPermissions,
|
||||
int autoRevokePermissionsMode,
|
||||
String traceMethod, int traceCookie, SigningDetails signingDetails,
|
||||
int installReason, boolean forceQueryableOverride,
|
||||
int installReason, int installScenario, boolean forceQueryableOverride,
|
||||
MultiPackageInstallParams multiPackageInstallParams, int dataLoaderType) {
|
||||
this.origin = origin;
|
||||
this.move = move;
|
||||
@@ -15587,6 +15591,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
this.traceCookie = traceCookie;
|
||||
this.signingDetails = signingDetails;
|
||||
this.installReason = installReason;
|
||||
this.mInstallScenario = installScenario;
|
||||
this.forceQueryableOverride = forceQueryableOverride;
|
||||
this.mMultiPackageInstallParams = multiPackageInstallParams;
|
||||
this.mDataLoaderType = dataLoaderType;
|
||||
@@ -15600,7 +15605,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
params.grantedRuntimePermissions, params.whitelistedRestrictedPermissions,
|
||||
params.autoRevokePermissionsMode,
|
||||
params.traceMethod, params.traceCookie, params.signingDetails,
|
||||
params.installReason, params.forceQueryableOverride,
|
||||
params.installReason, params.mInstallScenario, params.forceQueryableOverride,
|
||||
params.mParentInstallParams, params.mDataLoaderType);
|
||||
}
|
||||
|
||||
@@ -15692,8 +15697,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
super(OriginInfo.fromNothing(), null, null, 0, InstallSource.EMPTY,
|
||||
null, null, instructionSets, null, null, null, MODE_DEFAULT, null, 0,
|
||||
PackageParser.SigningDetails.UNKNOWN,
|
||||
PackageManager.INSTALL_REASON_UNKNOWN, false, null /* parent */,
|
||||
DataLoaderType.NONE);
|
||||
PackageManager.INSTALL_REASON_UNKNOWN, PackageManager.INSTALL_SCENARIO_DEFAULT,
|
||||
false, null /* parent */, DataLoaderType.NONE);
|
||||
this.codeFile = (codePath != null) ? new File(codePath) : null;
|
||||
this.resourceFile = (resourcePath != null) ? new File(resourcePath) : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user