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

Commit 9056c358 authored by William Escande's avatar William Escande
Browse files

AdapterService: Remove unused local metric logger

Bug: 311772251
Flag: Exempt, dead code
Test: atest AdapterService*Test
Change-Id: Iffd988abfd4dfcd52e971007b2a6a829026651d3
parent b9592c3f
Loading
Loading
Loading
Loading
+0 −26
Original line number Diff line number Diff line
@@ -318,8 +318,6 @@ public class AdapterService extends Service {

    private volatile boolean mTestModeEnabled = false;

    private MetricsLogger mMetricsLogger;

    /** Handlers for incoming service calls */
    private AdapterServiceBinder mBinder;

@@ -638,7 +636,6 @@ public class AdapterService extends Service {
    private void init() {
        Log.d(TAG, "init()");
        Config.init(this);
        initMetricsLogger();
        mDeviceConfigListener.start();

        if (!Flags.fastBindToApp()) {
@@ -809,23 +806,6 @@ public class AdapterService extends Service {
        return mSilenceDeviceManager;
    }

    private boolean initMetricsLogger() {
        if (mMetricsLogger != null) {
            return false;
        }
        mMetricsLogger = MetricsLogger.getInstance();
        return mMetricsLogger.init(this);
    }

    private boolean closeMetricsLogger() {
        if (mMetricsLogger == null) {
            return false;
        }
        boolean result = mMetricsLogger.close();
        mMetricsLogger = null;
        return result;
    }

    /**
     * Log L2CAP CoC Server Connection Metrics
     *
@@ -878,10 +858,6 @@ public class AdapterService extends Service {
                socketAcceptanceLatencyMillis);
    }

    public void setMetricsLogger(MetricsLogger metricsLogger) {
        mMetricsLogger = metricsLogger;
    }

    /**
     * Log L2CAP CoC Client Connection Metrics
     *
@@ -1345,8 +1321,6 @@ public class AdapterService extends Service {
            return;
        }

        closeMetricsLogger();

        clearAdapterService(this);

        mCleaningUp = true;
+0 −6
Original line number Diff line number Diff line
@@ -90,7 +90,6 @@ public class AdapterServiceRestartTest {
    private @Mock IBluetoothCallback mIBluetoothCallback;
    private @Mock Binder mBinder;
    private @Mock android.app.Application mApplication;
    private @Mock MetricsLogger mMockMetricsLogger;
    private @Mock AdapterNativeInterface mNativeInterface;
    private @Mock BluetoothKeystoreNativeInterface mKeystoreNativeInterface;
    private @Mock BluetoothQualityReportNativeInterface mQualityNativeInterface;
@@ -224,14 +223,9 @@ public class AdapterServiceRestartTest {
        doReturn(Process.BLUETOOTH_UID).when(mMockPackageManager)
                .getPackageUidAsUser(any(), anyInt(), anyInt());

        when(mMockMetricsLogger.init(any())).thenReturn(true);
        when(mMockMetricsLogger.close()).thenReturn(true);

        AdapterServiceTest.configureEnabledProfiles();
        Config.init(mMockContext);

        mAdapterService.setMetricsLogger(mMockMetricsLogger);

        // Attach a context to the service for permission checks.
        mAdapterService.attach(mMockContext, null, null, null, mApplication, null);
        mAdapterService.onCreate();
+0 −6
Original line number Diff line number Diff line
@@ -143,7 +143,6 @@ public class AdapterServiceTest {
    private @Mock IBluetoothCallback mIBluetoothCallback;
    private @Mock Binder mBinder;
    private @Mock android.app.Application mApplication;
    private @Mock MetricsLogger mMockMetricsLogger;
    private @Mock AdapterNativeInterface mNativeInterface;
    private @Mock BluetoothKeystoreNativeInterface mKeystoreNativeInterface;
    private @Mock BluetoothQualityReportNativeInterface mQualityNativeInterface;
@@ -312,14 +311,9 @@ public class AdapterServiceTest {
        when(mMockService.getName()).thenReturn("Service1");
        when(mMockService2.getName()).thenReturn("Service2");

        when(mMockMetricsLogger.init(any())).thenReturn(true);
        when(mMockMetricsLogger.close()).thenReturn(true);

        configureEnabledProfiles();
        Config.init(mMockContext);

        mAdapterService.setMetricsLogger(mMockMetricsLogger);

        // Attach a context to the service for permission checks.
        mAdapterService.attach(mMockContext, null, null, null, mApplication, null);
        mAdapterService.onCreate();