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

Commit 1ad58d0a authored by Doris Ling's avatar Doris Ling
Browse files

Split Ambient Display settings.

1. Reverting the changes for Display->Ambient Display; this setting
   will control incoming notification pulse.
2. Added 2 separate entries in gestures settings to control pick up
   and double tap gestures-triggered pulsing for Ambient Display.
3. Added automated tests to verify the preference initializes to the
   correct default value, and also verify that toggling the preference
   updates the corresponding settings correctly.

Test: make SettingsTests

Bug: 30595437
Change-Id: I125bf75fc4ccfea126a00ffae4207fcb789f487a
parent a365d912
Loading
Loading
Loading
Loading
+0 −0

Empty file added.

+20 −6
Original line number Diff line number Diff line
@@ -2229,7 +2229,7 @@
    <!-- [CHAR LIMIT=30] Display settings screen, setting option name to change whether the ambient display feature is enabled. -->
    <string name="doze_title">Ambient display</string>
    <!-- [CHAR LIMIT=NONE] Display settings screen, setting description for the ambient display feature. -->
    <string name="doze_summary">Wake screen when you double-tap it or get new notifications. See how</string>
    <string name="doze_summary">Wake screen when you receive notifications</string>
    <!-- [CHAR LIMIT=30] Sound & display settings screen, setting option name to change font size -->
    <string name="title_font_size">Font size</string>
    <!-- Summary for Font size. Lets the user know that this will make text larger or smaller. Appears in the accessibility portion of setup wizard. [CHAR LIMIT=NONE] -->
@@ -7762,11 +7762,25 @@
    <!-- Summary text for double twist for camera mode  [CHAR LIMIT=160]-->
    <string name="double_twist_for_camera_mode_summary"></string>
    <!-- Title text for ambient display [CHAR LIMIT=60]-->
    <string name="ambient_display_title">Quick screen check</string>
    <!-- Summary text for ambient display [CHAR LIMIT=160]-->
    <string name="ambient_display_summary">To check your phone without waking it up fully, double-tap it or pick it up</string>
    <!-- Title text for ambient display double tap [CHAR LIMIT=60]-->
    <string name="ambient_display_title">Quick screen check - Double Tap</string>
    <!-- Summary text for ambient display double tap (phone) [CHAR LIMIT=160]-->
    <string name="ambient_display_summary" product="default">To check your phone without waking it up fully, double-tap it</string>
    <!-- Summary text for ambient display double tap (tablet) [CHAR LIMIT=160]-->
    <string name="ambient_display_summary" product="tablet">To check your tablet without waking it up fully, double-tap it</string>
    <!-- Summary text for ambient display double tap (device) [CHAR LIMIT=160]-->
    <string name="ambient_display_summary" product="device">To check your device without waking it up fully, double-tap it</string>
    <!-- Title text for ambient display pick up [CHAR LIMIT=60]-->
    <string name="ambient_display_pickup_title">Quick screen check - Pickup notifications</string>
    <!-- Summary text for ambient display (phone) [CHAR LIMIT=160]-->
    <string name="ambient_display_pickup_summary" product="default">To check your phone without waking it up fully, pick it up</string>
    <!-- Summary text for ambient display (tablet) [CHAR LIMIT=160]-->
    <string name="ambient_display_pickup_summary" product="tablet">To check your tablet without waking it up fully, pick it up</string>
    <!-- Summary text for ambient display (device) [CHAR LIMIT=160]-->
    <string name="ambient_display_pickup_summary" product="device">To check your device without waking it up fully, pick it up</string>
    <!-- Title text for fingerprint swipe for notifications [CHAR LIMIT=60]-->
    <string name="fingerprint_swipe_for_notifications_title">Swipe for notifications</string>
+3 −12
Original line number Diff line number Diff line
@@ -79,19 +79,10 @@
                android:key="lift_to_wake"
                android:title="@string/lift_to_wake_title" />

        <PreferenceScreen
        <SwitchPreference
                android:key="doze"
                android:title="@string/ambient_display_title"
                android:summary="@string/doze_summary" >
                <intent
                    android:targetPackage="com.android.settings"
                    android:targetClass="com.android.settings.Settings$GestureSettingsActivity" >
                    <extra android:name="show_drawer_menu"
                           android:value="true" />
                    <extra android:name="gesture_scroll_to_preference"
                           android:value="gesture_pick_up_and_nudge" />
                </intent>
        </PreferenceScreen>
                android:title="@string/doze_title"
                android:summary="@string/doze_summary" />

        <SwitchPreference
                android:key="tap_to_wake"
+11 −5
Original line number Diff line number Diff line
@@ -38,9 +38,15 @@
        settings:animation="@raw/gesture_twist"/>

    <com.android.settings.gestures.GesturePreference
        android:key="gesture_pick_up_and_nudge"
        android:key="gesture_double_tap_screen"
        android:title="@string/ambient_display_title"
        android:summary="@string/ambient_display_summary"
        settings:animation="@raw/gesture_ambient_tap"/>

    <com.android.settings.gestures.GesturePreference
        android:key="gesture_pick_up"
        android:title="@string/ambient_display_pickup_title"
        android:summary="@string/ambient_display_pickup_summary"
        settings:animation="@raw/gesture_ambient_lift"/>

</PreferenceScreen>
 No newline at end of file
+15 −5
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ import android.support.v7.preference.DropDownPreference;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.Log;

@@ -97,10 +96,10 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
    private ListPreference mNightModePreference;
    private Preference mScreenSaverPreference;
    private SwitchPreference mLiftToWakePreference;
    private SwitchPreference mDozePreference;
    private SwitchPreference mTapToWakePreference;
    private SwitchPreference mAutoBrightnessPreference;
    private SwitchPreference mCameraGesturePreference;
    private PreferenceScreen mDozePreference;

    @Override
    protected int getMetricsCategory() {
@@ -144,10 +143,11 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
            removePreference(KEY_LIFT_TO_WAKE);
        }

        if (!isDozeAvailable(activity)) {
            removePreference(KEY_DOZE);
        if (isDozeAvailable(activity)) {
            mDozePreference = (SwitchPreference) findPreference(KEY_DOZE);
            mDozePreference.setOnPreferenceChangeListener(this);
        } else {
            mDozePreference = (PreferenceScreen) findPreference(KEY_DOZE);
            removePreference(KEY_DOZE);
        }

        if (isTapToWakeAvailable(getResources())) {
@@ -360,6 +360,12 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
            mTapToWakePreference.setChecked(value != 0);
        }

        // Update doze if it is available.
        if (mDozePreference != null) {
            int value = Settings.Secure.getInt(getContentResolver(), DOZE_ENABLED, 1);
            mDozePreference.setChecked(value != 0);
        }

        // Update camera gesture #1 if it is available.
        if (mCameraGesturePreference != null) {
            int value = Settings.Secure.getInt(getContentResolver(), CAMERA_GESTURE_DISABLED, 0);
@@ -407,6 +413,10 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
            boolean value = (Boolean) objValue;
            Settings.Secure.putInt(getContentResolver(), WAKE_GESTURE_ENABLED, value ? 1 : 0);
        }
        if (preference == mDozePreference) {
            boolean value = (Boolean) objValue;
            Settings.Secure.putInt(getContentResolver(), DOZE_ENABLED, value ? 1 : 0);
        }
        if (preference == mTapToWakePreference) {
            boolean value = (Boolean) objValue;
            Settings.Secure.putInt(getContentResolver(), DOUBLE_TAP_TO_WAKE, value ? 1 : 0);
Loading