Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86c2bc65 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Allow notfication vibrations in DND" into rvc-qpr-dev am: d00160c0 am: a352821e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12784435

Change-Id: I3420e9c2da1dea2b41aa7fe41d901b3ff80a64b3
parents 29bf2c5a a352821e
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -60,6 +60,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;
@@ -7138,8 +7139,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());