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

Commit a8cf6e3f authored by Sanket Agarwal's avatar Sanket Agarwal
Browse files

Handle all kinds of focuses and make fault tolerant to phone calls.

Audio Focus Loss Transient: We stop music and wait for focus gain.
Audio Focus Loss Transient May Duck: We lower the volume (via Gain).

Sometimes phones do not resume even after sending play after the phone
call. This is possible if there is a race condition of when A2dp thinks
it got focus back vs phone actually releasing the call. To avoid this we
add retry logic to try playing again. This also avoids janky situations
when playing music will not initiate at first.

Bug: b/28003743
Bug: b/28065071

Change-Id: I1d31156d134d98959ff3044c98206c60515d7e5a
(cherry picked from commit 997cc09dbcab7184d631180f12c974ebd4e13d57)
parent 78e4c649
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -209,6 +209,7 @@ static void informAudioFocusStateNative(JNIEnv *env, jobject object, jint focus_
    if (!sBluetoothA2dpInterface) return;
    if (!sBluetoothA2dpInterface) return;


    sBluetoothA2dpInterface->set_audio_focus_state((uint8_t) focus_state);
    sBluetoothA2dpInterface->set_audio_focus_state((uint8_t) focus_state);

}
}


static void informAudioTrackGainNative(JNIEnv *env, jobject object, jfloat gain) {
static void informAudioTrackGainNative(JNIEnv *env, jobject object, jfloat gain) {