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

Commit 98e81743 authored by Pranav Madapurmath's avatar Pranav Madapurmath
Browse files

Check if future is true before timing out

If the BT binding future is completed and we receive
InCallController#onConnected for the BT ICS twice, ensure that we don't
fail the binding and end up disconnecting the BT ICS if the completion
value is true. This only occurs in edge cases where an outgoing call is
placed at the same time an incoming call is created in Telecom. Telecom
allows the outgoing call because the incoming call is not yet in a
ringing call state and we end up trying to bind to BT ICS twice. The
second invocation of InCallController#onConnected was causing the BT
binding future to time out and we unbound from BT ICS as a result.

Bug: 384062290
Flag: EXEMPT bug fix
Test: m Telecom (I've been unsuccessful in reproducing this specific
scenario locally)

Change-Id: I43245a26ad7bdd572671505dfd9c8a8d793c093b
parent 2d16482b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2625,7 +2625,8 @@ public class InCallController extends CallsManagerListenerBase implements
        IInCallService inCallService = IInCallService.Stub.asInterface(service);
        if (info.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) {
            if (!mBtBindingFuture.containsKey(userHandle)
                    || mBtBindingFuture.get(userHandle).isDone()) {
                    || (mBtBindingFuture.get(userHandle).isDone() && !mBtBindingFuture
                    .get(userHandle).getNow(false))) {
                Log.i(this, "onConnected: BT binding future timed out.");
                // Binding completed after the timeout. Clean up this binding
                return false;