Merge "[pm] fix non-incremental install progress regression" into sc-dev am: 61db3a23ee

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15285367

Change-Id: Ia76d3a2dbccdd6363522871db01e8c6b1d038db0
This commit is contained in:
Songchun Fan
2021-07-15 18:01:05 +00:00
committed by Automerger Merge Worker

View File

@@ -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);