diff options
2 files changed, 12 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationAttentionHelper.java b/services/core/java/com/android/server/notification/NotificationAttentionHelper.java index 6b7db2d8d071..0117c3ca633b 100644 --- a/services/core/java/com/android/server/notification/NotificationAttentionHelper.java +++ b/services/core/java/com/android/server/notification/NotificationAttentionHelper.java @@ -301,11 +301,13 @@ public final class NotificationAttentionHelper { mContext.getContentResolver(), Settings.System.NOTIFICATION_COOLDOWN_ALL, DEFAULT_NOTIFICATION_COOLDOWN_ALL, UserHandle.USER_CURRENT) != 0; - mNotificationCooldownVibrateUnlocked = Settings.System.getIntForUser( - mContext.getContentResolver(), - Settings.System.NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED, - DEFAULT_NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED, - UserHandle.USER_CURRENT) != 0; + if (Flags.vibrateWhileUnlocked()) { + mNotificationCooldownVibrateUnlocked = Settings.System.getIntForUser( + mContext.getContentResolver(), + Settings.System.NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED, + DEFAULT_NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED, + UserHandle.USER_CURRENT) != 0; + } } catch (Exception e) { Log.e(TAG, "Failed to read Settings: " + e); } @@ -1364,12 +1366,14 @@ public final class NotificationAttentionHelper { DEFAULT_NOTIFICATION_COOLDOWN_ALL, UserHandle.USER_CURRENT) != 0; } - if (NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED_URI.equals(uri)) { - mNotificationCooldownVibrateUnlocked = Settings.System.getIntForUser( + if (Flags.vibrateWhileUnlocked()) { + if (NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED_URI.equals(uri)) { + mNotificationCooldownVibrateUnlocked = Settings.System.getIntForUser( mContext.getContentResolver(), Settings.System.NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED, DEFAULT_NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED, UserHandle.USER_CURRENT) != 0; + } } } } diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationAttentionHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationAttentionHelperTest.java index cf8548cfe689..220321d19dac 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationAttentionHelperTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationAttentionHelperTest.java @@ -2107,6 +2107,7 @@ public class NotificationAttentionHelperTest extends UiServiceTestCase { @Test public void testBuzzOnlyOnScreenUnlock_politeNotif() throws Exception { mSetFlagsRule.enableFlags(Flags.FLAG_POLITE_NOTIFICATIONS); + mSetFlagsRule.enableFlags(Flags.FLAG_VIBRATE_WHILE_UNLOCKED); TestableFlagResolver flagResolver = new TestableFlagResolver(); // When NOTIFICATION_COOLDOWN_VIBRATE_UNLOCKED setting is enabled |