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

Commit e04bf5c1 authored by William Escande's avatar William Escande
Browse files

Test health: Allow test to call doStart and doStop

Bug: 295237486
Test: atest BluetoothInstrumentationTest
Change-Id: If48808ee3d1e77ab2e68913136aadf67bd085a5f
parent bed99db5
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.os.IBinder;
import android.util.Log;

import com.android.bluetooth.BluetoothMetricsProto;
import com.android.internal.annotations.VisibleForTesting;

/**
 * Base class for a background service that runs a Bluetooth profile
@@ -297,12 +298,14 @@ public abstract class ProfileService extends Service {
        super.onDestroy();
    }

    /** start the profile and inform AdapterService */
    @RequiresPermission(
            anyOf = {
                android.Manifest.permission.MANAGE_USERS,
                android.Manifest.permission.INTERACT_ACROSS_USERS
            })
    void doStart() {
    @VisibleForTesting
    public void doStart() {
        Log.v(mName, "doStart");
        if (mAdapter == null) {
            Log.w(mName, "Can't start profile service: device does not have BT");
@@ -328,7 +331,9 @@ public abstract class ProfileService extends Service {
        mAdapterService.onProfileServiceStateChanged(this, BluetoothAdapter.STATE_ON);
    }

    void doStop() {
    /** stop the profile and inform AdapterService */
    @VisibleForTesting
    public void doStop() {
        Log.v(mName, "doStop");
        if (mAdapterService == null || mAdapterService.isStartedProfile(mName)) {
            Log.w(mName, "Unexpectedly do Stop, don't stop.");