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

This commit is contained in:
Songchun Fan
2021-07-29 15:49:03 +00:00
committed by Android (Google) Code Review

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