Loading core/res/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -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> core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -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> services/core/java/com/android/server/GestureLauncherService.java +4 −7 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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"); Loading services/tests/servicestests/src/com/android/server/GestureLauncherServiceTest.java +1 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading Loading
core/res/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -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>
core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -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>
services/core/java/com/android/server/GestureLauncherService.java +4 −7 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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"); Loading
services/tests/servicestests/src/com/android/server/GestureLauncherServiceTest.java +1 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading