diff options
author | blunden <blunden2@gmail.com> | 2018-03-18 14:02:30 +0100 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2020-12-12 01:23:35 +0200 |
commit | 399647dde74e8fbf152c98b36657944fd5369eea (patch) | |
tree | fa8b303475f1e0259e48a6282e47ea50d8c01379 /java/com/android/incallui/InCallPresenter.java | |
parent | 25237ec70323d72c299dd984117031de432b8e42 (diff) |
Add setting to enable Do Not Disturb during calls
Android N and earlier enabled Do Not Disturb mode while in a call.
Reimplement this behavior to prevent incoming notifications from
vibrating or playing sounds.
Change-Id: Ic38ac775c6e353898190e1571b6d6e521c0e5aa1
Diffstat (limited to 'java/com/android/incallui/InCallPresenter.java')
-rw-r--r-- | java/com/android/incallui/InCallPresenter.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index 1bb606ea0..8881029cc 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -128,6 +128,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud private StatusBarNotifier statusBarNotifier; private ExternalCallNotifier externalCallNotifier; private InCallVibrationHandler vibrationHandler; + private InCallDndHandler dndHandler; private ContactInfoCache contactInfoCache; private Context context; private final OnCheckBlockedListener onCheckBlockedListener = @@ -368,6 +369,9 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud vibrationHandler = new InCallVibrationHandler(context); addListener(vibrationHandler); + dndHandler = new InCallDndHandler(context); + addListener(dndHandler); + this.proximitySensor = proximitySensor; addListener(this.proximitySensor); @@ -1662,6 +1666,11 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud } vibrationHandler = null; + if (dndHandler != null) { + removeListener(dndHandler); + } + dndHandler = null; + if (callList != null) { callList.removeListener(this); callList.removeListener(spamCallListListener); |