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: Ic6c357c98ccab6b221dc4cfd18371c318b9e2fb6
This commit is contained in:
@@ -118,12 +118,19 @@ public final class IncrementalStates {
|
|||||||
* @param progress Value between [0, 1].
|
* @param progress Value between [0, 1].
|
||||||
*/
|
*/
|
||||||
public void setProgress(float progress) {
|
public void setProgress(float progress) {
|
||||||
|
final boolean oldLoadingState;
|
||||||
final boolean newLoadingState;
|
final boolean newLoadingState;
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
|
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);
|
updateProgressLocked(progress);
|
||||||
|
}
|
||||||
newLoadingState = mLoadingState.isLoading();
|
newLoadingState = mLoadingState.isLoading();
|
||||||
}
|
}
|
||||||
if (!newLoadingState) {
|
if (oldLoadingState && !newLoadingState) {
|
||||||
|
// Only report the state change when loading state changes from true to false
|
||||||
onLoadingStateChanged();
|
onLoadingStateChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user