Merge "[pm] ignore partial progress update after off-incfs migration" into sc-dev am: 5ba5f1392f

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

Change-Id: I7de2383476383a6987e3c9872961400d326c177b
This commit is contained in:
Songchun Fan
2021-07-29 16:03:30 +00:00
committed by Automerger Merge Worker

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();
}
}