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

Commit 70575ab3 authored by David Duarte's avatar David Duarte
Browse files

ProfileService: Change `stop` return to void

The return of ProfileService#stop was only used to log an error.
And all stop implementation also log a line before returning false.

So the return is changed from boolean to void to be able to remove
all checks of ProfileService#stop's return value and simplify
the callers.

Bug: 319112725
Test: m Bluetooth BluetoothInstrumentationTests
Flag: Exempt, mechanical refactor
Change-Id: I6df7562859ced79db86d7900bd7499ca65165c22
parent 5687f159
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -207,11 +207,11 @@ public class A2dpService extends ProfileService {
    }

    @Override
    protected boolean stop() {
    protected void stop() {
        Log.i(TAG, "stop()");
        if (sA2dpService == null) {
            Log.w(TAG, "stop() called before start()");
            return true;
            return;
        }

        // Step 9: Clear active device and stop playing audio
@@ -258,8 +258,6 @@ public class A2dpService extends ProfileService {
        // Step 1: Clear AdapterService, AudioManager
        mAudioManager = null;
        mAdapterService = null;

        return true;
    }

    @Override
+1 −2
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ public class A2dpSinkService extends ProfileService {
    }

    @Override
    protected boolean stop() {
    protected void stop() {
        setA2dpSinkService(null);
        mNativeInterface.cleanup();
        for (A2dpSinkStateMachine stateMachine : mDeviceStateMap.values()) {
@@ -126,7 +126,6 @@ public class A2dpSinkService extends ProfileService {
                mA2dpSinkStreamHandler = null;
            }
        }
        return true;
    }

    public static synchronized A2dpSinkService getA2dpSinkService() {
+2 −3
Original line number Diff line number Diff line
@@ -244,12 +244,12 @@ public class AvrcpTargetService extends ProfileService {
    }

    @Override
    protected boolean stop() {
    protected void stop() {
        Log.i(TAG, "Stopping the AVRCP Target Service");

        if (sInstance == null) {
            Log.w(TAG, "stop() called before start()");
            return true;
            return;
        }

        if (mAvrcpCoverArtService != null) {
@@ -271,7 +271,6 @@ public class AvrcpTargetService extends ProfileService {
        mNativeInterface = null;
        mAudioManager = null;
        mReceiver = null;
        return true;
    }

    private void init() {
+1 −2
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ public class AvrcpControllerService extends ProfileService {
    }

    @Override
    protected synchronized boolean stop() {
    protected synchronized void stop() {
        setActiveDevice(null);
        Intent stopIntent = new Intent(this, BluetoothMediaBrowserService.class);
        stopService(stopIntent);
@@ -187,7 +187,6 @@ public class AvrcpControllerService extends ProfileService {
        }
        setComponentAvailable(ON_ERROR_SETTINGS_ACTIVITY, false);
        mNativeInterface.cleanup();
        return true;
    }

    public static AvrcpControllerService getAvrcpControllerService() {
+2 −4
Original line number Diff line number Diff line
@@ -102,13 +102,13 @@ public class BatteryService extends ProfileService {
    }

    @Override
    protected boolean stop() {
    protected void stop() {
        if (DBG) {
            Log.d(TAG, "stop()");
        }
        if (sBatteryService == null) {
            Log.w(TAG, "stop() called before start()");
            return true;
            return;
        }

        setBatteryService(null);
@@ -140,8 +140,6 @@ public class BatteryService extends ProfileService {
        }

        mAdapterService = null;

        return true;
    }

    @Override
Loading