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

Commit 68d1e033 authored by Michael Bestas's avatar Michael Bestas Committed by Bruno Martins
Browse files

power: Respect global vibration setting for charging sounds

* Don't vibrate when in silent mode

Change-Id: Ife14105e74a28856d74a4c153637344124686e1b
parent edc56a6e
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ public class Notifier {
    private final FaceDownDetector mFaceDownDetector;
    private final ScreenUndimDetector mScreenUndimDetector;
    private final ActivityManagerInternal mActivityManagerInternal;
    private final AudioManager mAudioManager;
    private final InputManagerInternal mInputManagerInternal;
    private final InputMethodManagerInternal mInputMethodManagerInternal;
    @Nullable private final StatusBarManagerInternal mStatusBarManagerInternal;
@@ -178,6 +179,7 @@ public class Notifier {
        mFaceDownDetector = faceDownDetector;
        mScreenUndimDetector = screenUndimDetector;
        mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);
        mAudioManager = mContext.getSystemService(AudioManager.class);
        mInputManagerInternal = LocalServices.getService(InputManagerInternal.class);
        mInputMethodManagerInternal = LocalServices.getService(InputMethodManagerInternal.class);
        mStatusBarManagerInternal = LocalServices.getService(StatusBarManagerInternal.class);
@@ -850,7 +852,9 @@ public 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 {