Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cabf7ea8 authored by ELIYAZ MOMIN's avatar ELIYAZ MOMIN Committed by Gerrit Code Review
Browse files

Revert "HCI Vendor Specific Interface needs to be mocked for testing"

This reverts commit ea427167.

Reason for revert: <Potential culprit for b/382629388  - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.>

Change-Id: Ia55d4ddd4b38f695f0bfa7f1c93a71057c64c9a9
parent ea427167
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -278,6 +278,10 @@ 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;
@@ -342,7 +346,6 @@ public class AdapterService extends Service {
    private BassClientService mBassClientService;
    private BatteryService mBatteryService;
    private BluetoothQualityReportNativeInterface mBluetoothQualityReportNativeInterface;
    private BluetoothHciVendorSpecificNativeInterface mBluetoothHciVendorSpecificNativeInterface;
    private GattService mGattService;
    private ScanController mScanController;

@@ -693,11 +696,7 @@ public class AdapterService extends Service {
        mBluetoothQualityReportNativeInterface.init();

        if (Flags.hciVendorSpecificExtension()) {
            mBluetoothHciVendorSpecificNativeInterface =
                    requireNonNull(
                            mBluetoothHciVendorSpecificNativeInterface.getInstance(),
                            "mBluetoothHciVendorSpecificNativeInterface cannot be null");
            mBluetoothHciVendorSpecificNativeInterface.init(mBluetoothHciVendorSpecificDispatcher);
            mBluetoothHciVendorSpecificNativeInterface.init();
        }

        mSdpManager = new SdpManager(this, mLooper);
+6 −29
Original line number Diff line number Diff line
@@ -16,39 +16,16 @@

package com.android.bluetooth.btservice;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;

public class BluetoothHciVendorSpecificNativeInterface {
class BluetoothHciVendorSpecificNativeInterface {
    private static final String TAG = "BluetoothHciVendorSpecificNativeInterface";
    private final BluetoothHciVendorSpecificDispatcher mDispatcher;

    @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;
        }
    }

    /** Set singleton instance. */
    @VisibleForTesting
    static void setInstance(BluetoothHciVendorSpecificNativeInterface instance) {
        synchronized (INSTANCE_LOCK) {
            sInstance = instance;
        }
    public BluetoothHciVendorSpecificNativeInterface(
            BluetoothHciVendorSpecificDispatcher dispatcher) {
        mDispatcher = dispatcher;
    }

    private BluetoothHciVendorSpecificDispatcher mDispatcher;

    void init(BluetoothHciVendorSpecificDispatcher dispatcher) {
        mDispatcher = dispatcher;
    void init() {
        initNative();
    }

+0 −3
Original line number Diff line number Diff line
@@ -155,7 +155,6 @@ 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;
@@ -227,7 +226,6 @@ public class AdapterServiceTest {
        AdapterNativeInterface.setInstance(mNativeInterface);
        BluetoothKeystoreNativeInterface.setInstance(mKeystoreNativeInterface);
        BluetoothQualityReportNativeInterface.setInstance(mQualityNativeInterface);
        BluetoothHciVendorSpecificNativeInterface.setInstance(mHciVendorSpecificNativeInterface);
        SdpManagerNativeInterface.setInstance(mSdpNativeInterface);
        AdvertiseManagerNativeInterface.setInstance(mAdvertiseNativeInterface);
        DistanceMeasurementNativeInterface.setInstance(mDistanceNativeInterface);
@@ -356,7 +354,6 @@ public class AdapterServiceTest {
        AdapterNativeInterface.setInstance(null);
        BluetoothKeystoreNativeInterface.setInstance(null);
        BluetoothQualityReportNativeInterface.setInstance(null);
        BluetoothHciVendorSpecificNativeInterface.setInstance(null);
        SdpManagerNativeInterface.setInstance(null);
        AdvertiseManagerNativeInterface.setInstance(null);
        DistanceMeasurementNativeInterface.setInstance(null);