[pm] ignore partial progress update after off-incfs migration

When we migrate a partially loaded app off incremental, the incomplete
progress could still be reported by incfs, right before the incfs
instance is deleted. This partial progress could override the full
progress reported by the update installation. And after the incfs
instance is deleted, there will be no more progress update. As a result,
the launcher gets the last progress update as a partial progress, and
the progress loading icon remain partially loaded until reboot.

This CL fixes the problem by rejecting partial progress reported from
incfs after the progress has already been changed to 100%. In reality it
could only happen during off-incfs migration. It also applies in general as
the progress number should never go from 100% to below 100%.

BUG: 187762951
Test: manual
Change-Id: I3b87226a4e75d71f0d8e4886917e4456b355e1fa
This commit is contained in:
Songchun Fan
2021-07-28 12:08:39 -07:00
parent 1219bfb27f
commit 5a4e8283e9

View File

@@ -118,12 +118,19 @@ public final class IncrementalStates {
* @param progress Value between [0, 1].
*/
public void setProgress(float progress) {
final boolean oldLoadingState;
final boolean newLoadingState;
synchronized (mLock) {
updateProgressLocked(progress);
oldLoadingState = mLoadingState.isLoading();
if (oldLoadingState) {
// Due to asynchronous progress reporting, incomplete progress might be received
// after the app is migrated off incremental. Ignore such progress updates.
updateProgressLocked(progress);
}
newLoadingState = mLoadingState.isLoading();
}
if (!newLoadingState) {
if (oldLoadingState && !newLoadingState) {
// Only report the state change when loading state changes from true to false
onLoadingStateChanged();
}
}