Loading src/com/android/server/telecom/BluetoothPhoneServiceImpl.java +9 −7 Original line number Diff line number Diff line Loading @@ -583,7 +583,7 @@ public class BluetoothPhoneServiceImpl { */ private void sendClccForCall(Call call, boolean shouldLog) { boolean isForeground = mCallsManager.getForegroundCall() == call; int state = convertCallState(call.getState(), isForeground); int state = getBtCallState(call, isForeground); boolean isPartOfConference = false; boolean isConferenceWithNoChildren = call.isConference() && call .can(Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN); Loading Loading @@ -707,7 +707,8 @@ public class BluetoothPhoneServiceImpl { String ringingAddress = null; int ringingAddressType = 128; String ringingName = null; if (ringingCall != null && ringingCall.getHandle() != null) { if (ringingCall != null && ringingCall.getHandle() != null && !ringingCall.isSilentRingingRequested()) { ringingAddress = ringingCall.getHandle().getSchemeSpecificPart(); if (ringingAddress != null) { ringingAddressType = PhoneNumberUtils.toaFromString(ringingAddress); Loading Loading @@ -831,7 +832,6 @@ public class BluetoothPhoneServiceImpl { } private int getBluetoothCallStateForUpdate() { CallsManager callsManager = mCallsManager; Call ringingCall = mCallsManager.getRingingCall(); Call dialingCall = mCallsManager.getOutgoingCall(); boolean hasOnlyDisconnectedCalls = mCallsManager.hasOnlyDisconnectedCalls(); Loading @@ -846,7 +846,7 @@ public class BluetoothPhoneServiceImpl { // bluetooth devices (like not getting out of ringing state after answering a call). // int bluetoothCallState = CALL_STATE_IDLE; if (ringingCall != null) { if (ringingCall != null && !ringingCall.isSilentRingingRequested()) { bluetoothCallState = CALL_STATE_INCOMING; } else if (dialingCall != null) { bluetoothCallState = CALL_STATE_ALERTING; Loading @@ -857,8 +857,8 @@ public class BluetoothPhoneServiceImpl { return bluetoothCallState; } private int convertCallState(int callState, boolean isForegroundCall) { switch (callState) { private int getBtCallState(Call call, boolean isForeground) { switch (call.getState()) { case CallState.NEW: case CallState.ABORTED: case CallState.DISCONNECTED: Loading @@ -885,7 +885,9 @@ public class BluetoothPhoneServiceImpl { case CallState.RINGING: case CallState.ANSWERED: if (isForegroundCall) { if (call.isSilentRingingRequested()) { return CALL_STATE_IDLE; } else if (isForeground) { return CALL_STATE_INCOMING; } else { return CALL_STATE_WAITING; Loading tests/src/com/android/server/telecom/tests/BluetoothPhoneServiceTest.java +32 −1 Original line number Diff line number Diff line Loading @@ -271,6 +271,26 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase { verify(mMockBluetoothHeadset).clccResponse(0, 0, 0, 0, false, null, 0); } @MediumTest @Test public void testListCurrentCallsSilentRinging() throws Exception { ArrayList<Call> calls = new ArrayList<>(); Call silentRingingCall = createActiveCall(); when(silentRingingCall.getState()).thenReturn(CallState.RINGING); when(silentRingingCall.isSilentRingingRequested()).thenReturn(true); calls.add(silentRingingCall); when(silentRingingCall.isConference()).thenReturn(false); when(silentRingingCall.getHandle()).thenReturn(Uri.parse("tel:555-000")); when(mMockCallsManager.getCalls()).thenReturn(calls); when(mMockCallsManager.getRingingCall()).thenReturn(silentRingingCall); mBluetoothPhoneService.mBinder.listCurrentCalls(); verify(mMockBluetoothHeadset, never()).clccResponse(eq(1), eq(0), eq(0), eq(0), eq(false), eq("555000"), eq(PhoneNumberUtils.TOA_Unknown)); verify(mMockBluetoothHeadset).clccResponse(0, 0, 0, 0, false, null, 0); } @MediumTest @Test public void testConferenceInProgressCDMA() throws Exception { Loading Loading @@ -788,7 +808,19 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase { verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_INCOMING), eq("555000"), eq(PhoneNumberUtils.TOA_Unknown), nullable(String.class)); } @MediumTest @Test public void testSilentRingingCallState() throws Exception { Call ringingCall = createRingingCall(); when(ringingCall.isSilentRingingRequested()).thenReturn(true); when(ringingCall.getHandle()).thenReturn(Uri.parse("tel:555000")); mBluetoothPhoneService.mCallsManagerListener.onCallAdded(ringingCall); verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_IDLE), eq(""), eq(128), nullable(String.class)); } @MediumTest Loading @@ -810,7 +842,6 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase { verify(mMockBluetoothHeadset).phoneStateChanged(eq(1), eq(1), eq(CALL_STATE_IDLE), eq(""), eq(128), nullable(String.class)); } @MediumTest Loading Loading
src/com/android/server/telecom/BluetoothPhoneServiceImpl.java +9 −7 Original line number Diff line number Diff line Loading @@ -583,7 +583,7 @@ public class BluetoothPhoneServiceImpl { */ private void sendClccForCall(Call call, boolean shouldLog) { boolean isForeground = mCallsManager.getForegroundCall() == call; int state = convertCallState(call.getState(), isForeground); int state = getBtCallState(call, isForeground); boolean isPartOfConference = false; boolean isConferenceWithNoChildren = call.isConference() && call .can(Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN); Loading Loading @@ -707,7 +707,8 @@ public class BluetoothPhoneServiceImpl { String ringingAddress = null; int ringingAddressType = 128; String ringingName = null; if (ringingCall != null && ringingCall.getHandle() != null) { if (ringingCall != null && ringingCall.getHandle() != null && !ringingCall.isSilentRingingRequested()) { ringingAddress = ringingCall.getHandle().getSchemeSpecificPart(); if (ringingAddress != null) { ringingAddressType = PhoneNumberUtils.toaFromString(ringingAddress); Loading Loading @@ -831,7 +832,6 @@ public class BluetoothPhoneServiceImpl { } private int getBluetoothCallStateForUpdate() { CallsManager callsManager = mCallsManager; Call ringingCall = mCallsManager.getRingingCall(); Call dialingCall = mCallsManager.getOutgoingCall(); boolean hasOnlyDisconnectedCalls = mCallsManager.hasOnlyDisconnectedCalls(); Loading @@ -846,7 +846,7 @@ public class BluetoothPhoneServiceImpl { // bluetooth devices (like not getting out of ringing state after answering a call). // int bluetoothCallState = CALL_STATE_IDLE; if (ringingCall != null) { if (ringingCall != null && !ringingCall.isSilentRingingRequested()) { bluetoothCallState = CALL_STATE_INCOMING; } else if (dialingCall != null) { bluetoothCallState = CALL_STATE_ALERTING; Loading @@ -857,8 +857,8 @@ public class BluetoothPhoneServiceImpl { return bluetoothCallState; } private int convertCallState(int callState, boolean isForegroundCall) { switch (callState) { private int getBtCallState(Call call, boolean isForeground) { switch (call.getState()) { case CallState.NEW: case CallState.ABORTED: case CallState.DISCONNECTED: Loading @@ -885,7 +885,9 @@ public class BluetoothPhoneServiceImpl { case CallState.RINGING: case CallState.ANSWERED: if (isForegroundCall) { if (call.isSilentRingingRequested()) { return CALL_STATE_IDLE; } else if (isForeground) { return CALL_STATE_INCOMING; } else { return CALL_STATE_WAITING; Loading
tests/src/com/android/server/telecom/tests/BluetoothPhoneServiceTest.java +32 −1 Original line number Diff line number Diff line Loading @@ -271,6 +271,26 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase { verify(mMockBluetoothHeadset).clccResponse(0, 0, 0, 0, false, null, 0); } @MediumTest @Test public void testListCurrentCallsSilentRinging() throws Exception { ArrayList<Call> calls = new ArrayList<>(); Call silentRingingCall = createActiveCall(); when(silentRingingCall.getState()).thenReturn(CallState.RINGING); when(silentRingingCall.isSilentRingingRequested()).thenReturn(true); calls.add(silentRingingCall); when(silentRingingCall.isConference()).thenReturn(false); when(silentRingingCall.getHandle()).thenReturn(Uri.parse("tel:555-000")); when(mMockCallsManager.getCalls()).thenReturn(calls); when(mMockCallsManager.getRingingCall()).thenReturn(silentRingingCall); mBluetoothPhoneService.mBinder.listCurrentCalls(); verify(mMockBluetoothHeadset, never()).clccResponse(eq(1), eq(0), eq(0), eq(0), eq(false), eq("555000"), eq(PhoneNumberUtils.TOA_Unknown)); verify(mMockBluetoothHeadset).clccResponse(0, 0, 0, 0, false, null, 0); } @MediumTest @Test public void testConferenceInProgressCDMA() throws Exception { Loading Loading @@ -788,7 +808,19 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase { verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_INCOMING), eq("555000"), eq(PhoneNumberUtils.TOA_Unknown), nullable(String.class)); } @MediumTest @Test public void testSilentRingingCallState() throws Exception { Call ringingCall = createRingingCall(); when(ringingCall.isSilentRingingRequested()).thenReturn(true); when(ringingCall.getHandle()).thenReturn(Uri.parse("tel:555000")); mBluetoothPhoneService.mCallsManagerListener.onCallAdded(ringingCall); verify(mMockBluetoothHeadset).phoneStateChanged(eq(0), eq(0), eq(CALL_STATE_IDLE), eq(""), eq(128), nullable(String.class)); } @MediumTest Loading @@ -810,7 +842,6 @@ public class BluetoothPhoneServiceTest extends TelecomTestCase { verify(mMockBluetoothHeadset).phoneStateChanged(eq(1), eq(1), eq(CALL_STATE_IDLE), eq(""), eq(128), nullable(String.class)); } @MediumTest Loading