Merge "[pm/incremental] restore package loading progress on reboot" into sc-dev am: 7a603c45b6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13418753 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I431256626783abca2f75cf1615868f25bd0df723
This commit is contained in:
@@ -61,12 +61,12 @@ public final class IncrementalStates {
|
||||
|
||||
public IncrementalStates() {
|
||||
// By default the package is not startable and not fully loaded (i.e., is loading)
|
||||
this(false, true);
|
||||
this(false, true, 0);
|
||||
}
|
||||
|
||||
public IncrementalStates(boolean isStartable, boolean isLoading) {
|
||||
public IncrementalStates(boolean isStartable, boolean isLoading, float loadingProgress) {
|
||||
mStartableState = new StartableState(isStartable);
|
||||
mLoadingState = new LoadingState(isLoading);
|
||||
mLoadingState = new LoadingState(isLoading, loadingProgress);
|
||||
mStatusConsumer = new StatusConsumer();
|
||||
}
|
||||
|
||||
@@ -405,9 +405,10 @@ public final class IncrementalStates {
|
||||
private boolean mIsLoading;
|
||||
private float mProgress;
|
||||
|
||||
LoadingState(boolean isLoading) {
|
||||
LoadingState(boolean isLoading, float loadingProgress) {
|
||||
mIsLoading = isLoading;
|
||||
mProgress = isLoading ? 0 : 1;
|
||||
// loading progress is reset to 1 if loading has finished
|
||||
mProgress = isLoading ? loadingProgress : 1;
|
||||
}
|
||||
|
||||
public boolean isLoading() {
|
||||
|
||||
@@ -73,6 +73,7 @@ import android.os.SystemClock;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.os.incremental.IncrementalManager;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.os.storage.VolumeInfo;
|
||||
import android.service.pm.PackageServiceDumpProto;
|
||||
@@ -2957,6 +2958,8 @@ public final class Settings implements Watchable, Snappable {
|
||||
if (pkg.isPackageLoading()) {
|
||||
serializer.attributeBoolean(null, "isLoading", true);
|
||||
}
|
||||
serializer.attributeFloat(null, "loadingProgress",
|
||||
pkg.getIncrementalStates().getProgress());
|
||||
|
||||
writeUsesStaticLibLPw(serializer, pkg.usesStaticLibraries, pkg.usesStaticLibrariesVersions);
|
||||
|
||||
@@ -3699,6 +3702,7 @@ public final class Settings implements Watchable, Snappable {
|
||||
boolean installedForceQueryable = false;
|
||||
boolean isStartable = false;
|
||||
boolean isLoading = false;
|
||||
float loadingProgress = 0;
|
||||
try {
|
||||
name = parser.getAttributeValue(null, ATTR_NAME);
|
||||
realName = parser.getAttributeValue(null, "realName");
|
||||
@@ -3717,6 +3721,7 @@ public final class Settings implements Watchable, Snappable {
|
||||
installedForceQueryable = parser.getAttributeBoolean(null, "forceQueryable", false);
|
||||
isStartable = parser.getAttributeBoolean(null, "isStartable", false);
|
||||
isLoading = parser.getAttributeBoolean(null, "isLoading", false);
|
||||
loadingProgress = parser.getAttributeFloat(null, "loadingProgress", 0);
|
||||
|
||||
if (primaryCpuAbiString == null && legacyCpuAbiString != null) {
|
||||
primaryCpuAbiString = legacyCpuAbiString;
|
||||
@@ -3864,7 +3869,8 @@ public final class Settings implements Watchable, Snappable {
|
||||
packageSetting.secondaryCpuAbiString = secondaryCpuAbiString;
|
||||
packageSetting.updateAvailable = updateAvailable;
|
||||
packageSetting.forceQueryableOverride = installedForceQueryable;
|
||||
packageSetting.incrementalStates = new IncrementalStates(isStartable, isLoading);
|
||||
packageSetting.incrementalStates = new IncrementalStates(isStartable, isLoading,
|
||||
loadingProgress);
|
||||
// Handle legacy string here for single-user mode
|
||||
final String enabledStr = parser.getAttributeValue(null, ATTR_ENABLED);
|
||||
if (enabledStr != null) {
|
||||
@@ -4814,6 +4820,10 @@ public final class Settings implements Watchable, Snappable {
|
||||
pw.print(prefix); pw.print(" installerAttributionTag=");
|
||||
pw.println(ps.installSource.installerAttributionTag);
|
||||
}
|
||||
if (IncrementalManager.isIncrementalPath(ps.getPathString())) {
|
||||
pw.print(prefix); pw.println(" loadingProgress="
|
||||
+ (int) (ps.getIncrementalStates().getProgress() * 100) + "%");
|
||||
}
|
||||
if (ps.volumeUuid != null) {
|
||||
pw.print(prefix); pw.print(" volumeUuid=");
|
||||
pw.println(ps.volumeUuid);
|
||||
|
||||
Reference in New Issue
Block a user