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

Commit 27d9e273 authored by Santos Cordon's avatar Santos Cordon Committed by Android (Google) Code Review
Browse files

Merge "Send BTPhoneService update when active/background calls switch." into lmp-dev

parents 45d7a205 c0ca76ee
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ public final class BluetoothPhoneService extends Service {
    private int mBluetoothCallState = CALL_STATE_IDLE;
    private String mRingingAddress = null;
    private int mRingingAddressType = 0;
    private Call mOldHeldCall = null;

    /**
     * Binder implementation of IBluetoothHeadsetPhone. Implements the command interface that the
@@ -643,7 +644,7 @@ public final class BluetoothPhoneService extends Service {
        }

        int numActiveCalls = activeCall == null ? 0 : 1;
        int numHeldCalls = heldCall == null ? 0 : 1;
        int numHeldCalls = callsManager.getNumHeldCalls();

        // 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
@@ -664,6 +665,7 @@ public final class BluetoothPhoneService extends Service {
                 bluetoothCallState != mBluetoothCallState ||
                 !TextUtils.equals(ringingAddress, mRingingAddress) ||
                 ringingAddressType != mRingingAddressType ||
                 heldCall != mOldHeldCall ||
                 force)) {

            // If the call is transitioning into the alerting state, send DIALING first.
@@ -672,6 +674,7 @@ public final class BluetoothPhoneService extends Service {
            boolean sendDialingFirst = mBluetoothCallState != bluetoothCallState &&
                    bluetoothCallState == CALL_STATE_ALERTING;

            mOldHeldCall = heldCall;
            mNumActiveCalls = numActiveCalls;
            mNumHeldCalls = numHeldCalls;
            mBluetoothCallState = bluetoothCallState;
+10 −0
Original line number Diff line number Diff line
@@ -872,6 +872,16 @@ public final class CallsManager extends Call.ListenerBase {
        return getFirstCallWithState(CallState.ON_HOLD);
    }

    int getNumHeldCalls() {
        int count = 0;
        for (Call call : mCalls) {
            if (call.getParentCall() == null && call.getState() == CallState.ON_HOLD) {
                count++;
            }
        }
        return count;
    }

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