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

Commit db879f13 authored by Aritra Sen's avatar Aritra Sen
Browse files

Cache the current A2dpService and null check for the same to avoid crashes.

Bug: 323957915
Fix: 323957915
Test: m .
Flag: EXEMPT Adding simple nullptr check
Change-Id: Ic401b5a55c218425bc8716fb83a1e226ff1fb3f7
parent a8850892
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -1367,12 +1367,15 @@ public class A2dpService extends ProfileService {
            if (Utils.isInstrumentationTestMode()) {
                return mService;
            }
            if (!Utils.checkServiceAvailable(mService, TAG)
                    || !Utils.checkCallerIsSystemOrActiveOrManagedUser(mService, TAG)
                    || !Utils.checkConnectPermissionForDataDelivery(mService, source, TAG)) {
            A2dpService currService = mService;

            if (currService == null
                    || !Utils.checkServiceAvailable(currService, TAG)
                    || !Utils.checkCallerIsSystemOrActiveOrManagedUser(currService, TAG)
                    || !Utils.checkConnectPermissionForDataDelivery(currService, source, TAG)) {
                return null;
            }
            return mService;
            return currService;
        }

        BluetoothA2dpBinder(A2dpService svc) {