Loading android/app/Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,10 @@ android_app { javacflags: ["-Aroom.schemaLocation=packages/modules/Bluetooth/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/schemas"], optimize: { enabled: false, enabled: true, shrink: true, optimize: false, proguard_flags_files: ["proguard.flags"], }, required: [ "android.hardware.bluetooth@1.0", Loading android/app/proguard.flags 0 → 100644 +7 −0 Original line number Diff line number Diff line -allowaccessmodification -keep,allowoptimization,allowaccessmodification class com.android.bluetooth.** { *; } # Required to support APIs only referenced indirectly via tests. -keep class android.support.v4.media.MediaMetadataCompat { *; } -keep class android.support.v4.media.MediaBrowserCompat$MediaItem { *; } -keep class android.support.v4.media.MediaDescriptionCompat { *; } android/app/tests/unit/src/com/android/bluetooth/hap/HapClientTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -657,6 +657,9 @@ public class HapClientTest { doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService) .getRemoteUuids(any(BluetoothDevice.class)); doCallRealMethod() .when(mNativeInterface) .onDeviceAvailable(any(byte[].class), anyInt()); mNativeInterface.onDeviceAvailable(getByteAddress(mDevice), 0x03); Intent intent = TestUtils.waitForIntent(TIMEOUT_MS, mIntentQueue.get(mDevice)); Loading @@ -675,6 +678,9 @@ public class HapClientTest { doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService) .getRemoteUuids(any(BluetoothDevice.class)); doCallRealMethod() .when(mNativeInterface) .onActivePresetSelected(any(byte[].class), anyInt()); mNativeInterface.onActivePresetSelected(getByteAddress(mDevice), 0x01); try { Loading @@ -696,6 +702,10 @@ public class HapClientTest { doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService) .getRemoteUuids(any(BluetoothDevice.class)); doCallRealMethod() .when(mNativeInterface) .onActivePresetSelectError(any(byte[].class), anyInt()); /* Send INVALID_PRESET_INDEX error */ mNativeInterface.onActivePresetSelectError(getByteAddress(mDevice), 0x05); Loading Loading @@ -724,6 +734,10 @@ public class HapClientTest { .setWritable(true) .setAvailable(false) .build()}; doCallRealMethod() .when(mNativeInterface) .onPresetInfo(any(byte[].class), anyInt(), any()); mNativeInterface.onPresetInfo(getByteAddress(mDevice), info_reason, info); ArgumentCaptor<List<BluetoothHapPresetInfo>> presetsCaptor = Loading Loading @@ -755,6 +769,9 @@ public class HapClientTest { doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService) .getRemoteUuids(any(BluetoothDevice.class)); doCallRealMethod() .when(mNativeInterface) .onPresetNameSetError(any(byte[].class), anyInt(), anyInt()); /* Not a valid name length */ mNativeInterface.onPresetNameSetError(getByteAddress(mDevice), 0x01, HapClientStackEvent.STATUS_INVALID_PRESET_NAME_LENGTH); Loading Loading @@ -814,6 +831,10 @@ public class HapClientTest { doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService) .getRemoteUuids(any(BluetoothDevice.class)); doCallRealMethod() .when(mNativeInterface) .onGroupPresetNameSetError(anyInt(), anyInt(), anyInt()); /* Not a valid name length */ mNativeInterface.onGroupPresetNameSetError(0x01, 0x01, HapClientStackEvent.STATUS_INVALID_PRESET_NAME_LENGTH); Loading android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientDeviceBlockTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,7 @@ package com.android.bluetooth.hfpclient; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.mockito.Mockito.*; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; Loading Loading @@ -147,6 +146,9 @@ public class HfpClientDeviceBlockTest { private HfpClientConnection createOutgoingConnectionWithScoState(int scoState) { when(mHeadsetClientService.getAudioState(mBluetoothDevice)).thenReturn(scoState); doCallRealMethod() .when(mConnServ) .createAccount(any()); mHfpClientDeviceBlock = new HfpClientDeviceBlock(mBluetoothDevice, mConnServ, mMockServiceInterface); return mHfpClientDeviceBlock.onCreateOutgoingConnection( Loading Loading
android/app/Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,10 @@ android_app { javacflags: ["-Aroom.schemaLocation=packages/modules/Bluetooth/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/schemas"], optimize: { enabled: false, enabled: true, shrink: true, optimize: false, proguard_flags_files: ["proguard.flags"], }, required: [ "android.hardware.bluetooth@1.0", Loading
android/app/proguard.flags 0 → 100644 +7 −0 Original line number Diff line number Diff line -allowaccessmodification -keep,allowoptimization,allowaccessmodification class com.android.bluetooth.** { *; } # Required to support APIs only referenced indirectly via tests. -keep class android.support.v4.media.MediaMetadataCompat { *; } -keep class android.support.v4.media.MediaBrowserCompat$MediaItem { *; } -keep class android.support.v4.media.MediaDescriptionCompat { *; }
android/app/tests/unit/src/com/android/bluetooth/hap/HapClientTest.java +21 −0 Original line number Diff line number Diff line Loading @@ -657,6 +657,9 @@ public class HapClientTest { doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService) .getRemoteUuids(any(BluetoothDevice.class)); doCallRealMethod() .when(mNativeInterface) .onDeviceAvailable(any(byte[].class), anyInt()); mNativeInterface.onDeviceAvailable(getByteAddress(mDevice), 0x03); Intent intent = TestUtils.waitForIntent(TIMEOUT_MS, mIntentQueue.get(mDevice)); Loading @@ -675,6 +678,9 @@ public class HapClientTest { doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService) .getRemoteUuids(any(BluetoothDevice.class)); doCallRealMethod() .when(mNativeInterface) .onActivePresetSelected(any(byte[].class), anyInt()); mNativeInterface.onActivePresetSelected(getByteAddress(mDevice), 0x01); try { Loading @@ -696,6 +702,10 @@ public class HapClientTest { doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService) .getRemoteUuids(any(BluetoothDevice.class)); doCallRealMethod() .when(mNativeInterface) .onActivePresetSelectError(any(byte[].class), anyInt()); /* Send INVALID_PRESET_INDEX error */ mNativeInterface.onActivePresetSelectError(getByteAddress(mDevice), 0x05); Loading Loading @@ -724,6 +734,10 @@ public class HapClientTest { .setWritable(true) .setAvailable(false) .build()}; doCallRealMethod() .when(mNativeInterface) .onPresetInfo(any(byte[].class), anyInt(), any()); mNativeInterface.onPresetInfo(getByteAddress(mDevice), info_reason, info); ArgumentCaptor<List<BluetoothHapPresetInfo>> presetsCaptor = Loading Loading @@ -755,6 +769,9 @@ public class HapClientTest { doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService) .getRemoteUuids(any(BluetoothDevice.class)); doCallRealMethod() .when(mNativeInterface) .onPresetNameSetError(any(byte[].class), anyInt(), anyInt()); /* Not a valid name length */ mNativeInterface.onPresetNameSetError(getByteAddress(mDevice), 0x01, HapClientStackEvent.STATUS_INVALID_PRESET_NAME_LENGTH); Loading Loading @@ -814,6 +831,10 @@ public class HapClientTest { doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService) .getRemoteUuids(any(BluetoothDevice.class)); doCallRealMethod() .when(mNativeInterface) .onGroupPresetNameSetError(anyInt(), anyInt(), anyInt()); /* Not a valid name length */ mNativeInterface.onGroupPresetNameSetError(0x01, 0x01, HapClientStackEvent.STATUS_INVALID_PRESET_NAME_LENGTH); Loading
android/app/tests/unit/src/com/android/bluetooth/hfpclient/connserv/HfpClientDeviceBlockTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,7 @@ package com.android.bluetooth.hfpclient; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.mockito.Mockito.*; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; Loading Loading @@ -147,6 +146,9 @@ public class HfpClientDeviceBlockTest { private HfpClientConnection createOutgoingConnectionWithScoState(int scoState) { when(mHeadsetClientService.getAudioState(mBluetoothDevice)).thenReturn(scoState); doCallRealMethod() .when(mConnServ) .createAccount(any()); mHfpClientDeviceBlock = new HfpClientDeviceBlock(mBluetoothDevice, mConnServ, mMockServiceInterface); return mHfpClientDeviceBlock.onCreateOutgoingConnection( Loading