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.IntentSender;
|
||||||
import android.content.pm.PackageManager.DeleteFlags;
|
import android.content.pm.PackageManager.DeleteFlags;
|
||||||
import android.content.pm.PackageManager.InstallReason;
|
import android.content.pm.PackageManager.InstallReason;
|
||||||
|
import android.content.pm.PackageManager.InstallScenario;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@@ -1465,6 +1466,14 @@ public class PackageInstaller {
|
|||||||
public int installLocation = PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY;
|
public int installLocation = PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY;
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public @InstallReason int installReason = PackageManager.INSTALL_REASON_UNKNOWN;
|
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} */
|
/** {@hide} */
|
||||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
||||||
public long sizeBytes = -1;
|
public long sizeBytes = -1;
|
||||||
@@ -1528,6 +1537,7 @@ public class PackageInstaller {
|
|||||||
installFlags = source.readInt();
|
installFlags = source.readInt();
|
||||||
installLocation = source.readInt();
|
installLocation = source.readInt();
|
||||||
installReason = source.readInt();
|
installReason = source.readInt();
|
||||||
|
installScenario = source.readInt();
|
||||||
sizeBytes = source.readLong();
|
sizeBytes = source.readLong();
|
||||||
appPackageName = source.readString();
|
appPackageName = source.readString();
|
||||||
appIcon = source.readParcelable(null);
|
appIcon = source.readParcelable(null);
|
||||||
@@ -1559,6 +1569,7 @@ public class PackageInstaller {
|
|||||||
ret.installFlags = installFlags;
|
ret.installFlags = installFlags;
|
||||||
ret.installLocation = installLocation;
|
ret.installLocation = installLocation;
|
||||||
ret.installReason = installReason;
|
ret.installReason = installReason;
|
||||||
|
ret.installScenario = installScenario;
|
||||||
ret.sizeBytes = sizeBytes;
|
ret.sizeBytes = sizeBytes;
|
||||||
ret.appPackageName = appPackageName;
|
ret.appPackageName = appPackageName;
|
||||||
ret.appIcon = appIcon; // not a copy.
|
ret.appIcon = appIcon; // not a copy.
|
||||||
@@ -1984,6 +1995,8 @@ public class PackageInstaller {
|
|||||||
pw.printPair("mode", mode);
|
pw.printPair("mode", mode);
|
||||||
pw.printHexPair("installFlags", installFlags);
|
pw.printHexPair("installFlags", installFlags);
|
||||||
pw.printPair("installLocation", installLocation);
|
pw.printPair("installLocation", installLocation);
|
||||||
|
pw.printPair("installReason", installReason);
|
||||||
|
pw.printPair("installScenario", installScenario);
|
||||||
pw.printPair("sizeBytes", sizeBytes);
|
pw.printPair("sizeBytes", sizeBytes);
|
||||||
pw.printPair("appPackageName", appPackageName);
|
pw.printPair("appPackageName", appPackageName);
|
||||||
pw.printPair("appIcon", (appIcon != null));
|
pw.printPair("appIcon", (appIcon != null));
|
||||||
@@ -2017,6 +2030,7 @@ public class PackageInstaller {
|
|||||||
dest.writeInt(installFlags);
|
dest.writeInt(installFlags);
|
||||||
dest.writeInt(installLocation);
|
dest.writeInt(installLocation);
|
||||||
dest.writeInt(installReason);
|
dest.writeInt(installReason);
|
||||||
|
dest.writeInt(installScenario);
|
||||||
dest.writeLong(sizeBytes);
|
dest.writeLong(sizeBytes);
|
||||||
dest.writeString(appPackageName);
|
dest.writeString(appPackageName);
|
||||||
dest.writeParcelable(appIcon, flags);
|
dest.writeParcelable(appIcon, flags);
|
||||||
@@ -2126,6 +2140,8 @@ public class PackageInstaller {
|
|||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public @InstallReason int installReason;
|
public @InstallReason int installReason;
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
|
public @InstallReason int installScenario;
|
||||||
|
/** {@hide} */
|
||||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
|
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
|
||||||
public long sizeBytes;
|
public long sizeBytes;
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
@@ -2203,6 +2219,7 @@ public class PackageInstaller {
|
|||||||
|
|
||||||
mode = source.readInt();
|
mode = source.readInt();
|
||||||
installReason = source.readInt();
|
installReason = source.readInt();
|
||||||
|
installScenario = source.readInt();
|
||||||
sizeBytes = source.readLong();
|
sizeBytes = source.readLong();
|
||||||
appPackageName = source.readString();
|
appPackageName = source.readString();
|
||||||
appIcon = source.readParcelable(null);
|
appIcon = source.readParcelable(null);
|
||||||
@@ -2733,6 +2750,7 @@ public class PackageInstaller {
|
|||||||
|
|
||||||
dest.writeInt(mode);
|
dest.writeInt(mode);
|
||||||
dest.writeInt(installReason);
|
dest.writeInt(installReason);
|
||||||
|
dest.writeInt(installScenario);
|
||||||
dest.writeLong(sizeBytes);
|
dest.writeLong(sizeBytes);
|
||||||
dest.writeString(appPackageName);
|
dest.writeString(appPackageName);
|
||||||
dest.writeParcelable(appIcon, flags);
|
dest.writeParcelable(appIcon, flags);
|
||||||
|
|||||||
@@ -1037,6 +1037,60 @@ public abstract class PackageManager {
|
|||||||
*/
|
*/
|
||||||
public static final int INSTALL_REASON_ROLLBACK = 5;
|
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 */
|
/** @hide */
|
||||||
@IntDef(prefix = { "UNINSTALL_REASON_" }, value = {
|
@IntDef(prefix = { "UNINSTALL_REASON_" }, value = {
|
||||||
UNINSTALL_REASON_UNKNOWN,
|
UNINSTALL_REASON_UNKNOWN,
|
||||||
|
|||||||
@@ -669,6 +669,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
|
|
||||||
info.mode = params.mode;
|
info.mode = params.mode;
|
||||||
info.installReason = params.installReason;
|
info.installReason = params.installReason;
|
||||||
|
info.installScenario = params.installScenario;
|
||||||
info.sizeBytes = params.sizeBytes;
|
info.sizeBytes = params.sizeBytes;
|
||||||
info.appPackageName = params.appPackageName;
|
info.appPackageName = params.appPackageName;
|
||||||
if (includeIcon) {
|
if (includeIcon) {
|
||||||
|
|||||||
@@ -14861,6 +14861,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
final VerificationInfo verificationInfo;
|
final VerificationInfo verificationInfo;
|
||||||
final PackageParser.SigningDetails signingDetails;
|
final PackageParser.SigningDetails signingDetails;
|
||||||
final int installReason;
|
final int installReason;
|
||||||
|
final int mInstallScenario;
|
||||||
@Nullable
|
@Nullable
|
||||||
MultiPackageInstallParams mParentInstallParams;
|
MultiPackageInstallParams mParentInstallParams;
|
||||||
final long requiredInstalledVersionCode;
|
final long requiredInstalledVersionCode;
|
||||||
@@ -14889,6 +14890,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
this.autoRevokePermissionsMode = autoRevokePermissionsMode;
|
this.autoRevokePermissionsMode = autoRevokePermissionsMode;
|
||||||
this.signingDetails = signingDetails;
|
this.signingDetails = signingDetails;
|
||||||
this.installReason = installReason;
|
this.installReason = installReason;
|
||||||
|
this.mInstallScenario = PackageManager.INSTALL_SCENARIO_DEFAULT;
|
||||||
this.requiredInstalledVersionCode = requiredInstalledVersionCode;
|
this.requiredInstalledVersionCode = requiredInstalledVersionCode;
|
||||||
this.forceQueryableOverride = false;
|
this.forceQueryableOverride = false;
|
||||||
this.mDataLoaderType = dataLoaderType;
|
this.mDataLoaderType = dataLoaderType;
|
||||||
@@ -14916,6 +14918,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
activeInstallSession.getInstallSource().installerPackageName,
|
activeInstallSession.getInstallSource().installerPackageName,
|
||||||
activeInstallSession.getInstallerUid(),
|
activeInstallSession.getInstallerUid(),
|
||||||
sessionParams.installReason);
|
sessionParams.installReason);
|
||||||
|
mInstallScenario = sessionParams.installScenario;
|
||||||
observer = activeInstallSession.getObserver();
|
observer = activeInstallSession.getObserver();
|
||||||
installFlags = sessionParams.installFlags;
|
installFlags = sessionParams.installFlags;
|
||||||
installSource = activeInstallSession.getInstallSource();
|
installSource = activeInstallSession.getInstallSource();
|
||||||
@@ -15553,6 +15556,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
final int traceCookie;
|
final int traceCookie;
|
||||||
final PackageParser.SigningDetails signingDetails;
|
final PackageParser.SigningDetails signingDetails;
|
||||||
final int installReason;
|
final int installReason;
|
||||||
|
final int mInstallScenario;
|
||||||
final boolean forceQueryableOverride;
|
final boolean forceQueryableOverride;
|
||||||
@Nullable final MultiPackageInstallParams mMultiPackageInstallParams;
|
@Nullable final MultiPackageInstallParams mMultiPackageInstallParams;
|
||||||
final int mDataLoaderType;
|
final int mDataLoaderType;
|
||||||
@@ -15569,7 +15573,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
List<String> whitelistedRestrictedPermissions,
|
List<String> whitelistedRestrictedPermissions,
|
||||||
int autoRevokePermissionsMode,
|
int autoRevokePermissionsMode,
|
||||||
String traceMethod, int traceCookie, SigningDetails signingDetails,
|
String traceMethod, int traceCookie, SigningDetails signingDetails,
|
||||||
int installReason, boolean forceQueryableOverride,
|
int installReason, int installScenario, boolean forceQueryableOverride,
|
||||||
MultiPackageInstallParams multiPackageInstallParams, int dataLoaderType) {
|
MultiPackageInstallParams multiPackageInstallParams, int dataLoaderType) {
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
this.move = move;
|
this.move = move;
|
||||||
@@ -15587,6 +15591,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
this.traceCookie = traceCookie;
|
this.traceCookie = traceCookie;
|
||||||
this.signingDetails = signingDetails;
|
this.signingDetails = signingDetails;
|
||||||
this.installReason = installReason;
|
this.installReason = installReason;
|
||||||
|
this.mInstallScenario = installScenario;
|
||||||
this.forceQueryableOverride = forceQueryableOverride;
|
this.forceQueryableOverride = forceQueryableOverride;
|
||||||
this.mMultiPackageInstallParams = multiPackageInstallParams;
|
this.mMultiPackageInstallParams = multiPackageInstallParams;
|
||||||
this.mDataLoaderType = dataLoaderType;
|
this.mDataLoaderType = dataLoaderType;
|
||||||
@@ -15600,7 +15605,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
params.grantedRuntimePermissions, params.whitelistedRestrictedPermissions,
|
params.grantedRuntimePermissions, params.whitelistedRestrictedPermissions,
|
||||||
params.autoRevokePermissionsMode,
|
params.autoRevokePermissionsMode,
|
||||||
params.traceMethod, params.traceCookie, params.signingDetails,
|
params.traceMethod, params.traceCookie, params.signingDetails,
|
||||||
params.installReason, params.forceQueryableOverride,
|
params.installReason, params.mInstallScenario, params.forceQueryableOverride,
|
||||||
params.mParentInstallParams, params.mDataLoaderType);
|
params.mParentInstallParams, params.mDataLoaderType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15692,8 +15697,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
super(OriginInfo.fromNothing(), null, null, 0, InstallSource.EMPTY,
|
super(OriginInfo.fromNothing(), null, null, 0, InstallSource.EMPTY,
|
||||||
null, null, instructionSets, null, null, null, MODE_DEFAULT, null, 0,
|
null, null, instructionSets, null, null, null, MODE_DEFAULT, null, 0,
|
||||||
PackageParser.SigningDetails.UNKNOWN,
|
PackageParser.SigningDetails.UNKNOWN,
|
||||||
PackageManager.INSTALL_REASON_UNKNOWN, false, null /* parent */,
|
PackageManager.INSTALL_REASON_UNKNOWN, PackageManager.INSTALL_SCENARIO_DEFAULT,
|
||||||
DataLoaderType.NONE);
|
false, null /* parent */, DataLoaderType.NONE);
|
||||||
this.codeFile = (codePath != null) ? new File(codePath) : null;
|
this.codeFile = (codePath != null) ? new File(codePath) : null;
|
||||||
this.resourceFile = (resourcePath != null) ? new File(resourcePath) : null;
|
this.resourceFile = (resourcePath != null) ? new File(resourcePath) : null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user