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

Commit c3e03900 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Reach gesture implementation"

parents 64348d10 c81702eb
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -7246,6 +7246,14 @@ public final class Settings {
        private static final Validator DOZE_DOUBLE_TAP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
        /**
         * Whether the device should pulse on reach gesture.
         * @hide
         */
        public static final String DOZE_REACH_GESTURE = "doze_reach_gesture";
        private static final Validator DOZE_REACH_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
        /**
         * The current night mode that has been selected by the user.  Owned
         * and controlled by UiModeManagerService.  Constants are as per
@@ -8148,6 +8156,7 @@ public final class Settings {
            DOZE_ALWAYS_ON,
            DOZE_PICK_UP_GESTURE,
            DOZE_DOUBLE_TAP_GESTURE,
            DOZE_REACH_GESTURE,
            NFC_PAYMENT_DEFAULT_COMPONENT,
            AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
            FACE_UNLOCK_KEYGUARD_ENABLED,
@@ -8291,6 +8300,7 @@ public final class Settings {
            VALIDATORS.put(DOZE_ALWAYS_ON, DOZE_ALWAYS_ON_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(DOZE_REACH_GESTURE, DOZE_REACH_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);
+13 −0
Original line number Diff line number Diff line
@@ -66,6 +66,15 @@ public class AmbientDisplayConfiguration {
        return !TextUtils.isEmpty(doubleTapSensorType());
    }

    public boolean reachGestureEnabled(int user) {
        return boolSettingDefaultOn(Settings.Secure.DOZE_REACH_GESTURE, user)
                && reachGestureAvailable();
    }

    public boolean reachGestureAvailable() {
        return !TextUtils.isEmpty(reachSensorType());
    }

    public String doubleTapSensorType() {
        return mContext.getResources().getString(R.string.config_dozeDoubleTapSensorType);
    }
@@ -74,6 +83,10 @@ public class AmbientDisplayConfiguration {
        return mContext.getResources().getString(R.string.config_dozeLongPressSensorType);
    }

    public String reachSensorType() {
        return mContext.getResources().getString(R.string.config_dozeReachSensorType);
    }

    public boolean pulseOnLongPressEnabled(int user) {
        return pulseOnLongPressAvailable() && boolSettingDefaultOff(
                Settings.Secure.DOZE_PULSE_ON_LONG_PRESS, user);
+3 −0
Original line number Diff line number Diff line
@@ -2105,6 +2105,9 @@
    <!-- Type of the long press sensor. Empty if long press is not supported. -->
    <string name="config_dozeLongPressSensorType" translatable="false"></string>

    <!-- Type of the reach sensor. Empty if reach is not supported. -->
    <string name="config_dozeReachSensorType" translatable="false"></string>

    <!-- Control whether the always on display mode is available. This should only be enabled on
         devices where the display has been tuned to be power efficient in DOZE and/or DOZE_SUSPEND
         states. -->
+1 −0
Original line number Diff line number Diff line
@@ -3262,6 +3262,7 @@
  <java-symbol type="array" name="config_hideWhenDisabled_packageNames" />

  <java-symbol type="string" name="config_dozeLongPressSensorType" />
  <java-symbol type="string" name="config_dozeReachSensorType" />

  <java-symbol type="array" name="config_allowedGlobalInstantAppSettings" />
  <java-symbol type="array" name="config_allowedSystemInstantAppSettings" />
+8 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ public class DozeLog {
    private static final int SIZE = Build.IS_DEBUGGABLE ? 400 : 50;
    static final SimpleDateFormat FORMAT = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");

    private static final int PULSE_REASONS = 6;
    private static final int PULSE_REASONS = 7;

    public static final int PULSE_REASON_NONE = -1;
    public static final int PULSE_REASON_INTENT = 0;
@@ -44,6 +44,7 @@ public class DozeLog {
    public static final int PULSE_REASON_SENSOR_PICKUP = 3;
    public static final int PULSE_REASON_SENSOR_DOUBLE_TAP = 4;
    public static final int PULSE_REASON_SENSOR_LONG_PRESS = 5;
    public static final int PULSE_REASON_SENSOR_REACH = 6;

    private static boolean sRegisterKeyguardCallback = true;

@@ -169,6 +170,11 @@ public class DozeLog {
        log("state " + state);
    }

    public static void traceReachWakeUp() {
        if (!ENABLED) return;
        log("reachWakeUp");
    }

    public static void traceProximityResult(Context context, boolean near, long millis,
            int pulseReason) {
        if (!ENABLED) return;
@@ -186,6 +192,7 @@ public class DozeLog {
            case PULSE_REASON_SENSOR_PICKUP: return "pickup";
            case PULSE_REASON_SENSOR_DOUBLE_TAP: return "doubletap";
            case PULSE_REASON_SENSOR_LONG_PRESS: return "longpress";
            case PULSE_REASON_SENSOR_REACH: return "reach";
            default: throw new IllegalArgumentException("bad reason: " + pulseReason);
        }
    }
Loading