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

Commit 73bc2723 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "HFP: Send caller ID in +CLIP command (4/4)"

parents a1468188 f24bf351
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -43,9 +43,10 @@ public class BluetoothHeadsetProxy {
    }

    public void phoneStateChanged(int numActive, int numHeld, int callState, String number,
            int type) {
            int type, String name) {

        mBluetoothHeadset.phoneStateChanged(numActive, numHeld, callState, number, type);
        mBluetoothHeadset.phoneStateChanged(numActive, numHeld, callState, number, type,
            name);
    }

    public List<BluetoothDevice> getConnectedDevices() {
+17 −6
Original line number Diff line number Diff line
@@ -706,11 +706,16 @@ public class BluetoothPhoneServiceImpl {

        String ringingAddress = null;
        int ringingAddressType = 128;
        String ringingName = null;
        if (ringingCall != null && ringingCall.getHandle() != null) {
            ringingAddress = ringingCall.getHandle().getSchemeSpecificPart();
            if (ringingAddress != null) {
                ringingAddressType = PhoneNumberUtils.toaFromString(ringingAddress);
            }
            ringingName = ringingCall.getCallerDisplayName();
            if (TextUtils.isEmpty(ringingName)) {
                ringingName = ringingCall.getName();
            }
        }
        if (ringingAddress == null) {
            ringingAddress = "";
@@ -782,18 +787,21 @@ public class BluetoothPhoneServiceImpl {
                        "numHeld %s, " +
                        "callState %s, " +
                        "ringing number %s, " +
                        "ringing type %s",
                        "ringing type %s, " +
                        "ringing name %s",
                        mNumActiveCalls,
                        mNumHeldCalls,
                        CALL_STATE_DIALING,
                        Log.pii(mRingingAddress),
                        mRingingAddressType);
                        mRingingAddressType,
                        Log.pii(ringingName));
                mBluetoothHeadset.phoneStateChanged(
                        mNumActiveCalls,
                        mNumHeldCalls,
                        CALL_STATE_DIALING,
                        mRingingAddress,
                        mRingingAddressType);
                        mRingingAddressType,
                        ringingName);
            }

            Log.i(TAG, "updateHeadsetWithCallState " +
@@ -801,19 +809,22 @@ public class BluetoothPhoneServiceImpl {
                    "numHeld %s, " +
                    "callState %s, " +
                    "ringing number %s, " +
                    "ringing type %s",
                    "ringing type %s, " +
                    "ringing name %s",
                    mNumActiveCalls,
                    mNumHeldCalls,
                    mBluetoothCallState,
                    Log.pii(mRingingAddress),
                    mRingingAddressType);
                    mRingingAddressType,
                    Log.pii(ringingName));

            mBluetoothHeadset.phoneStateChanged(
                    mNumActiveCalls,
                    mNumHeldCalls,
                    mBluetoothCallState,
                    mRingingAddress,
                    mRingingAddressType);
                    mRingingAddressType,
                    ringingName);

            mHeadsetUpdatedRecently = true;
        }
+27 −24
Original line number Diff line number Diff line
@@ -309,17 +309,18 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {

        mBluetoothPhoneService.mBinder.queryPhoneState();
        verify(mMockBluetoothHeadset).phoneStateChanged(eq(1), eq(1), eq(CALL_STATE_IDLE),
                eq(""), eq(128));
                eq(""), eq(128), nullable(String.class));
        when(parentCall.wasConferencePreviouslyMerged()).thenReturn(true);
        mBluetoothPhoneService.mCallsManagerListener.onIsConferencedChanged(parentCall);
        verify(mMockBluetoothHeadset).phoneStateChanged(eq(1), eq(0), eq(CALL_STATE_IDLE),
                eq(""), eq(128));
                eq(""), eq(128), nullable(String.class));
        when(mMockCallsManager.getHeldCall()).thenReturn(null);
        // Spurious call to onIsConferencedChanged.
        mBluetoothPhoneService.mCallsManagerListener.onIsConferencedChanged(parentCall);
        // Make sure the call has only occurred collectively 2 times (not on the third)
        verify(mMockBluetoothHeadset, times(2)).phoneStateChanged(any(int.class),
                any(int.class), any(int.class), nullable(String.class), any(int.class));
                any(int.class), any(int.class), nullable(String.class), any(int.class),
                nullable(String.class));
    }

    @MediumTest
@@ -611,7 +612,7 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
        mBluetoothPhoneService.mBinder.queryPhoneState();

        verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_INCOMING),
                eq("5550000"), eq(PhoneNumberUtils.TOA_Unknown));
                eq("5550000"), eq(PhoneNumberUtils.TOA_Unknown), nullable(String.class));
    }

    @MediumTest
@@ -632,7 +633,7 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {

        mBluetoothPhoneService.mBinder.queryPhoneState();
        verify(mMockBluetoothHeadset).phoneStateChanged(eq(1), eq(0), eq(CALL_STATE_IDLE),
                eq(""), eq(128));
                eq(""), eq(128), nullable(String.class));
    }

    @MediumTest
@@ -772,7 +773,7 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {

        verify(parentCall).swapConference();
        verify(mMockBluetoothHeadset).phoneStateChanged(eq(1), eq(1), eq(CALL_STATE_IDLE), eq(""),
                eq(128));
                eq(128), nullable(String.class));
        assertEquals(didProcess, true);
    }

@@ -786,7 +787,7 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
        mBluetoothPhoneService.mCallsManagerListener.onCallAdded(ringingCall);

        verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_INCOMING),
                eq("555000"), eq(PhoneNumberUtils.TOA_Unknown));
                eq("555000"), eq(PhoneNumberUtils.TOA_Unknown), nullable(String.class));

    }

