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

Commit 63f75075 authored by Yeabkal Wubshit's avatar Yeabkal Wubshit Committed by Android (Google) Code Review
Browse files

Merge "Make default minimum emergency gesture duration configurable" into main

parents f26f87f1 156c2734
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -7015,4 +7015,9 @@
    <!-- Frame rate compatibility value for Wallpaper
         FRAME_RATE_COMPATIBILITY_MIN (102) is used by default for lower power consumption -->
    <integer name="config_wallpaperFrameRateCompatibility">102</integer>

    <!-- Min time in milliseconds to complete an emergency gesture for it count.
         If the gesture is completed faster than this, we assume it's not performed by human and the
         event gets ignored. -->
    <integer name="config_defaultMinEmergencyGestureTapDurationMillis">200</integer>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -5401,4 +5401,6 @@

  <!-- Frame rate compatibility value for Wallpaper -->
  <java-symbol type="integer" name="config_wallpaperFrameRateCompatibility" />

  <java-symbol type="integer" name="config_defaultMinEmergencyGestureTapDurationMillis" />
</resources>
+4 −7
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server;

import static com.android.internal.R.integer.config_defaultMinEmergencyGestureTapDurationMillis;

import android.app.ActivityManager;
import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
@@ -70,12 +72,6 @@ public class GestureLauncherService extends SystemService {
     */
    @VisibleForTesting static final long CAMERA_POWER_DOUBLE_TAP_MAX_TIME_MS = 300;

    /**
     * Min time in milliseconds to complete the emergency gesture for it count. If the gesture is
     * completed faster than this, we assume it's not performed by human and the
     * event gets ignored.
     */
    @VisibleForTesting static final int EMERGENCY_GESTURE_TAP_DETECTION_MIN_TIME_MS = 200;

    /**
     * Interval in milliseconds in which the power button must be depressed in succession to be
@@ -570,7 +566,8 @@ public class GestureLauncherService extends SystemService {
                    long emergencyGestureTapDetectionMinTimeMs = Settings.Global.getInt(
                            mContext.getContentResolver(),
                            Settings.Global.EMERGENCY_GESTURE_TAP_DETECTION_MIN_TIME_MS,
                            EMERGENCY_GESTURE_TAP_DETECTION_MIN_TIME_MS);
                            mContext.getResources().getInteger(
                                    config_defaultMinEmergencyGestureTapDurationMillis));
                    if (emergencyGestureSpentTime <= emergencyGestureTapDetectionMinTimeMs) {
                        Slog.i(TAG, "Emergency gesture detected but it's too fast. Gesture time: "
                                + emergencyGestureSpentTime + " ms");
+1 −2
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.server;

import static com.android.server.GestureLauncherService.CAMERA_POWER_DOUBLE_TAP_MAX_TIME_MS;
import static com.android.server.GestureLauncherService.EMERGENCY_GESTURE_TAP_DETECTION_MIN_TIME_MS;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -1449,7 +1448,7 @@ public class GestureLauncherServiceTest {
        long emergencyGestureTapDetectionMinTimeMs = Settings.Global.getInt(
                mContext.getContentResolver(),
                Settings.Global.EMERGENCY_GESTURE_TAP_DETECTION_MIN_TIME_MS,
                EMERGENCY_GESTURE_TAP_DETECTION_MIN_TIME_MS);
                200);
        assertTrue(intercepted);
        if (tapIntervalMs * 4 > emergencyGestureTapDetectionMinTimeMs) {
            assertTrue(outLaunched.value);