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

Commit a0ef1ca2 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Cleanup old idle variables

Switch to using the new bucket thresholds and
remove the previous idle thresholds.

Bug: 63527785
Test: atest AppStandbyControllerTests
      atest AppIdleHistoryTests

Change-Id: Ica3fd10fe172faa5b4e712b08273b77357fdae14
parent 0afe0849
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -91,8 +91,6 @@ public class AppIdleHistory {
    private long mScreenOnSnapshot; // Elapsed time snapshot when last write of mScreenOnDuration
    private long mScreenOnDuration; // Total screen on duration since device was "born"

    private long mElapsedTimeThreshold;
    private long mScreenOnTimeThreshold;
    private final File mStorageDir;

    private boolean mScreenOn;
@@ -113,11 +111,6 @@ public class AppIdleHistory {
        readScreenOnTime();
    }

    public void setThresholds(long elapsedTimeThreshold, long screenOnTimeThreshold) {
        mElapsedTimeThreshold = elapsedTimeThreshold;
        mScreenOnTimeThreshold = screenOnTimeThreshold;
    }

    public void updateDisplay(boolean screenOn, long elapsedRealtime) {
        if (screenOn == mScreenOn) return;

+3 −22
Original line number Diff line number Diff line
@@ -140,9 +140,7 @@ public class AppStandbyController {
    static final int MSG_PAROLE_STATE_CHANGED = 9;
    static final int MSG_ONE_TIME_CHECK_IDLE_STATES = 10;

    long mAppIdleScreenThresholdMillis;
    long mCheckIdleIntervalMillis;
    long mAppIdleWallclockThresholdMillis;
    long mAppIdleParoleIntervalMillis;
    long mAppIdleParoleDurationMillis;
    long[] mAppStandbyScreenThresholds = SCREEN_TIME_THRESHOLDS;
@@ -912,14 +910,6 @@ public class AppStandbyController {
        pw.println();
        pw.println("Settings:");

        pw.print("  mAppIdleDurationMillis=");
        TimeUtils.formatDuration(mAppIdleScreenThresholdMillis, pw);
        pw.println();

        pw.print("  mAppIdleWallclockThresholdMillis=");
        TimeUtils.formatDuration(mAppIdleWallclockThresholdMillis, pw);
        pw.println();

        pw.print("  mCheckIdleIntervalMillis=");
        TimeUtils.formatDuration(mCheckIdleIntervalMillis, pw);
        pw.println();
@@ -1192,24 +1182,12 @@ public class AppStandbyController {
                    // fallthrough, mParser is empty and all defaults will be returned.
                }

                // Default: 12 hours of screen-on time sans dream-time
                mAppIdleScreenThresholdMillis = mParser.getLong(KEY_IDLE_DURATION,
                        COMPRESS_TIME ? ONE_MINUTE * 4 : 12 * 60 * ONE_MINUTE);

                mAppIdleWallclockThresholdMillis = mParser.getLong(KEY_WALLCLOCK_THRESHOLD,
                        COMPRESS_TIME ? ONE_MINUTE * 8 : 2L * 24 * 60 * ONE_MINUTE); // 2 days

                mCheckIdleIntervalMillis = Math.min(mAppIdleScreenThresholdMillis / 4,
                        COMPRESS_TIME ? ONE_MINUTE : 4 * 60 * ONE_MINUTE); // 4 hours

                // Default: 24 hours between paroles
                mAppIdleParoleIntervalMillis = mParser.getLong(KEY_PAROLE_INTERVAL,
                        COMPRESS_TIME ? ONE_MINUTE * 10 : 24 * 60 * ONE_MINUTE);

                mAppIdleParoleDurationMillis = mParser.getLong(KEY_PAROLE_DURATION,
                        COMPRESS_TIME ? ONE_MINUTE : 10 * ONE_MINUTE); // 10 minutes
                mAppIdleHistory.setThresholds(mAppIdleWallclockThresholdMillis,
                        mAppIdleScreenThresholdMillis);

                String screenThresholdsValue = mParser.getString(KEY_SCREEN_TIME_THRESHOLDS, null);
                mAppStandbyScreenThresholds = parseLongArray(screenThresholdsValue,
@@ -1219,6 +1197,9 @@ public class AppStandbyController {
                        null);
                mAppStandbyElapsedThresholds = parseLongArray(elapsedThresholdsValue,
                        ELAPSED_TIME_THRESHOLDS);
                mCheckIdleIntervalMillis = Math.min(mAppStandbyElapsedThresholds[1] / 4,
                        COMPRESS_TIME ? ONE_MINUTE : 4 * 60 * ONE_MINUTE); // 4 hours

            }
        }