Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +6 −5 Original line number Diff line number Diff line Loading @@ -278,10 +278,6 @@ public class AdapterService extends Service { private final BluetoothHciVendorSpecificDispatcher mBluetoothHciVendorSpecificDispatcher = new BluetoothHciVendorSpecificDispatcher(); private final BluetoothHciVendorSpecificNativeInterface mBluetoothHciVendorSpecificNativeInterface = new BluetoothHciVendorSpecificNativeInterface( mBluetoothHciVendorSpecificDispatcher); private final Looper mLooper; private final AdapterServiceHandler mHandler; Loading Loading @@ -346,6 +342,7 @@ public class AdapterService extends Service { private BassClientService mBassClientService; private BatteryService mBatteryService; private BluetoothQualityReportNativeInterface mBluetoothQualityReportNativeInterface; private BluetoothHciVendorSpecificNativeInterface mBluetoothHciVendorSpecificNativeInterface; private GattService mGattService; private ScanController mScanController; Loading Loading @@ -696,7 +693,11 @@ public class AdapterService extends Service { mBluetoothQualityReportNativeInterface.init(); if (Flags.hciVendorSpecificExtension()) { mBluetoothHciVendorSpecificNativeInterface.init(); mBluetoothHciVendorSpecificNativeInterface = requireNonNull( mBluetoothHciVendorSpecificNativeInterface.getInstance(), "mBluetoothHciVendorSpecificNativeInterface cannot be null"); mBluetoothHciVendorSpecificNativeInterface.init(mBluetoothHciVendorSpecificDispatcher); } mSdpManager = new SdpManager(this, mLooper); Loading android/app/src/com/android/bluetooth/btservice/BluetoothHciVendorSpecificNativeInterface.java +29 −6 Original line number Diff line number Diff line Loading @@ -16,16 +16,39 @@ package com.android.bluetooth.btservice; class BluetoothHciVendorSpecificNativeInterface { import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; public class BluetoothHciVendorSpecificNativeInterface { private static final String TAG = "BluetoothHciVendorSpecificNativeInterface"; private final BluetoothHciVendorSpecificDispatcher mDispatcher; public BluetoothHciVendorSpecificNativeInterface( BluetoothHciVendorSpecificDispatcher dispatcher) { mDispatcher = dispatcher; @GuardedBy("INSTANCE_LOCK") private static BluetoothHciVendorSpecificNativeInterface sInstance; private static final Object INSTANCE_LOCK = new Object(); /** Get singleton instance. */ public static BluetoothHciVendorSpecificNativeInterface getInstance() { synchronized (INSTANCE_LOCK) { if (sInstance == null) { sInstance = new BluetoothHciVendorSpecificNativeInterface(); } return sInstance; } } void init() { /** Set singleton instance. */ @VisibleForTesting static void setInstance(BluetoothHciVendorSpecificNativeInterface instance) { synchronized (INSTANCE_LOCK) { sInstance = instance; } } private BluetoothHciVendorSpecificDispatcher mDispatcher; void init(BluetoothHciVendorSpecificDispatcher dispatcher) { mDispatcher = dispatcher; initNative(); } Loading android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +3 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,7 @@ public class AdapterServiceTest { private @Mock AdapterNativeInterface mNativeInterface; private @Mock BluetoothKeystoreNativeInterface mKeystoreNativeInterface; private @Mock BluetoothQualityReportNativeInterface mQualityNativeInterface; private @Mock BluetoothHciVendorSpecificNativeInterface mHciVendorSpecificNativeInterface; private @Mock SdpManagerNativeInterface mSdpNativeInterface; private @Mock AdvertiseManagerNativeInterface mAdvertiseNativeInterface; private @Mock DistanceMeasurementNativeInterface mDistanceNativeInterface; Loading Loading @@ -226,6 +227,7 @@ public class AdapterServiceTest { AdapterNativeInterface.setInstance(mNativeInterface); BluetoothKeystoreNativeInterface.setInstance(mKeystoreNativeInterface); BluetoothQualityReportNativeInterface.setInstance(mQualityNativeInterface); BluetoothHciVendorSpecificNativeInterface.setInstance(mHciVendorSpecificNativeInterface); SdpManagerNativeInterface.setInstance(mSdpNativeInterface); AdvertiseManagerNativeInterface.setInstance(mAdvertiseNativeInterface); DistanceMeasurementNativeInterface.setInstance(mDistanceNativeInterface); Loading Loading @@ -354,6 +356,7 @@ public class AdapterServiceTest { AdapterNativeInterface.setInstance(null); BluetoothKeystoreNativeInterface.setInstance(null); BluetoothQualityReportNativeInterface.setInstance(null); BluetoothHciVendorSpecificNativeInterface.setInstance(null); SdpManagerNativeInterface.setInstance(null); AdvertiseManagerNativeInterface.setInstance(null); DistanceMeasurementNativeInterface.setInstance(null); Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +6 −5 Original line number Diff line number Diff line Loading @@ -278,10 +278,6 @@ public class AdapterService extends Service { private final BluetoothHciVendorSpecificDispatcher mBluetoothHciVendorSpecificDispatcher = new BluetoothHciVendorSpecificDispatcher(); private final BluetoothHciVendorSpecificNativeInterface mBluetoothHciVendorSpecificNativeInterface = new BluetoothHciVendorSpecificNativeInterface( mBluetoothHciVendorSpecificDispatcher); private final Looper mLooper; private final AdapterServiceHandler mHandler; Loading Loading @@ -346,6 +342,7 @@ public class AdapterService extends Service { private BassClientService mBassClientService; private BatteryService mBatteryService; private BluetoothQualityReportNativeInterface mBluetoothQualityReportNativeInterface; private BluetoothHciVendorSpecificNativeInterface mBluetoothHciVendorSpecificNativeInterface; private GattService mGattService; private ScanController mScanController; Loading Loading @@ -696,7 +693,11 @@ public class AdapterService extends Service { mBluetoothQualityReportNativeInterface.init(); if (Flags.hciVendorSpecificExtension()) { mBluetoothHciVendorSpecificNativeInterface.init(); mBluetoothHciVendorSpecificNativeInterface = requireNonNull( mBluetoothHciVendorSpecificNativeInterface.getInstance(), "mBluetoothHciVendorSpecificNativeInterface cannot be null"); mBluetoothHciVendorSpecificNativeInterface.init(mBluetoothHciVendorSpecificDispatcher); } mSdpManager = new SdpManager(this, mLooper); Loading
android/app/src/com/android/bluetooth/btservice/BluetoothHciVendorSpecificNativeInterface.java +29 −6 Original line number Diff line number Diff line Loading @@ -16,16 +16,39 @@ package com.android.bluetooth.btservice; class BluetoothHciVendorSpecificNativeInterface { import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; public class BluetoothHciVendorSpecificNativeInterface { private static final String TAG = "BluetoothHciVendorSpecificNativeInterface"; private final BluetoothHciVendorSpecificDispatcher mDispatcher; public BluetoothHciVendorSpecificNativeInterface( BluetoothHciVendorSpecificDispatcher dispatcher) { mDispatcher = dispatcher; @GuardedBy("INSTANCE_LOCK") private static BluetoothHciVendorSpecificNativeInterface sInstance; private static final Object INSTANCE_LOCK = new Object(); /** Get singleton instance. */ public static BluetoothHciVendorSpecificNativeInterface getInstance() { synchronized (INSTANCE_LOCK) { if (sInstance == null) { sInstance = new BluetoothHciVendorSpecificNativeInterface(); } return sInstance; } } void init() { /** Set singleton instance. */ @VisibleForTesting static void setInstance(BluetoothHciVendorSpecificNativeInterface instance) { synchronized (INSTANCE_LOCK) { sInstance = instance; } } private BluetoothHciVendorSpecificDispatcher mDispatcher; void init(BluetoothHciVendorSpecificDispatcher dispatcher) { mDispatcher = dispatcher; initNative(); } Loading
android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +3 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,7 @@ public class AdapterServiceTest { private @Mock AdapterNativeInterface mNativeInterface; private @Mock BluetoothKeystoreNativeInterface mKeystoreNativeInterface; private @Mock BluetoothQualityReportNativeInterface mQualityNativeInterface; private @Mock BluetoothHciVendorSpecificNativeInterface mHciVendorSpecificNativeInterface; private @Mock SdpManagerNativeInterface mSdpNativeInterface; private @Mock AdvertiseManagerNativeInterface mAdvertiseNativeInterface; private @Mock DistanceMeasurementNativeInterface mDistanceNativeInterface; Loading Loading @@ -226,6 +227,7 @@ public class AdapterServiceTest { AdapterNativeInterface.setInstance(mNativeInterface); BluetoothKeystoreNativeInterface.setInstance(mKeystoreNativeInterface); BluetoothQualityReportNativeInterface.setInstance(mQualityNativeInterface); BluetoothHciVendorSpecificNativeInterface.setInstance(mHciVendorSpecificNativeInterface); SdpManagerNativeInterface.setInstance(mSdpNativeInterface); AdvertiseManagerNativeInterface.setInstance(mAdvertiseNativeInterface); DistanceMeasurementNativeInterface.setInstance(mDistanceNativeInterface); Loading Loading @@ -354,6 +356,7 @@ public class AdapterServiceTest { AdapterNativeInterface.setInstance(null); BluetoothKeystoreNativeInterface.setInstance(null); BluetoothQualityReportNativeInterface.setInstance(null); BluetoothHciVendorSpecificNativeInterface.setInstance(null); SdpManagerNativeInterface.setInstance(null); AdvertiseManagerNativeInterface.setInstance(null); DistanceMeasurementNativeInterface.setInstance(null); Loading