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

Commit 7d7cf27d authored by Roshan Pius's avatar Roshan Pius
Browse files

Ensure BT headset state updation before connect.

Two BT fixes here:
1. Correct the force updation of BT headset.
  Looks like one of the partner CL: ag/703545 inadvertently overrode the
  |force| flag that was added in ag/565413 to update the BT headset with
  correct phone state on query.  Correcting the logic to update the BT
  headset with phone state to honor the |force| flag regardless of the
  other flags.
2. For outgoing calls, update the BT headset that there is an outgoing
   call being placed even before the call reaches the DIALING state.
   This helps in ensuring that the connect_audio invoked reaches after
   BT headset knows that there is an outgoing call being placed.

BUG: 23324160
Bug: 22996930
Bug: 23595828
Change-Id: Ib19712fbf357b8355de2132be643585e24d9a59c
parent 7c64a4ee
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -642,7 +642,10 @@ public final class BluetoothPhoneServiceImpl {

        int numActiveCalls = activeCall == null ? 0 : 1;
        int numHeldCalls = mCallsManager.getNumHeldCalls();
        boolean callsSwitched = (numHeldCalls == 2);
        // Intermediate state for GSM calls which are in the process of being swapped.
        // TODO: Should we be hardcoding this value to 2 or should we check if all top level calls
        //       are held?
        boolean callsPendingSwitch = (numHeldCalls == 2);

        // For conference calls which support swapping the active call within the conference
        // (namely CDMA calls) we need to expose that as a held call in order for the BT device
@@ -670,13 +673,14 @@ public final class BluetoothPhoneServiceImpl {
        }

        if (mBluetoothHeadset != null &&
                (force ||
                        (!callsPendingSwitch &&
                                (numActiveCalls != mNumActiveCalls ||
                                 numHeldCalls != mNumHeldCalls ||
                                 bluetoothCallState != mBluetoothCallState ||
                                 !TextUtils.equals(ringingAddress, mRingingAddress) ||
                                 ringingAddressType != mRingingAddressType ||
                 (heldCall != mOldHeldCall && !ignoreHeldCallChange) ||
                 force) && !callsSwitched) {
                                 (heldCall != mOldHeldCall && !ignoreHeldCallChange))))) {

            // If the call is transitioning into the alerting state, send DIALING first.
            // Some devices expect to see a DIALING state prior to seeing an ALERTING state
@@ -738,7 +742,7 @@ public final class BluetoothPhoneServiceImpl {
    private int getBluetoothCallStateForUpdate() {
        CallsManager callsManager = mCallsManager;
        Call ringingCall = mCallsManager.getRingingCall();
        Call dialingCall = mCallsManager.getDialingCall();
        Call dialingCall = mCallsManager.getOutgoingCall();

        //
        // !! WARNING !!
+4 −0
Original line number Diff line number Diff line
@@ -1131,6 +1131,10 @@ public class CallsManager extends Call.ListenerBase implements VideoProviderProx
        return count;
    }

    Call getOutgoingCall() {
        return getFirstCallWithState(OUTGOING_CALL_STATES);
    }

    Call getFirstCallWithState(int... states) {
        return getFirstCallWithState(null, states);
    }