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

Commit 584a4451 authored by Bryce Lee's avatar Bryce Lee
Browse files

[Theater Mode] framework implementation through global setting

Bug: 17684570
Change-Id: I64a9c9c0620049cdfcca0150648fa201281f7178
parent e463bc38
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -5085,6 +5085,12 @@ public final class Settings {
         */
        public static final String AIRPLANE_MODE_ON = "airplane_mode_on";

        /**
         * Whether Theater Mode is on.
         * {@hide}
         */
        public static final String THEATER_MODE_ON = "theater_mode_on";

        /**
         * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
         */
+20 −0
Original line number Diff line number Diff line
@@ -453,6 +453,26 @@
    <!-- If this is true, key chords can be used to take a screenshot on the device. -->
    <bool name="config_enableScreenshotChord">true</bool>

    <!-- If this is true, allow wake from theater mode when plugged in or unplugged. -->
    <bool name="config_allowTheaterModeWakeFromUnplug">false</bool>
    <!-- If this is true, allow wake from theater mode from gesture. -->
    <bool name="config_allowTheaterModeWakeFromGesture">false</bool>
    <!-- If this is true, allow wake from theater mode from camera lens cover is switched. -->
    <bool name="config_allowTheaterModeWakeFromCameraLens">false</bool>
    <!-- If this is true, allow wake from theater mode from power key press. -->
    <bool name="config_allowTheaterModeWakeFromPowerKey">true</bool>
    <!-- If this is true, allow wake from theater mode from regular key press. Setting this value to
         true implies config_allowTheaterModeWakeFromPowerKey is also true-->
    <bool name="config_allowTheaterModeWakeFromKey">false</bool>
    <!-- If this is true, allow wake from theater mode from motion. -->
    <bool name="config_allowTheaterModeWakeFromMotion">false</bool>
    <!-- If this is true, allow wake from theater mode from lid switch. -->
    <bool name="config_allowTheaterModeWakeFromLidSwitch">false</bool>
    <!-- If this is true, allow wake from theater mode when docked. -->
    <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>

    <!-- Auto-rotation behavior -->

    <!-- If true, enables auto-rotation features using the accelerometer.
+9 −0
Original line number Diff line number Diff line
@@ -1571,6 +1571,15 @@
  <java-symbol type="bool" name="config_enableNetworkLocationOverlay" />
  <java-symbol type="bool" name="config_sf_limitedAlpha" />
  <java-symbol type="bool" name="config_unplugTurnsOnScreen" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromUnplug" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromGesture" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromCameraLens" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromPowerKey" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromKey" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromMotion" />
  <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_wifi_background_scan_support" />
  <java-symbol type="bool" name="config_wifi_dual_band_support" />
  <java-symbol type="bool" name="config_wimaxEnabled" />
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
    <integer name="def_screen_off_timeout">60000</integer>
    <integer name="def_sleep_timeout">-1</integer>
    <bool name="def_airplane_mode_on">false</bool>
    <bool name="def_theater_mode_on">false</bool>
    <!-- Comma-separated list of bluetooth, wifi, and cell. -->
    <string name="def_airplane_mode_radios" translatable="false">cell,bluetooth,wifi,nfc,wimax</string>
    <string name="airplane_mode_toggleable_radios" translatable="false">bluetooth,wifi,nfc</string>
+20 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
    // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
    // is properly propagated through your change.  Not doing so will result in a loss of user
    // settings.
    private static final int DATABASE_VERSION = 113;
    private static final int DATABASE_VERSION = 114;

    private Context mContext;
    private int mUserHandle;
@@ -1827,6 +1827,22 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 113;
        }

        if (upgradeVersion < 114) {
            db.beginTransaction();
            SQLiteStatement stmt = null;
            try {
                stmt = db.compileStatement("INSERT OR IGNORE INTO global(name,value)"
                        + " VALUES(?,?);");
                loadBooleanSetting(stmt, Global.THEATER_MODE_ON,
                        R.bool.def_theater_mode_on);
                db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
                if (stmt != null) stmt.close();
            }
            upgradeVersion = 114;
        }

        // *** Remember to update DATABASE_VERSION above!

        if (upgradeVersion != currentVersion) {
@@ -2423,6 +2439,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            loadBooleanSetting(stmt, Settings.Global.AIRPLANE_MODE_ON,
                    R.bool.def_airplane_mode_on);

            loadBooleanSetting(stmt, Settings.Global.THEATER_MODE_ON,
                    R.bool.def_theater_mode_on);

            loadStringSetting(stmt, Settings.Global.AIRPLANE_MODE_RADIOS,
                    R.string.def_airplane_mode_radios);

Loading