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

Commit c5d9dc8a authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

TEMPORARY: Reintroduce button-backlight (and respective inactivity timeout)

The power manager rewrite from Change I1d7a52e98f0449f76d70bf421f6a7f245957d1d7
completely removed support for control of the button backlights, which makes
all capacitive buttons out there stay dark. The commit message in that change
mentions it hasn't been implemented _yet_, so this fix should be temporary
until upstream does their own implementation

Change-Id: I6094c446e0b8c23f57d30652a3cbd35dee5e821a
parent 09592c64
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -768,6 +768,7 @@ final class DisplayPowerController {
            if (on) {
                mNotifier.onScreenOn();
            } else {
                mLights.getLight(LightsService.LIGHT_ID_BUTTONS).setBrightness(0);
                mNotifier.onScreenOff();
            }
        }
+9 −0
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ public final class PowerManagerService extends IPowerManager.Stub
    // This is subtracted from the end of the screen off timeout so the
    // minimum screen off timeout should be longer than this.
    private static final int SCREEN_DIM_DURATION = 7 * 1000;
    private static final int BUTTON_ON_DURATION = 5 * 1000;

    // The maximum screen dim time expressed as a ratio relative to the screen
    // off timeout.  If the screen off timeout is very short then we want the
@@ -182,6 +183,7 @@ public final class PowerManagerService extends IPowerManager.Stub
    private SettingsObserver mSettingsObserver;
    private DreamManagerService mDreamManager;
    private LightsService.Light mAttentionLight;
    private LightsService.Light mButtonsLight;

    private final Object mLock = new Object();

@@ -437,6 +439,7 @@ public final class PowerManagerService extends IPowerManager.Stub

            mSettingsObserver = new SettingsObserver(mHandler);
            mAttentionLight = mLightsService.getLight(LightsService.LIGHT_ID_ATTENTION);
            mButtonsLight = mLightsService.getLight(LightsService.LIGHT_ID_BUTTONS);

            // Register for broadcasts from other components of the system.
            IntentFilter filter = new IntentFilter();
@@ -1290,6 +1293,12 @@ public final class PowerManagerService extends IPowerManager.Stub
                    nextTimeout = mLastUserActivityTime
                            + screenOffTimeout - screenDimDuration;
                    if (now < nextTimeout) {
                        if (now > mLastUserActivityTime + BUTTON_ON_DURATION) {
                            mButtonsLight.setBrightness(0);
                        } else {
                            mButtonsLight.setBrightness(mDisplayPowerRequest.screenBrightness);
                            nextTimeout = now + BUTTON_ON_DURATION;
                        }
                        mUserActivitySummary |= USER_ACTIVITY_SCREEN_BRIGHT;
                    } else {
                        nextTimeout = mLastUserActivityTime + screenOffTimeout;