Loading android/app/src/com/android/bluetooth/le_audio/LeAudioNativeInterface.java +11 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.util.Log; import com.android.bluetooth.Utils; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import java.util.Arrays; Loading Loading @@ -67,6 +68,16 @@ public class LeAudioNativeInterface { } } /** * Set singleton instance. */ @VisibleForTesting static void setInstance(LeAudioNativeInterface instance) { synchronized (INSTANCE_LOCK) { sInstance = instance; } } private byte[] getByteAddress(BluetoothDevice device) { if (device == null) { return Utils.getBytesFromAddress("00:00:00:00:00:00"); Loading android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -180,8 +180,8 @@ public class LeAudioServiceTest { doAnswer(invocation -> mBondedDevices.toArray(new BluetoothDevice[]{})).when( mAdapterService).getBondedDevices(); LeAudioNativeInterface.setInstance(mNativeInterface); startService(); mService.mLeAudioNativeInterface = mNativeInterface; mService.mAudioManager = mAudioManager; mService.mVolumeControlService = mVolumeControlService; Loading Loading @@ -217,6 +217,8 @@ public class LeAudioServiceTest { .getBondState(any(BluetoothDevice.class)); doReturn(new ParcelUuid[]{BluetoothUuid.LE_AUDIO}).when(mAdapterService) .getRemoteUuids(any(BluetoothDevice.class)); verify(mNativeInterface, timeout(3000).times(1)).init(any()); } @After Loading @@ -231,6 +233,7 @@ public class LeAudioServiceTest { mTargetContext.unregisterReceiver(mLeAudioIntentReceiver); mDeviceQueueMap.clear(); TestUtils.clearAdapterService(mAdapterService); LeAudioNativeInterface.setInstance(null); } private void startService() throws TimeoutException { Loading Loading
android/app/src/com/android/bluetooth/le_audio/LeAudioNativeInterface.java +11 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.util.Log; import com.android.bluetooth.Utils; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import java.util.Arrays; Loading Loading @@ -67,6 +68,16 @@ public class LeAudioNativeInterface { } } /** * Set singleton instance. */ @VisibleForTesting static void setInstance(LeAudioNativeInterface instance) { synchronized (INSTANCE_LOCK) { sInstance = instance; } } private byte[] getByteAddress(BluetoothDevice device) { if (device == null) { return Utils.getBytesFromAddress("00:00:00:00:00:00"); Loading
android/app/tests/unit/src/com/android/bluetooth/le_audio/LeAudioServiceTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -180,8 +180,8 @@ public class LeAudioServiceTest { doAnswer(invocation -> mBondedDevices.toArray(new BluetoothDevice[]{})).when( mAdapterService).getBondedDevices(); LeAudioNativeInterface.setInstance(mNativeInterface); startService(); mService.mLeAudioNativeInterface = mNativeInterface; mService.mAudioManager = mAudioManager; mService.mVolumeControlService = mVolumeControlService; Loading Loading @@ -217,6 +217,8 @@ public class LeAudioServiceTest { .getBondState(any(BluetoothDevice.class)); doReturn(new ParcelUuid[]{BluetoothUuid.LE_AUDIO}).when(mAdapterService) .getRemoteUuids(any(BluetoothDevice.class)); verify(mNativeInterface, timeout(3000).times(1)).init(any()); } @After Loading @@ -231,6 +233,7 @@ public class LeAudioServiceTest { mTargetContext.unregisterReceiver(mLeAudioIntentReceiver); mDeviceQueueMap.clear(); TestUtils.clearAdapterService(mAdapterService); LeAudioNativeInterface.setInstance(null); } private void startService() throws TimeoutException { Loading