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

Commit 85d4e718 authored by Fiona Campbell's avatar Fiona Campbell
Browse files

Create Sleeplocks flag

Bug: 422693117
Flag: com.android.server.power.feature.flags.sleeplocks
Test: printflags | grep -i sleep

Change-Id: I3e7ad2342b7abb2226ae1240fc1df6a22f15ba37
parent 16f2f201
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -75,6 +75,11 @@ public class PowerManagerFlags {
            new FlagState(Flags.FLAG_ENABLE_APP_WAKELOCK_DATA_SOURCE,
                    Flags::enableAppWakelockDataSource);

    private final FlagState mSleeplocks = new FlagState(
            Flags.FLAG_SLEEPLOCKS,
            Flags::sleeplocks
    );

    /** Returns whether early-screen-timeout-detector is enabled on not. */
    public boolean isEarlyScreenTimeoutDetectorEnabled() {
        return mEarlyScreenTimeoutDetectorFlagState.isEnabled();
@@ -142,6 +147,14 @@ public class PowerManagerFlags {
        return mEnableAppWakelockDataSource.isEnabled();
    }

    /**
     * @return Whether new wakelock to keep device asleep - for the user, but ensures the CPU
     * remains awake - is enabled.
     */
    public boolean isSleeplocksFeatureEnabled() {
        return mSleeplocks.isEnabled();
    }

    /**
     * dumps all flagstates
     * @param pw printWriter
@@ -156,6 +169,7 @@ public class PowerManagerFlags {
        pw.println(" " + mDisableFrozenProcessWakelocks);
        pw.println(" " + mForceDisableWakelocks);
        pw.println(" " + mEnableAppWakelockDataSource);
        pw.println(" " + mSleeplocks);
    }

    private static class FlagState {
+8 −0
Original line number Diff line number Diff line
@@ -91,3 +91,11 @@ flag {
    description: "Feature flag to have a system API which shuts down the device."
    bug: "365055195"
}

flag {
    name: "sleeplocks"
    namespace: "power"
    description: "Enable new wakelock to keep device asleep - for the user, but ensure that the CPU remains awake."
    bug: "401624085"
    is_fixed_read_only: true
}