Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1fb46c6 authored by Varun Shah's avatar Varun Shah
Browse files

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
parent 497aa8cb
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -1009,8 +1009,11 @@ public class AppStandbyController
                                    + standbyBucketToString(newBucket));
                        }
                    } else {
                        newBucket = getBucketForLocked(packageName, userId,
                                elapsedRealtime);
                        // 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));
@@ -1018,6 +1021,7 @@ public class AppStandbyController
                            reason = REASON_MAIN_TIMEOUT;
                        }
                    }
                }

                // Check if the app is within one of the expiry times for forced bucket elevation
                final long elapsedTimeAdjusted = mAppIdleHistory.getElapsedTime(elapsedRealtime);