summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2019-08-10 19:53:37 (GMT)
committerMichael Bestas <mkbestas@lineageos.org>2019-08-19 16:33:40 (GMT)
commit1416722f908465a1665285c53d9282710b530d39 (patch)
tree6c042a253368ee9197a12529da956b24b9bea804
parent23e35f6f310b59d8e24d059b4826694686314837 (diff)
downloadframeworks_base-1416722f908465a1665285c53d9282710b530d39.zip
frameworks_base-1416722f908465a1665285c53d9282710b530d39.tar.gz
frameworks_base-1416722f908465a1665285c53d9282710b530d39.tar.bz2
power: Respect global vibration setting for charging sounds
* Don't vibrate when in silent mode Change-Id: Ife14105e74a28856d74a4c153637344124686e1b
-rw-r--r--services/core/java/com/android/server/power/Notifier.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/power/Notifier.java b/services/core/java/com/android/server/power/Notifier.java
index f2c58f4..0648d40 100644
--- a/services/core/java/com/android/server/power/Notifier.java
+++ b/services/core/java/com/android/server/power/Notifier.java
@@ -121,6 +121,7 @@ final class Notifier {
@Nullable private final StatusBarManagerInternal mStatusBarManagerInternal;
private final TrustManager mTrustManager;
private final Vibrator mVibrator;
+ private final AudioManager mAudioManager;
private final NotifierHandler mHandler;
private final Intent mScreenOnIntent;
@@ -168,6 +169,7 @@ final class Notifier {
mStatusBarManagerInternal = LocalServices.getService(StatusBarManagerInternal.class);
mTrustManager = mContext.getSystemService(TrustManager.class);
mVibrator = mContext.getSystemService(Vibrator.class);
+ mAudioManager = mContext.getSystemService(AudioManager.class);
mHandler = new NotifierHandler(looper);
mScreenOnIntent = new Intent(Intent.ACTION_SCREEN_ON);
@@ -806,7 +808,9 @@ final class Notifier {
final boolean dndOff = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.ZEN_MODE, Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS)
== Settings.Global.ZEN_MODE_OFF;
- return enabled && dndOff;
+ final boolean silentMode = mAudioManager.getRingerModeInternal()
+ == AudioManager.RINGER_MODE_SILENT;
+ return enabled && dndOff && !silentMode;
}
private final class NotifierHandler extends Handler {