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

Commit 00667fc0 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Fix issue where incoming calls go into DND mode while ringing.

The previous logic for setting auto-DND mode needed a tweak.  We should
only suppress notifications when the earpiece has ACTIVE focus (ie
not during ringing).

Bug: 31614063
Change-Id: I9944e8a181421f78f7e691154f571b4348fd212c
parent 66cd16e9
Loading
Loading
Loading
Loading
+23 −13
Original line number Diff line number Diff line
@@ -282,7 +282,9 @@ public class CallAudioRouteStateMachine extends StateMachine {
            super.enter();
            setSpeakerphoneOn(false);
            setBluetoothOn(false);
            if (mAudioFocusType == ACTIVE_FOCUS) {
                setNotificationsSuppressed(true);
            }
            CallAudioState newState = new CallAudioState(mIsMuted, ROUTE_EARPIECE,
                    mAvailableRoutes);
            setSystemAudioState(newState);
@@ -333,6 +335,10 @@ public class CallAudioRouteStateMachine extends StateMachine {
                    transitionTo(mActiveSpeakerRoute);
                    return HANDLED;
                case SWITCH_FOCUS:
                    if (msg.arg1 == ACTIVE_FOCUS) {
                        setNotificationsSuppressed(true);
                    }

                    if (msg.arg1 == NO_FOCUS) {
                        reinitialize();
                    }
@@ -1284,7 +1290,10 @@ public class CallAudioRouteStateMachine extends StateMachine {
            return;
        }

        Log.i(this, "setNotificationsSuppressed: on=%s; suppressed=%s", (on ? "yes" : "no"),
                (mAreNotificationSuppressed ? "yes" : "no"));
        if (on) {
            if (!mAreNotificationSuppressed) {
                // Enabling suppression of notifications.
                int interruptionFilter = mInterruptionFilterProxy.getCurrentInterruptionFilter();
                if (interruptionFilter == NotificationManager.INTERRUPTION_FILTER_ALL) {
@@ -1298,6 +1307,7 @@ public class CallAudioRouteStateMachine extends StateMachine {
                    // it.
                    mAreNotificationSuppressed = false;
                }
            }
        } else {
            // Disabling suppression of notifications.
            if (mAreNotificationSuppressed) {