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

Commit 55e846d4 authored by Bryce Lee's avatar Bryce Lee
Browse files

Add config to control going to sleep when entering theater mode.

Bug: 18241209
Change-Id: I7fa29d92391b1c8ab74585008d6599fd7174cc61
parent 2750e9ff
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -472,6 +472,8 @@
    <bool name="config_allowTheaterModeWakeFromDock">false</bool>
    <!-- If this is true, allow wake from theater mode from window layout flag. -->
    <bool name="config_allowTheaterModeWakeFromWindowLayout">false</bool>
    <!-- If this is true, go to sleep when theater mode is enabled from button press -->
    <bool name="config_goToSleepOnButtonPressTheaterMode">true</bool>

    <!-- Auto-rotation behavior -->

+1 −0
Original line number Diff line number Diff line
@@ -1582,6 +1582,7 @@
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromLidSwitch" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromDock" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromWindowLayout" />
  <java-symbol type="bool" name="config_goToSleepOnButtonPressTheaterMode" />
  <java-symbol type="bool" name="config_wifi_background_scan_support" />
  <java-symbol type="bool" name="config_wifi_dual_band_support" />
  <java-symbol type="bool" name="config_wimaxEnabled" />
+8 −1
Original line number Diff line number Diff line
@@ -526,6 +526,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    private boolean mAllowTheaterModeWakeFromLidSwitch;
    private boolean mAllowTheaterModeWakeFromWakeGesture;

    // Whether to go to sleep entering theater mode from power button
    private boolean mGoToSleepOnButtonPressTheaterMode;

    // Screenshot trigger states
    // Time to volume and power must be pressed within this interval of each other.
    private static final long SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS = 150;
@@ -983,7 +986,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    Slog.i(TAG, "Toggling theater mode on.");
                    Settings.Global.putInt(mContext.getContentResolver(),
                            Settings.Global.THEATER_MODE_ON, 1);
                    if (interactive) {

                    if (mGoToSleepOnButtonPressTheaterMode && interactive) {
                        mPowerManager.goToSleep(eventTime,
                                PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON, 0);
                    }
@@ -1235,6 +1239,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        mAllowTheaterModeWakeFromWakeGesture = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_allowTheaterModeWakeFromGesture);

        mGoToSleepOnButtonPressTheaterMode = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_goToSleepOnButtonPressTheaterMode);

        mShortPressOnPowerBehavior = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_shortPressOnPowerBehavior);
        mLongPressOnPowerBehavior = mContext.getResources().getInteger(