diff options
4 files changed, 12 insertions, 9 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 2115f64a60b3..a622d36edc6a 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -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> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 9e0954093eb2..eccd7bf5ccd4 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -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> diff --git a/services/core/java/com/android/server/GestureLauncherService.java b/services/core/java/com/android/server/GestureLauncherService.java index 1741593ba671..ccc44a41759b 100644 --- a/services/core/java/com/android/server/GestureLauncherService.java +++ b/services/core/java/com/android/server/GestureLauncherService.java @@ -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"); diff --git a/services/tests/servicestests/src/com/android/server/GestureLauncherServiceTest.java b/services/tests/servicestests/src/com/android/server/GestureLauncherServiceTest.java index 4e059b4b7432..fe883e435f3c 100644 --- a/services/tests/servicestests/src/com/android/server/GestureLauncherServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/GestureLauncherServiceTest.java @@ -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); |