summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Songchun Fan <schfan@google.com> 2021-07-15 17:49:40 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-07-15 17:49:40 +0000
commit61db3a23ee5b60ec5dfb0066e807d7a62aebe02f (patch)
treef695fa97447448e1b9072d06bceb9447d0c14fab
parent3a2373352fd153469d8e6e084049e0f52846ef9d (diff)
parentdd2b4a007f2365947121be4522eb4ba3f7f545dc (diff)
Merge "[pm] fix non-incremental install progress regression" into sc-dev
-rw-r--r--services/core/java/com/android/server/pm/PackageInstallerSession.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/pm/PackageInstallerSession.java b/services/core/java/com/android/server/pm/PackageInstallerSession.java
index 6adde9ad25fd..00ef97d7a17a 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerSession.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java
@@ -1265,12 +1265,13 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
@GuardedBy("mProgressLock")
private void computeProgressLocked(boolean forcePublish) {
- if (!mCommitted) {
+ if (!isIncrementalInstallation() || !mCommitted) {
mProgress = MathUtils.constrain(mClientProgress * 0.8f, 0f, 0.8f)
+ MathUtils.constrain(mInternalProgress * 0.2f, 0f, 0.2f);
} else {
- // For incremental install, continue to publish incremental progress during committing.
- if (isIncrementalInstallation() && (mIncrementalProgress - mProgress) >= 0.01) {
+ // For incremental, publish regular install progress before the session is committed,
+ // but publish incremental progress afterwards.
+ if (mIncrementalProgress - mProgress >= 0.01) {
// It takes some time for data loader to write to incremental file system, so at the
// beginning of the commit, the incremental progress might be very small.
// Wait till the incremental progress is larger than what's already displayed.
@@ -1279,7 +1280,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
}
}
- // Only publish when meaningful change
+ // Only publish meaningful progress changes.
if (forcePublish || (mProgress - mReportedProgress) >= 0.01) {
mReportedProgress = mProgress;
mCallback.onSessionProgressChanged(this, mProgress);