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

Commit 1d327d1b authored by William Leshner's avatar William Leshner Committed by Android (Google) Code Review
Browse files

Merge "Add a "restrict to wireless" option to when to dream/hub settings." into main

parents ec1e86cd e872468a
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -10675,6 +10675,14 @@ public final class Settings {
        public static final String WHEN_TO_START_GLANCEABLE_HUB =
                "when_to_start_glanceable_hub";
        /**
         * Whether glanceable hub should only start when charging wirelessly.
         *
         * @hide
         */
        public static final String GLANCEABLE_HUB_RESTRICT_TO_WIRELESS_CHARGING =
                "glanceable_hub_restrict_to_writeless_charging";
        /**
         * Whether home controls are enabled to be shown over the screensaver by the user.
         *
@@ -10683,6 +10691,13 @@ public final class Settings {
        public static final String SCREENSAVER_HOME_CONTROLS_ENABLED =
                "screensaver_home_controls_enabled";
        /**
         * Whether screensaver should only start when charging wirelessly.
         *
         * @hide
         */
        public static final String SCREENSAVER_RESTRICT_TO_WIRELESS_CHARGING =
                "screensaver_restrict_to_writeless_charging";
        /**
         * Default, indicates that the user has not yet started the dock setup flow.
+2 −0
Original line number Diff line number Diff line
@@ -2849,6 +2849,8 @@
    <!-- The default for the setting that controls when to auto-start hub mode.
          0 means "never" -->
    <integer name="config_whenToStartHubModeDefault">0</integer>
    <!-- Whether to restrict auto-showing glanceable hub to wireless charging. -->
    <bool name="config_onlyShowGlanceableHubWhenWirelessChargingDefault">false</bool>

    <!-- The duration in milliseconds of the dream opening animation.  -->
    <integer name="config_dreamOpenAnimationDuration">250</integer>
+1 −0
Original line number Diff line number Diff line
@@ -2078,6 +2078,7 @@
  <java-symbol type="bool" name="config_keepDreamingWhenUnplugging" />
  <java-symbol type="bool" name="config_glanceableHubEnabled" />
  <java-symbol type="integer" name="config_whenToStartHubModeDefault" />
  <java-symbol type="bool" name="config_onlyShowGlanceableHubWhenWirelessChargingDefault" />
  <java-symbol type="integer" name="config_keyguardDrawnTimeout" />
  <java-symbol type="bool" name="config_goToSleepOnButtonPressTheaterMode" />
  <java-symbol type="bool" name="config_supportLongPressPowerWhenNonInteractive" />
+14 −0
Original line number Diff line number Diff line
@@ -388,6 +388,20 @@ public class DreamBackend {
                Settings.Secure.SCREENSAVER_COMPLICATIONS_ENABLED, 1) == 1;
    }

    /** Set whether to restrict showing dreams to only when charging wirelessly. */
    public void setRestrictToWirelessCharging(boolean restrict) {
        Settings.Secure.putInt(
                mContext.getContentResolver(),
                Settings.Secure.SCREENSAVER_RESTRICT_TO_WIRELESS_CHARGING, restrict ? 1 : 0);
    }

    /** Get whether to restrict showing dreams to only when charging wirelessly. */
    public boolean getRestrictToWirelessCharging() {
        return Settings.Secure.getInt(
                mContext.getContentResolver(),
                Settings.Secure.SCREENSAVER_RESTRICT_TO_WIRELESS_CHARGING, 0) == 1;
    }

    /** Gets all dream complications which are supported on this device. **/
    public Set<Integer> getSupportedComplications() {
        return mSupportedComplications;
+17 −0
Original line number Diff line number Diff line
@@ -228,6 +228,23 @@ public final class DreamBackendTest {
                DreamBackend.WHILE_DOCKED);
    }

    @Test
    public void testSetRestrictedToWirelessCharging() {
        mBackend.setRestrictToWirelessCharging(true);
        assertThat(mBackend.getRestrictToWirelessCharging()).isTrue();
    }

    @Test
    public void testGetRestrictedToWirelessCharging() {
        Settings.Secure.putInt(
                mContext.getContentResolver(),
                Settings.Secure.SCREENSAVER_RESTRICT_TO_WIRELESS_CHARGING,
                1
        );

        assertThat(mBackend.getRestrictToWirelessCharging()).isTrue();
    }

    private void setControlsEnabledOnLockscreen(boolean enabled) {
        Settings.Secure.putInt(
                mContext.getContentResolver(),
Loading