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

Commit bfb4b483 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix bucket change issues." into tm-dev am: 5a2d6f72

parents 4b6c61d3 5a2d6f72
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -979,6 +979,7 @@ public class AppIdleHistory {
            dumpBucketExpiryTimes(idpw, appUsageHistory, totalElapsedTime);
            idpw.print(" lastJob=");
            TimeUtils.formatDuration(totalElapsedTime - appUsageHistory.lastJobRunTime, idpw);
            idpw.print(" lastInformedBucket=" + appUsageHistory.lastInformedBucket);
            if (appUsageHistory.lastRestrictAttemptElapsedTime > 0) {
                idpw.print(" lastRestrictAttempt=");
                TimeUtils.formatDuration(
+13 −5
Original line number Diff line number Diff line
@@ -1155,6 +1155,12 @@ public class AppStandbyController

        final int appId = getAppId(packageName);
        if (appId < 0) return;
        final int minBucket = getAppMinBucket(packageName, appId, userId);
        if (idle && minBucket < AppIdleHistory.IDLE_BUCKET_CUTOFF) {
            Slog.e(TAG, "Tried to force an app to be idle when its min bucket is "
                    + standbyBucketToString(minBucket));
            return;
        }
        final long elapsedRealtime = mInjector.elapsedRealtime();

        final boolean previouslyIdle = isAppIdleFiltered(packageName, appId,
@@ -1166,12 +1172,10 @@ public class AppStandbyController
        final boolean stillIdle = isAppIdleFiltered(packageName, appId,
                userId, elapsedRealtime);
        // Inform listeners if necessary
        if (previouslyIdle != stillIdle) {
        maybeInformListeners(packageName, userId, elapsedRealtime, standbyBucket,
                REASON_MAIN_FORCED_BY_USER, false);
            if (!stillIdle) {
                notifyBatteryStats(packageName, userId, idle);
            }
        if (previouslyIdle != stillIdle) {
            notifyBatteryStats(packageName, userId, stillIdle);
        }
    }

@@ -1934,6 +1938,8 @@ public class AppStandbyController
            }
            mAppIdleHistory.setAppStandbyBucket(
                    packageName, userId, elapsedRealtime, newBucket, newReason);
            maybeInformListeners(packageName, userId, elapsedRealtime, newBucket,
                    newReason, false);
        }
    }

@@ -2490,6 +2496,8 @@ public class AppStandbyController
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case MSG_INFORM_LISTENERS:
                    // TODO(230875908): Properly notify BatteryStats when apps change from active to
                    // idle, and vice versa
                    StandbyUpdateRecord r = (StandbyUpdateRecord) msg.obj;
                    informListeners(r.packageName, r.userId, r.bucket, r.reason,
                            r.isUserInteraction);