diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index fec8cccd52e08..0b177c70614eb 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -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); diff --git a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java index 07bb4533c4e0b..c21159eebc752 100644 --- a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java +++ b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java @@ -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 pickupGestureEnabled(int user) { + return boolSettingDefaultOn(Settings.Secure.DOZE_PICK_UP_GESTURE, user) + && dozePickupSensorAvailable(); } - public boolean pulseOnPickupAvailable() { - return dozePulsePickupSensorAvailable() && ambientDisplayAvailable(); - } - - 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() { diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index 007e14096bf21..c6ea4807c2a9d 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -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); diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 1c133955f4b18..500199f7a521d 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -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; diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java b/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java index 79de48a174239..1cacdb595be1f 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java @@ -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(); } diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java index e87bd09561e4d..18dffa705f2cd 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java @@ -91,13 +91,13 @@ public class DozeSensors { false /* touchscreen */), mPickupSensor = new TriggerSensor( mSensorManager.getDefaultSensor(Sensor.TYPE_PICK_UP_GESTURE), - Settings.Secure.DOZE_PULSE_ON_PICK_UP, - config.pulseOnPickupAvailable(), + Settings.Secure.DOZE_PICK_UP_GESTURE, + config.dozePickupSensorAvailable(), DozeLog.PULSE_REASON_SENSOR_PICKUP, false /* touchCoords */, false /* touchscreen */), new TriggerSensor( findSensorWithType(config.doubleTapSensorType()), - Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, + Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, true /* configured */, DozeLog.PULSE_REASON_SENSOR_DOUBLE_TAP, dozeParameters.doubleTapReportsTouchCoordinates(), diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java index be3e322f598fd..4391a44f99048 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeTriggers.java @@ -129,7 +129,9 @@ public class DozeTriggers implements DozeMachine.Part { boolean isPickup = pulseReason == DozeLog.PULSE_REASON_SENSOR_PICKUP; boolean isLongPress = pulseReason == DozeLog.PULSE_REASON_SENSOR_LONG_PRESS; - if (mConfig.alwaysOnEnabled(UserHandle.USER_CURRENT) && !isLongPress) { + if (isLongPress) { + requestPulse(pulseReason, sensorPerformedProxCheck); + } else { proximityCheckThenCall((result) -> { if (result == ProximityCheck.RESULT_NEAR) { // In pocket, drop event. @@ -138,13 +140,13 @@ public class DozeTriggers implements DozeMachine.Part { if (isDoubleTap) { mDozeHost.onDoubleTap(screenX, screenY); mMachine.wakeUp(); + } else if (isPickup) { + mMachine.wakeUp(); } else { mDozeHost.extendPulse(); } }, sensorPerformedProxCheck, pulseReason); return; - } else { - requestPulse(pulseReason, sensorPerformedProxCheck); } if (isPickup) { @@ -152,7 +154,7 @@ public class DozeTriggers implements DozeMachine.Part { SystemClock.elapsedRealtime() - mNotificationPulseTime; final boolean withinVibrationThreshold = timeSinceNotification < mDozeParameters.getPickupVibrationThreshold(); - DozeLog.tracePickupPulse(mContext, withinVibrationThreshold); + DozeLog.tracePickupWakeUp(mContext, withinVibrationThreshold); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationUtil.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationUtil.java index 62d80ace39df2..f45500a872742 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationUtil.java +++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationUtil.java @@ -45,12 +45,12 @@ public class DozeConfigurationUtil { boolean[] doneHolder = new boolean[1]; AmbientDisplayConfiguration config = mock(AmbientDisplayConfiguration.class, noDefaultAnswer(doneHolder)); - when(config.pulseOnDoubleTapEnabled(anyInt())).thenReturn(false); - when(config.pulseOnPickupEnabled(anyInt())).thenReturn(false); + when(config.doubleTapGestureEnabled(anyInt())).thenReturn(false); + when(config.pickupGestureEnabled(anyInt())).thenReturn(false); when(config.pulseOnNotificationEnabled(anyInt())).thenReturn(true); when(config.doubleTapSensorType()).thenReturn(null); - when(config.pulseOnPickupAvailable()).thenReturn(false); + when(config.dozePickupSensorAvailable()).thenReturn(false); doneHolder[0] = true; return config; diff --git a/services/core/java/com/android/server/dreams/DreamManagerService.java b/services/core/java/com/android/server/dreams/DreamManagerService.java index 5292d3e5fd3b0..ba05b49b76980 100644 --- a/services/core/java/com/android/server/dreams/DreamManagerService.java +++ b/services/core/java/com/android/server/dreams/DreamManagerService.java @@ -50,7 +50,6 @@ import android.provider.Settings; import android.service.dreams.DreamManagerInternal; import android.service.dreams.DreamService; import android.service.dreams.IDreamManager; -import android.text.TextUtils; import android.util.Slog; import android.view.Display; @@ -124,7 +123,7 @@ public final class DreamManagerService extends SystemService { } }, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mHandler); mContext.getContentResolver().registerContentObserver( - Settings.Secure.getUriFor(Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP), false, + Settings.Secure.getUriFor(Settings.Secure.DOZE_DOUBLE_TAP_GESTURE), false, mDozeEnabledObserver, UserHandle.USER_ALL); writePulseGestureEnabled(); } diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java index 9ca02bad50bd2..3f28ee659a587 100644 --- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java +++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java @@ -574,13 +574,13 @@ public class UserRestrictionsUtils { Settings.Secure.DOZE_ALWAYS_ON, 0, userId); android.provider.Settings.Secure.putIntForUser( context.getContentResolver(), - Settings.Secure.DOZE_PULSE_ON_PICK_UP, 0, userId); + Settings.Secure.DOZE_PICK_UP_GESTURE, 0, userId); android.provider.Settings.Secure.putIntForUser( context.getContentResolver(), Settings.Secure.DOZE_PULSE_ON_LONG_PRESS, 0, userId); android.provider.Settings.Secure.putIntForUser( context.getContentResolver(), - Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, 0, userId); + Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, 0, userId); } break; case UserManager.DISALLOW_CONFIG_LOCATION: @@ -684,9 +684,9 @@ public class UserRestrictionsUtils { case android.provider.Settings.Secure.DOZE_ENABLED: case android.provider.Settings.Secure.DOZE_ALWAYS_ON: - case android.provider.Settings.Secure.DOZE_PULSE_ON_PICK_UP: + case android.provider.Settings.Secure.DOZE_PICK_UP_GESTURE: case android.provider.Settings.Secure.DOZE_PULSE_ON_LONG_PRESS: - case android.provider.Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP: + case android.provider.Settings.Secure.DOZE_DOUBLE_TAP_GESTURE: if ("0".equals(value)) { return false; }