Loading android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java +2 −0 Original line number Diff line number Diff line Loading @@ -245,6 +245,7 @@ public class HeadsetClientStateMachine extends StateMachine { ProfileService.println(sb, " mAudioRouteAllowed: " + mAudioRouteAllowed); ProfileService.println(sb, " mAudioPolicyRemoteSupported: " + mAudioPolicyRemoteSupported); ProfileService.println(sb, " mHsClientAudioPolicy: " + mHsClientAudioPolicy); ProfileService.println(sb, " mInBandRing: " + mInBandRing); ProfileService.println(sb, " mCalls:"); if (mCalls != null) { Loading Loading @@ -1186,6 +1187,7 @@ public class HeadsetClientStateMachine extends StateMachine { case StackEvent.EVENT_TYPE_CLIP: case StackEvent.EVENT_TYPE_CALL_WAITING: case StackEvent.EVENT_TYPE_VOLUME_CHANGED: case StackEvent.EVENT_TYPE_IN_BAND_RINGTONE: deferMessage(message); break; case StackEvent.EVENT_TYPE_CMD_RESULT: Loading android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import java.util.Objects; */ public class NativeInterface { private static final String TAG = "NativeInterface"; private static final boolean DBG = false; private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG); private AdapterService mAdapterService; static { Loading android/app/src/com/android/bluetooth/hfpclient/StackEvent.java +4 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,8 @@ public class StackEvent { return "EVENT_TYPE_CONNECTION_STATE_CHANGED"; case EVENT_TYPE_AUDIO_STATE_CHANGED: return "EVENT_TYPE_AUDIO_STATE_CHANGED"; case EVENT_TYPE_VR_STATE_CHANGED: return "EVENT_TYPE_VR_STATE_CHANGED"; case EVENT_TYPE_NETWORK_STATE: return "EVENT_TYPE_NETWORK_STATE"; case EVENT_TYPE_ROAMING_STATE: Loading Loading @@ -122,6 +124,8 @@ public class StackEvent { return "EVENT_TYPE_RESP_AND_HOLD"; case EVENT_TYPE_RING_INDICATION: return "EVENT_TYPE_RING_INDICATION"; case EVENT_TYPE_IN_BAND_RINGTONE: return "EVENT_TYPE_IN_BAND_RINGTONE"; default: return "EVENT_TYPE_UNKNOWN:" + type; } Loading android/app/src/com/android/bluetooth/hfpclient/connserv/HfpClientConnection.java +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ import java.util.UUID; public class HfpClientConnection extends Connection { private static final String TAG = "HfpClientConnection"; private static final boolean DBG = false; private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG); private static final String EVENT_SCO_CONNECT = "com.android.bluetooth.hfpclient.SCO_CONNECT"; private static final String EVENT_SCO_DISCONNECT = Loading android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static com.android.bluetooth.hfpclient.HeadsetClientStateMachine.EXPLICIT import static com.android.bluetooth.hfpclient.HeadsetClientStateMachine.VOICE_RECOGNITION_START; import static com.android.bluetooth.hfpclient.HeadsetClientStateMachine.VOICE_RECOGNITION_STOP; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.*; import android.app.BroadcastOptions; Loading Loading @@ -1193,6 +1194,8 @@ public class HeadsetClientStateMachineTest { public void testProcessConnectMessage_onConnectingState() { initToConnectingState(); mHeadsetClientStateMachine.sendMessage(HeadsetClientStateMachine.CONNECT); assertThat(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( HeadsetClientStateMachine.CONNECT)).isFalse(); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); Assert.assertTrue(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( HeadsetClientStateMachine.CONNECT)); Loading Loading @@ -1240,6 +1243,8 @@ public class HeadsetClientStateMachineTest { StackEvent event = new StackEvent(StackEvent.EVENT_TYPE_CALL); event.valueInt = StackEvent.EVENT_TYPE_CALL; event.device = mTestDevice; assertThat(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( StackEvent.STACK_EVENT)).isFalse(); mHeadsetClientStateMachine.sendMessage( mHeadsetClientStateMachine.obtainMessage(StackEvent.STACK_EVENT, event)); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); Loading Loading @@ -1284,6 +1289,21 @@ public class HeadsetClientStateMachineTest { verify(mHeadsetService).updateInbandRinging(eq(mTestDevice), eq(false)); } @Test public void testProcessStackEvent_inBandRingTone_onConnectingState() { initToConnectingState(); StackEvent event = new StackEvent(StackEvent.EVENT_TYPE_IN_BAND_RINGTONE); event.valueInt = StackEvent.EVENT_TYPE_IN_BAND_RINGTONE; event.device = mTestDevice; assertThat(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( StackEvent.STACK_EVENT)).isFalse(); mHeadsetClientStateMachine.sendMessage( mHeadsetClientStateMachine.obtainMessage(StackEvent.STACK_EVENT, event)); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); assertThat(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( StackEvent.STACK_EVENT)).isTrue(); } @Test public void testProcessConnectMessage_onConnectedState() { initToConnectedState(); Loading Loading @@ -1328,6 +1348,8 @@ public class HeadsetClientStateMachineTest { @Test public void testProcessDisconnectMessage_onAudioOnState() { initToAudioOnState(); assertThat(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( HeadsetClientStateMachine.DISCONNECT)).isFalse(); mHeadsetClientStateMachine.sendMessage(HeadsetClientStateMachine.DISCONNECT, mTestDevice); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); Assert.assertTrue(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( Loading Loading
android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java +2 −0 Original line number Diff line number Diff line Loading @@ -245,6 +245,7 @@ public class HeadsetClientStateMachine extends StateMachine { ProfileService.println(sb, " mAudioRouteAllowed: " + mAudioRouteAllowed); ProfileService.println(sb, " mAudioPolicyRemoteSupported: " + mAudioPolicyRemoteSupported); ProfileService.println(sb, " mHsClientAudioPolicy: " + mHsClientAudioPolicy); ProfileService.println(sb, " mInBandRing: " + mInBandRing); ProfileService.println(sb, " mCalls:"); if (mCalls != null) { Loading Loading @@ -1186,6 +1187,7 @@ public class HeadsetClientStateMachine extends StateMachine { case StackEvent.EVENT_TYPE_CLIP: case StackEvent.EVENT_TYPE_CALL_WAITING: case StackEvent.EVENT_TYPE_VOLUME_CHANGED: case StackEvent.EVENT_TYPE_IN_BAND_RINGTONE: deferMessage(message); break; case StackEvent.EVENT_TYPE_CMD_RESULT: Loading
android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import java.util.Objects; */ public class NativeInterface { private static final String TAG = "NativeInterface"; private static final boolean DBG = false; private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG); private AdapterService mAdapterService; static { Loading
android/app/src/com/android/bluetooth/hfpclient/StackEvent.java +4 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,8 @@ public class StackEvent { return "EVENT_TYPE_CONNECTION_STATE_CHANGED"; case EVENT_TYPE_AUDIO_STATE_CHANGED: return "EVENT_TYPE_AUDIO_STATE_CHANGED"; case EVENT_TYPE_VR_STATE_CHANGED: return "EVENT_TYPE_VR_STATE_CHANGED"; case EVENT_TYPE_NETWORK_STATE: return "EVENT_TYPE_NETWORK_STATE"; case EVENT_TYPE_ROAMING_STATE: Loading Loading @@ -122,6 +124,8 @@ public class StackEvent { return "EVENT_TYPE_RESP_AND_HOLD"; case EVENT_TYPE_RING_INDICATION: return "EVENT_TYPE_RING_INDICATION"; case EVENT_TYPE_IN_BAND_RINGTONE: return "EVENT_TYPE_IN_BAND_RINGTONE"; default: return "EVENT_TYPE_UNKNOWN:" + type; } Loading
android/app/src/com/android/bluetooth/hfpclient/connserv/HfpClientConnection.java +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ import java.util.UUID; public class HfpClientConnection extends Connection { private static final String TAG = "HfpClientConnection"; private static final boolean DBG = false; private static final boolean DBG = Log.isLoggable(TAG, Log.DEBUG); private static final String EVENT_SCO_CONNECT = "com.android.bluetooth.hfpclient.SCO_CONNECT"; private static final String EVENT_SCO_DISCONNECT = Loading
android/app/tests/unit/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachineTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static com.android.bluetooth.hfpclient.HeadsetClientStateMachine.EXPLICIT import static com.android.bluetooth.hfpclient.HeadsetClientStateMachine.VOICE_RECOGNITION_START; import static com.android.bluetooth.hfpclient.HeadsetClientStateMachine.VOICE_RECOGNITION_STOP; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.*; import android.app.BroadcastOptions; Loading Loading @@ -1193,6 +1194,8 @@ public class HeadsetClientStateMachineTest { public void testProcessConnectMessage_onConnectingState() { initToConnectingState(); mHeadsetClientStateMachine.sendMessage(HeadsetClientStateMachine.CONNECT); assertThat(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( HeadsetClientStateMachine.CONNECT)).isFalse(); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); Assert.assertTrue(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( HeadsetClientStateMachine.CONNECT)); Loading Loading @@ -1240,6 +1243,8 @@ public class HeadsetClientStateMachineTest { StackEvent event = new StackEvent(StackEvent.EVENT_TYPE_CALL); event.valueInt = StackEvent.EVENT_TYPE_CALL; event.device = mTestDevice; assertThat(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( StackEvent.STACK_EVENT)).isFalse(); mHeadsetClientStateMachine.sendMessage( mHeadsetClientStateMachine.obtainMessage(StackEvent.STACK_EVENT, event)); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); Loading Loading @@ -1284,6 +1289,21 @@ public class HeadsetClientStateMachineTest { verify(mHeadsetService).updateInbandRinging(eq(mTestDevice), eq(false)); } @Test public void testProcessStackEvent_inBandRingTone_onConnectingState() { initToConnectingState(); StackEvent event = new StackEvent(StackEvent.EVENT_TYPE_IN_BAND_RINGTONE); event.valueInt = StackEvent.EVENT_TYPE_IN_BAND_RINGTONE; event.device = mTestDevice; assertThat(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( StackEvent.STACK_EVENT)).isFalse(); mHeadsetClientStateMachine.sendMessage( mHeadsetClientStateMachine.obtainMessage(StackEvent.STACK_EVENT, event)); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); assertThat(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( StackEvent.STACK_EVENT)).isTrue(); } @Test public void testProcessConnectMessage_onConnectedState() { initToConnectedState(); Loading Loading @@ -1328,6 +1348,8 @@ public class HeadsetClientStateMachineTest { @Test public void testProcessDisconnectMessage_onAudioOnState() { initToAudioOnState(); assertThat(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( HeadsetClientStateMachine.DISCONNECT)).isFalse(); mHeadsetClientStateMachine.sendMessage(HeadsetClientStateMachine.DISCONNECT, mTestDevice); TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper()); Assert.assertTrue(mHeadsetClientStateMachine.doesSuperHaveDeferredMessages( Loading