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

Commit 4359b559 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Double tap and lift should take to lock screen

The current ambient display design doesn't make sense when the
display is not 'always on', let's wake-up directly to the lock
screen instead.

Change-Id: I217720dcf01a507f43e9da6e1970b2246fb75211
Test: double tap from AOD or screen off
Test: lift from AOD or screen off
Test: receive pulsing notification, long press
Fixes: 73148491
Fixes: 111881300
Bug: 111414690
parent fffaf4f1
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -7154,9 +7154,9 @@ public final class Settings {
         * Whether the device should pulse on pick up gesture.
         * @hide
         */
        public static final String DOZE_PULSE_ON_PICK_UP = "doze_pulse_on_pick_up";
        public static final String DOZE_PICK_UP_GESTURE = "doze_pulse_on_pick_up";
        private static final Validator DOZE_PULSE_ON_PICK_UP_VALIDATOR = BOOLEAN_VALIDATOR;
        private static final Validator DOZE_PICK_UP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
        /**
         * Whether the device should pulse on long press gesture.
@@ -7168,9 +7168,9 @@ public final class Settings {
         * Whether the device should pulse on double tap gesture.
         * @hide
         */
        public static final String DOZE_PULSE_ON_DOUBLE_TAP = "doze_pulse_on_double_tap";
        public static final String DOZE_DOUBLE_TAP_GESTURE = "doze_pulse_on_double_tap";
        private static final Validator DOZE_PULSE_ON_DOUBLE_TAP_VALIDATOR = BOOLEAN_VALIDATOR;
        private static final Validator DOZE_DOUBLE_TAP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
        /**
         * The current night mode that has been selected by the user.  Owned
@@ -8064,8 +8064,8 @@ public final class Settings {
            QS_TILES,
            DOZE_ENABLED,
            DOZE_ALWAYS_ON,
            DOZE_PULSE_ON_PICK_UP,
            DOZE_PULSE_ON_DOUBLE_TAP,
            DOZE_PICK_UP_GESTURE,
            DOZE_DOUBLE_TAP_GESTURE,
            NFC_PAYMENT_DEFAULT_COMPONENT,
            AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
            FACE_UNLOCK_KEYGUARD_ENABLED,
@@ -8207,8 +8207,8 @@ public final class Settings {
            VALIDATORS.put(QS_TILES, QS_TILES_VALIDATOR);
            VALIDATORS.put(DOZE_ENABLED, DOZE_ENABLED_VALIDATOR);
            VALIDATORS.put(DOZE_ALWAYS_ON, DOZE_ALWAYS_ON_VALIDATOR);
            VALIDATORS.put(DOZE_PULSE_ON_PICK_UP, DOZE_PULSE_ON_PICK_UP_VALIDATOR);
            VALIDATORS.put(DOZE_PULSE_ON_DOUBLE_TAP, DOZE_PULSE_ON_DOUBLE_TAP_VALIDATOR);
            VALIDATORS.put(DOZE_PICK_UP_GESTURE, DOZE_PICK_UP_GESTURE_VALIDATOR);
            VALIDATORS.put(DOZE_DOUBLE_TAP_GESTURE, DOZE_DOUBLE_TAP_GESTURE_VALIDATOR);
            VALIDATORS.put(NFC_PAYMENT_DEFAULT_COMPONENT, NFC_PAYMENT_DEFAULT_COMPONENT_VALIDATOR);
            VALIDATORS.put(AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
                    AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_VALIDATOR);
+7 −26
Original line number Diff line number Diff line
@@ -36,17 +36,10 @@ public class AmbientDisplayConfiguration {

    public boolean enabled(int user) {
        return pulseOnNotificationEnabled(user)
                || pulseOnPickupEnabled(user)
                || pulseOnDoubleTapEnabled(user)
                || pulseOnLongPressEnabled(user)
                || alwaysOnEnabled(user);
    }

    public boolean available() {
        return pulseOnNotificationAvailable() || pulseOnPickupAvailable()
                || pulseOnDoubleTapAvailable();
    }

    public boolean pulseOnNotificationEnabled(int user) {
        return boolSettingDefaultOn(Settings.Secure.DOZE_ENABLED, user) && pulseOnNotificationAvailable();
    }
@@ -55,30 +48,18 @@ public class AmbientDisplayConfiguration {
        return ambientDisplayAvailable();
    }

    public boolean pulseOnPickupEnabled(int user) {
        boolean settingEnabled = boolSettingDefaultOn(Settings.Secure.DOZE_PULSE_ON_PICK_UP, user);
        return (settingEnabled || alwaysOnEnabled(user)) && pulseOnPickupAvailable();
    }

    public boolean pulseOnPickupAvailable() {
        return dozePulsePickupSensorAvailable() && ambientDisplayAvailable();
    public boolean pickupGestureEnabled(int user) {
        return boolSettingDefaultOn(Settings.Secure.DOZE_PICK_UP_GESTURE, user)
                && dozePickupSensorAvailable();
    }

    public boolean dozePulsePickupSensorAvailable() {
    public boolean dozePickupSensorAvailable() {
        return mContext.getResources().getBoolean(R.bool.config_dozePulsePickup);
    }

    public boolean pulseOnPickupCanBeModified(int user) {
        return !alwaysOnEnabled(user);
    }

    public boolean pulseOnDoubleTapEnabled(int user) {
        return boolSettingDefaultOn(Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, user)
                && pulseOnDoubleTapAvailable();
    }

    public boolean pulseOnDoubleTapAvailable() {
        return doubleTapSensorAvailable() && ambientDisplayAvailable();
    public boolean doubleTapGestureEnabled(int user) {
        return boolSettingDefaultOn(Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, user)
                && doubleTapSensorAvailable();
    }

    public boolean doubleTapSensorAvailable() {
+2 −2
Original line number Diff line number Diff line
@@ -1791,13 +1791,13 @@ class SettingsProtoDumpUtil {
                Settings.Secure.DOZE_ALWAYS_ON,
                SecureSettingsProto.Doze.ALWAYS_ON);
        dumpSetting(s, p,
                Settings.Secure.DOZE_PULSE_ON_PICK_UP,
                Settings.Secure.DOZE_PICK_UP_GESTURE,
                SecureSettingsProto.Doze.PULSE_ON_PICK_UP);
        dumpSetting(s, p,
                Settings.Secure.DOZE_PULSE_ON_LONG_PRESS,
                SecureSettingsProto.Doze.PULSE_ON_LONG_PRESS);
        dumpSetting(s, p,
                Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP,
                Settings.Secure.DOZE_DOUBLE_TAP_GESTURE,
                SecureSettingsProto.Doze.PULSE_ON_DOUBLE_TAP);
        p.end(dozeToken);

+2 −2
Original line number Diff line number Diff line
@@ -3242,9 +3242,9 @@ public class SettingsProvider extends ContentProvider {
                            getSettingLocked(Settings.Secure.DOZE_ENABLED).getValue());

                    if (dozeExplicitlyDisabled) {
                        secureSettings.insertSettingLocked(Settings.Secure.DOZE_PULSE_ON_PICK_UP,
                        secureSettings.insertSettingLocked(Settings.Secure.DOZE_PICK_UP_GESTURE,
                                "0", null, true, SettingsState.SYSTEM_PACKAGE_NAME);
                        secureSettings.insertSettingLocked(Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP,
                        secureSettings.insertSettingLocked(Settings.Secure.DOZE_DOUBLE_TAP_GESTURE,
                                "0", null, true, SettingsState.SYSTEM_PACKAGE_NAME);
                    }
                    currentVersion = 131;
+2 −2
Original line number Diff line number Diff line
@@ -62,10 +62,10 @@ public class DozeLog {
    private static SummaryStats sEmergencyCallStats;
    private static SummaryStats[][] sProxStats; // [reason][near/far]

    public static void tracePickupPulse(Context context, boolean withinVibrationThreshold) {
    public static void tracePickupWakeUp(Context context, boolean withinVibrationThreshold) {
        if (!ENABLED) return;
        init(context);
        log("pickupPulse withinVibrationThreshold=" + withinVibrationThreshold);
        log("pickupWakeUp withinVibrationThreshold=" + withinVibrationThreshold);
        (withinVibrationThreshold ? sPickupPulseNearVibrationStats
                : sPickupPulseNotNearVibrationStats).append();
    }
Loading