Don't update the standby bucket for apps that were just restored.

This prevents an app's bucket from being lowered due to a timeout if the
app hasn't been used since it was restored.

Bug: 214580000
Test: atest UsageStatsDatabaseTest
Test: manually verify buckets are restored
Change-Id: I1df310afabf2abde7bf91daab0142114bf244ec8
(cherry picked from commit d1fb46c68d)
This commit is contained in:
Varun Shah
2022-12-14 14:42:41 -08:00
parent 49fedfb025
commit a31610f23a

View File

@@ -968,13 +968,17 @@ public class AppStandbyController
+ standbyBucketToString(newBucket));
}
} else {
newBucket = getBucketForLocked(packageName, userId,
elapsedRealtime);
if (DEBUG) {
Slog.d(TAG, "Evaluated AOSP newBucket = "
+ standbyBucketToString(newBucket));
// Don't update the standby state for apps that were restored
if (!(oldMainReason == REASON_MAIN_DEFAULT
&& (app.bucketingReason & REASON_SUB_MASK)
== REASON_SUB_DEFAULT_APP_RESTORED)) {
newBucket = getBucketForLocked(packageName, userId, elapsedRealtime);
if (DEBUG) {
Slog.d(TAG, "Evaluated AOSP newBucket = "
+ standbyBucketToString(newBucket));
}
reason = REASON_MAIN_TIMEOUT;
}
reason = REASON_MAIN_TIMEOUT;
}
}