[incremental] increase progress comparison precision

This ensures that the package is not regarded as fully loaded even if
only 1 page is missing in a 4GB app.

BUG: 182205656
Test: atest android.cts.statsdatom.statsd.IncrementalAtomTests
Change-Id: Id6f41a77c690c01cf0d210e6b09708572a36e088
This commit is contained in:
Songchun Fan
2021-03-31 18:38:40 +00:00
parent 867e305d88
commit e4895f437c

View File

@@ -293,11 +293,11 @@ public final class IncrementalStates {
Slog.i(TAG, "received progress update: " + progress);
}
mLoadingState.setProgress(progress);
if (1 - progress < 0.001) {
if (Math.abs(1.0f - progress) < 0.00000001f) {
if (DEBUG) {
Slog.i(TAG, "package is fully loaded");
}
mLoadingState.setProgress(1);
mLoadingState.setProgress(1.0f);
if (mLoadingState.isLoading()) {
mLoadingState.adoptNewLoadingStateLocked(false);
}