@@ -808,7 +809,7 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
        mBluetoothPhoneService.mCallsManagerListener.onCallAdded(parentCall);

        verify(mMockBluetoothHeadset).phoneStateChanged(eq(1), eq(1), eq(CALL_STATE_IDLE),
                eq(""), eq(128));
                eq(""), eq(128), nullable(String.class));

    }

@@ -821,7 +822,7 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
        mBluetoothPhoneService.mCallsManagerListener.onCallRemoved(activeCall);

        verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_IDLE),
                eq(""), eq(128));
                eq(""), eq(128), nullable(String.class));
    }

    @MediumTest
@@ -839,7 +840,7 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
                CallState.ACTIVE, CallState.ON_HOLD);

        verify(mMockBluetoothHeadset, never()).phoneStateChanged(anyInt(), anyInt(), anyInt(),
                anyString(), anyInt());
                anyString(), anyInt(), nullable(String.class));
    }

    @MediumTest
@@ -851,7 +852,7 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
                CallState.CONNECTING, CallState.DIALING);

        verify(mMockBluetoothHeadset, never()).phoneStateChanged(anyInt(), anyInt(), anyInt(),
                anyString(), anyInt());
                anyString(), anyInt(), nullable(String.class));
    }

    @MediumTest
@@ -862,8 +863,10 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
        mBluetoothPhoneService.mCallsManagerListener.onCallStateChanged(outgoingCall,
                CallState.NEW, CallState.DIALING);

        verify(mMockBluetoothHeadset).phoneStateChanged(0, 0, CALL_STATE_DIALING, "", 128);
        verify(mMockBluetoothHeadset).phoneStateChanged(0, 0, CALL_STATE_ALERTING, "", 128);
        verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_DIALING),
                eq(""), eq(128), nullable(String.class));
        verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_ALERTING),
                eq(""), eq(128), nullable(String.class));
    }

    @MediumTest
@@ -874,16 +877,16 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
        mBluetoothPhoneService.mCallsManagerListener.onCallStateChanged(disconnectedCall,
                CallState.DISCONNECTING, CallState.DISCONNECTED);
        verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_DISCONNECTED),
                eq(""), eq(128));
                eq(""), eq(128), nullable(String.class));

        doReturn(false).when(mMockCallsManager).hasOnlyDisconnectedCalls();
        mBluetoothPhoneService.mCallsManagerListener.onDisconnectedTonePlaying(true);
        verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_DISCONNECTED),
                eq(""), eq(128));
                eq(""), eq(128), nullable(String.class));

        mBluetoothPhoneService.mCallsManagerListener.onDisconnectedTonePlaying(false);
        verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_IDLE),
                eq(""), eq(128));
                eq(""), eq(128), nullable(String.class));
    }

    @MediumTest
@@ -894,7 +897,7 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
        mBluetoothPhoneService.mCallsManagerListener.onCallAdded(ringingCall);

        verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_INCOMING),
                eq("555-0000"), eq(PhoneNumberUtils.TOA_Unknown));
                eq("555-0000"), eq(PhoneNumberUtils.TOA_Unknown), nullable(String.class));

        //Switch to active
        doReturn(null).when(mMockCallsManager).getRingingCall();
@@ -904,7 +907,7 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
                CallState.RINGING, CallState.ACTIVE);

        verify(mMockBluetoothHeadset).phoneStateChanged(eq(1), eq(0), eq(CALL_STATE_IDLE),
                eq(""), eq(128));
                eq(""), eq(128), nullable(String.class));
    }

    @MediumTest
@@ -917,7 +920,7 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
                CallState.ACTIVE, CallState.ON_HOLD);

        verify(mMockBluetoothHeadset, never()).phoneStateChanged(eq(0), eq(2), eq(CALL_STATE_HELD),
                eq("5550000"), eq(PhoneNumberUtils.TOA_Unknown));
                eq("5550000"), eq(PhoneNumberUtils.TOA_Unknown), nullable(String.class));
    }

    @MediumTest
@@ -943,18 +946,18 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
        // CDMA "conference"
        mBluetoothPhoneService.mCallsManagerListener.onIsConferencedChanged(activeCall);
        verify(mMockBluetoothHeadset, never()).phoneStateChanged(anyInt(), anyInt(), anyInt(),
                anyString(), anyInt());
                anyString(), anyInt(), nullable(String.class));
        mBluetoothPhoneService.mCallsManagerListener.onIsConferencedChanged(heldCall);
        verify(mMockBluetoothHeadset, never()).phoneStateChanged(anyInt(), anyInt(), anyInt(),
                anyString(), anyInt());
                anyString(), anyInt(), nullable(String.class));
        mBluetoothPhoneService.mCallsManagerListener.onIsConferencedChanged(parentCall);
        verify(mMockBluetoothHeadset, never()).phoneStateChanged(anyInt(), anyInt(), anyInt(),
                anyString(), anyInt());
                anyString(), anyInt(), nullable(String.class));

        calls.add(heldCall);
        mBluetoothPhoneService.mCallsManagerListener.onIsConferencedChanged(parentCall);
        verify(mMockBluetoothHeadset).phoneStateChanged(eq(1), eq(1), eq(CALL_STATE_IDLE),
                eq(""), eq(128));
                eq(""), eq(128), nullable(String.class));
    }

    @MediumTest
@@ -968,7 +971,7 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase {
        mBluetoothPhoneService.mBluetoothAdapterReceiver.onReceive(mContext, intent);

        verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_INCOMING),
                eq("5550000"), eq(PhoneNumberUtils.TOA_Unknown));
                eq("5550000"), eq(PhoneNumberUtils.TOA_Unknown), nullable(String.class));
    }

    private void addCallCapability(Call call, int capability) {