Loading android/app/src/com/android/bluetooth/telephony/BluetoothCall.java +4 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,10 @@ public class BluetoothCall { return mCall; } public boolean isCallNull() { return mCall == null; } public void setCall(Call call) { mCall = call; } Loading android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java +2 −2 Original line number Diff line number Diff line Loading @@ -492,7 +492,7 @@ public class BluetoothInCallService extends InCallService { .setSnrDb(snr) .setRetransmittedPacketsCount(retransmissionCount) .setPacketsNotReceivedCount(packetsNotReceiveCount) .setPacketsNotReceivedCount(negativeAcknowledgementCount) .setNegativeAcknowledgementCount(negativeAcknowledgementCount) .build()); call.sendCallEvent( BluetoothCallQualityReport.EVENT_BLUETOOTH_CALL_QUALITY_REPORT, b); Loading Loading @@ -1145,7 +1145,7 @@ public class BluetoothInCallService extends InCallService { } public boolean isNullCall(BluetoothCall call) { return call == null || call.getCall() == null; return call == null || call.isCallNull(); } }; }; android/app/tests/unit/src/com/android/bluetooth/telephony/BluetoothInCallServiceTest.java +37 −0 Original line number Diff line number Diff line Loading @@ -25,7 +25,9 @@ import android.content.Intent; import android.content.IntentFilter; import android.net.Uri; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.telecom.BluetoothCallQualityReport; import android.telecom.Call; import android.telecom.Connection; import android.telecom.GatewayInfo; Loading @@ -49,6 +51,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; Loading Loading @@ -256,6 +259,40 @@ public class BluetoothInCallServiceTest { verify(mMockBluetoothHeadset).clccResponse(0, 0, 0, 0, false, null, 0); } /** * Verifies bluetooth call quality reports are properly parceled and set as a call event to * Telecom. */ @Test public void testBluetoothCallQualityReport() { BluetoothCall activeCall = createForegroundCall(); when(activeCall.isCallNull()).thenReturn(false); mBluetoothInCallService.onCallAdded(activeCall); mBluetoothInCallService.sendBluetoothCallQualityReport( 10, // long timestamp 20, // int rssi 30, // int snr 40, // int retransmissionCount 50, // int packetsNotReceiveCount 60 // int negativeAcknowledgementCount ); ArgumentCaptor<Bundle> bundleCaptor = ArgumentCaptor.forClass(Bundle.class); verify(activeCall).sendCallEvent( eq(BluetoothCallQualityReport.EVENT_BLUETOOTH_CALL_QUALITY_REPORT), bundleCaptor.capture()); Bundle bundle = bundleCaptor.getValue(); BluetoothCallQualityReport report = (BluetoothCallQualityReport) bundle.get( BluetoothCallQualityReport.EXTRA_BLUETOOTH_CALL_QUALITY_REPORT); Assert.assertEquals(10, report.getSentTimestampMillis()); Assert.assertEquals(20, report.getRssiDbm()); Assert.assertEquals(30, report.getSnrDb()); Assert.assertEquals(40, report.getRetransmittedPacketsCount()); Assert.assertEquals(50, report.getPacketsNotReceivedCount()); Assert.assertEquals(60, report.getNegativeAcknowledgementCount()); } @Test public void testListCurrentCallsSilentRinging() throws Exception { ArrayList<BluetoothCall> calls = new ArrayList<>(); Loading Loading
android/app/src/com/android/bluetooth/telephony/BluetoothCall.java +4 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,10 @@ public class BluetoothCall { return mCall; } public boolean isCallNull() { return mCall == null; } public void setCall(Call call) { mCall = call; } Loading
android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java +2 −2 Original line number Diff line number Diff line Loading @@ -492,7 +492,7 @@ public class BluetoothInCallService extends InCallService { .setSnrDb(snr) .setRetransmittedPacketsCount(retransmissionCount) .setPacketsNotReceivedCount(packetsNotReceiveCount) .setPacketsNotReceivedCount(negativeAcknowledgementCount) .setNegativeAcknowledgementCount(negativeAcknowledgementCount) .build()); call.sendCallEvent( BluetoothCallQualityReport.EVENT_BLUETOOTH_CALL_QUALITY_REPORT, b); Loading Loading @@ -1145,7 +1145,7 @@ public class BluetoothInCallService extends InCallService { } public boolean isNullCall(BluetoothCall call) { return call == null || call.getCall() == null; return call == null || call.isCallNull(); } }; };
android/app/tests/unit/src/com/android/bluetooth/telephony/BluetoothInCallServiceTest.java +37 −0 Original line number Diff line number Diff line Loading @@ -25,7 +25,9 @@ import android.content.Intent; import android.content.IntentFilter; import android.net.Uri; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.telecom.BluetoothCallQualityReport; import android.telecom.Call; import android.telecom.Connection; import android.telecom.GatewayInfo; Loading @@ -49,6 +51,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; Loading Loading @@ -256,6 +259,40 @@ public class BluetoothInCallServiceTest { verify(mMockBluetoothHeadset).clccResponse(0, 0, 0, 0, false, null, 0); } /** * Verifies bluetooth call quality reports are properly parceled and set as a call event to * Telecom. */ @Test public void testBluetoothCallQualityReport() { BluetoothCall activeCall = createForegroundCall(); when(activeCall.isCallNull()).thenReturn(false); mBluetoothInCallService.onCallAdded(activeCall); mBluetoothInCallService.sendBluetoothCallQualityReport( 10, // long timestamp 20, // int rssi 30, // int snr 40, // int retransmissionCount 50, // int packetsNotReceiveCount 60 // int negativeAcknowledgementCount ); ArgumentCaptor<Bundle> bundleCaptor = ArgumentCaptor.forClass(Bundle.class); verify(activeCall).sendCallEvent( eq(BluetoothCallQualityReport.EVENT_BLUETOOTH_CALL_QUALITY_REPORT), bundleCaptor.capture()); Bundle bundle = bundleCaptor.getValue(); BluetoothCallQualityReport report = (BluetoothCallQualityReport) bundle.get( BluetoothCallQualityReport.EXTRA_BLUETOOTH_CALL_QUALITY_REPORT); Assert.assertEquals(10, report.getSentTimestampMillis()); Assert.assertEquals(20, report.getRssiDbm()); Assert.assertEquals(30, report.getSnrDb()); Assert.assertEquals(40, report.getRetransmittedPacketsCount()); Assert.assertEquals(50, report.getPacketsNotReceivedCount()); Assert.assertEquals(60, report.getNegativeAcknowledgementCount()); } @Test public void testListCurrentCallsSilentRinging() throws Exception { ArrayList<BluetoothCall> calls = new ArrayList<>(); Loading