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

Commit 7ba1bfbe authored by David Duarte's avatar David Duarte
Browse files

{AvrcpTarget,HeadsetClient}Service: Throw Exception on double start

This aligns the behavior with other services that checks for
double starts like: A2dpService, HeadsetService, LeAudioService,
BatteryService, HearingAidService, ...

This is done to remove the boolean return of the start method
in a child change.

This has a potential to create a regression, but is unlikely
as those profiles are started similarly than other profiles
containing the same check.

Bug: 319112725
Test: m Bluetooth
Flag: Exempt, Accelerate release of this change to be able to
  perform a mechanical refactor on top of it.
Change-Id: I0b611622525f7a741d0962b1d1a827bd56ba1a3f
parent ba0f4ca5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -190,8 +190,7 @@ public class AvrcpTargetService extends ProfileService {
    @Override
    protected boolean start() {
        if (sInstance != null) {
            Log.wtf(TAG, "The service has already been initialized");
            return false;
            throw new IllegalStateException("start() called twice");
        }

        IntentFilter userFilter = new IntentFilter();
+1 −2
Original line number Diff line number Diff line
@@ -107,8 +107,7 @@ public class HeadsetClientService extends ProfileService {
                Log.d(TAG, "start()");
            }
            if (getHeadsetClientService() != null) {
                Log.w(TAG, "start(): start called without stop");
                return false;
                throw new IllegalStateException("start() called twice");
            }

            mDatabaseManager = Objects.requireNonNull(