diff options
| author | 2021-03-19 23:26:06 +0000 | |
|---|---|---|
| committer | 2021-03-23 15:44:28 +0000 | |
| commit | ab60442c7b05927f5b7c0ff0010fed6b042d7d40 (patch) | |
| tree | e189546a9cb3a765219dfad3d914e62f4e70c7f4 | |
| parent | f3a77c8fa598a371238bfa4362883ae6a0007908 (diff) | |
[pm] fix progress on commit for non-incremental apps
Previous change resets non-incremental install progress to 0 upon
committing.
BUG: 182698653
Test: manual
Change-Id: I6124660362e8d6cbf9fc8af47886c3fc4077c5a0
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageInstallerSession.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/pm/PackageInstallerSession.java b/services/core/java/com/android/server/pm/PackageInstallerSession.java index bafe987cb546..67638bccf7fa 100644 --- a/services/core/java/com/android/server/pm/PackageInstallerSession.java +++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java @@ -1212,12 +1212,18 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { mProgress = MathUtils.constrain(mClientProgress * 0.8f, 0f, 0.8f) + MathUtils.constrain(mInternalProgress * 0.2f, 0f, 0.2f); } else { - // For incremental installs, continue publishing the install progress during committing. - mProgress = mIncrementalProgress; + // For incremental install, continue to publish incremental progress during committing. + if (isIncrementalInstallation() && (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. + // This way we don't see the progress ring going backwards. + mProgress = mIncrementalProgress; + } } // Only publish when meaningful change - if (forcePublish || Math.abs(mProgress - mReportedProgress) >= 0.01) { + if (forcePublish || (mProgress - mReportedProgress) >= 0.01) { mReportedProgress = mProgress; mCallback.onSessionProgressChanged(this, mProgress); } |