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

Commit aec2487d authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Ensure non-ringing call doesn't start ringing.

Its possible for ringing to be triggered by a bluetooth state change; if
the call goes active while this is taking place, we can have a scenario
where the call is no longer ringing by the time the bluetooth change
takes place.

Test: Compile; log inspection.
Bug: 131980471
Change-Id: I9dfcd74cee3c2c94f63107987bfa5017f7b5c2c0
parent f07a8fdc
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -208,6 +208,14 @@ public class Ringer {
            return false;
        }

        if (foregroundCall.getState() != CallState.RINGING) {
            // Its possible for bluetooth to connect JUST as a call goes active, which would mean
            // the call would start ringing again.
            Log.i(this, "startRinging called for non-ringing foreground callid=%s",
                    foregroundCall.getId());
            return false;
        }

        AudioManager audioManager =
                (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
        boolean isVolumeOverZero = audioManager.getStreamVolume(AudioManager.STREAM_RING) > 0;