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

Commit 82627a85 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Replace reference to AudioManager#getZenMode." into main

parents e95f160c e002d384
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -735,8 +735,17 @@ public class Ringer {
        AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
        // Use AudioManager#getRingerMode for more accurate result, instead of
        // AudioManager#getRingerModeInternal which only useful for volume controllers
        boolean zenModeOn = mNotificationManager != null
        boolean zenModeOn;
        if (mFlags.resolveHiddenDependenciesTwo()) {
            // See NotificationManager#zenModeToInterruptionFilter; INTERRUPTION_FILTER_ALL is
            // equivalent to the former ZEN_MODE_OFF.
            zenModeOn = mNotificationManager != null
                    && mNotificationManager.getCurrentInterruptionFilter()
                    != NotificationManager.INTERRUPTION_FILTER_ALL;
        } else {
            zenModeOn = mNotificationManager != null
                    && mNotificationManager.getZenMode() != ZEN_MODE_OFF;
        }
        maybeGenAnomReportForGetRingerMode(zenModeOn, audioManager);
        return mVibrator.hasVibrator()
                && mSystemSettingsUtil.isRingVibrationEnabled(context)
+2 −0
Original line number Diff line number Diff line
@@ -647,6 +647,8 @@ public class RingerTest extends TelecomTestCase {
        mRingerUnderTest.startCallWaiting(mockCall1);
        Ringtone mockRingtone = ensureRingtoneMocked();
        when(mockNotificationManager.getZenMode()).thenReturn(ZEN_MODE_IMPORTANT_INTERRUPTIONS);
        when(mockNotificationManager.getCurrentInterruptionFilter()).thenReturn(
                NotificationManager.INTERRUPTION_FILTER_PRIORITY);
        when(mockAudioManager.getRingerMode()).thenReturn(AudioManager.RINGER_MODE_SILENT);
        when(mockAudioManager.getStreamVolume(AudioManager.STREAM_RING)).thenReturn(100);
        enableVibrationWhenRinging();