diff options
| author | 2020-10-07 12:56:12 -0400 | |
|---|---|---|
| committer | 2020-10-07 17:39:59 +0000 | |
| commit | cb7d29269102d821fb4e3e531e3f34db8f7a2d85 (patch) | |
| tree | 6258fe2a4153c4688270e729ceb7bd1e6ed72cc4 | |
| parent | 8bb65f94c818f524379bf0050002ccecf743ca8b (diff) | |
Allow notfication vibrations in DND
Test: manual
Fixes: 169609238
Change-Id: I5993a2519bfb63ce405c05169754750aaae7b105
| -rwxr-xr-x | services/core/java/com/android/server/notification/NotificationManagerService.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 81c72ef21aaa..14635ccc7bc7 100755 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -59,6 +59,7 @@ import static android.content.pm.PackageManager.MATCH_ALL; import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE; import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE; import static android.content.pm.PackageManager.PERMISSION_GRANTED; +import static android.media.AudioAttributes.FLAG_BYPASS_INTERRUPTION_POLICY; import static android.media.AudioAttributes.USAGE_NOTIFICATION_RINGTONE; import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL; import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL; @@ -7100,8 +7101,15 @@ public class NotificationManagerService extends SystemService { // so need to check the notification still valide for vibrate. synchronized (mNotificationLock) { if (mNotificationsByKey.get(record.getKey()) != null) { + // Vibrator checks the appops for the op package, not the caller, + // so we need to add the bypass dnd flag to be heard. it's ok to + // always add this flag here because we've already checked that we can + // bypass dnd + AudioAttributes.Builder aab = + new AudioAttributes.Builder(record.getAudioAttributes()) + .setFlags(FLAG_BYPASS_INTERRUPTION_POLICY); mVibrator.vibrate(record.getSbn().getUid(), record.getSbn().getOpPkg(), - effect, "Notification (delayed)", record.getAudioAttributes()); + effect, "Notification (delayed)", aab.build()); } else { Slog.e(TAG, "No vibration for canceled notification : " + record.getKey()); |