From 4504f0ace4d6449e4436aad5fd3705555d9d829d Mon Sep 17 00:00:00 2001 From: Ahmad Khalil Date: Wed, 31 Jan 2024 10:45:55 +0000 Subject: [PATCH] Fix notification vibration demos in settings While in zen mode, notification vibrations are ignored. These vibrations will also be ignored when attempting to demo the vibration intensity in settings. Adding FLAG_BYPASS_INTERRUPTION_POLICY to the attributes of the vibration preview, to allow it to bypass the interruption policy and demo the vibration intensity as expected. Fix: 301319836 Test: N/A Change-Id: I240a896ff8e9516388a0238882db07f9680a184a --- .../accessibility/VibrationPreferenceConfig.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/accessibility/VibrationPreferenceConfig.java b/src/com/android/settings/accessibility/VibrationPreferenceConfig.java index c25c38e5a6d..a3048622fb0 100644 --- a/src/com/android/settings/accessibility/VibrationPreferenceConfig.java +++ b/src/com/android/settings/accessibility/VibrationPreferenceConfig.java @@ -150,9 +150,13 @@ public abstract class VibrationPreferenceConfig { @VibrationAttributes.Usage int vibrationUsage) { return new VibrationAttributes.Builder() .setUsage(vibrationUsage) - // Enforce fresh settings to be applied for the preview vibration, as they - // are played immediately after the new user values are set. - .setFlags(VibrationAttributes.FLAG_INVALIDATE_SETTINGS_CACHE) + .setFlags( + // Enforce fresh settings to be applied for the preview vibration, as they + // are played immediately after the new user values are set. + VibrationAttributes.FLAG_INVALIDATE_SETTINGS_CACHE + // Bypass user settings to allow vibration previews to be played while in + // limited interruptions' mode, e.g. zen mode. + | VibrationAttributes.FLAG_BYPASS_INTERRUPTION_POLICY) .build(); }