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

Commit f0fb7365 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov Committed by android-build-merger
Browse files

Merge "Add a missing null check inside A2dpService.resetAvrcpBlacklist()" am: 855104ed

am: c9dfd167

* commit 'c9dfd167':
  Add a missing null check inside A2dpService.resetAvrcpBlacklist()

Change-Id: I7cd2bada2064d23984b7986efb0288b10e6879c8
parents 10311829 c9dfd167
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -547,7 +547,7 @@ static void cleanupNative(JNIEnv *env, jobject object) {
    }
    }


    if (sCallbacksObj != NULL) {
    if (sCallbacksObj != NULL) {
        ALOGW("Cleaning up Bluetooth Health object");
        ALOGW("Cleaning up Bluetooth SDP object");
        env->DeleteGlobalRef(sCallbacksObj);
        env->DeleteGlobalRef(sCallbacksObj);
        sCallbacksObj = NULL;
        sCallbacksObj = NULL;
    }
    }
+3 −1
Original line number Original line Diff line number Diff line
@@ -214,8 +214,10 @@ public class A2dpService extends ProfileService {
    }
    }


    public void resetAvrcpBlacklist(BluetoothDevice device) {
    public void resetAvrcpBlacklist(BluetoothDevice device) {
        if (mAvrcp != null) {
            mAvrcp.resetBlackList(device.getAddress());
            mAvrcp.resetBlackList(device.getAddress());
        }
        }
    }


    synchronized boolean isA2dpPlaying(BluetoothDevice device) {
    synchronized boolean isA2dpPlaying(BluetoothDevice device) {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM,
        enforceCallingOrSelfPermission(BLUETOOTH_PERM,
+2 −31
Original line number Original line Diff line number Diff line
@@ -216,15 +216,7 @@ final class BondStateMachine extends StateMachine {
                            mAdapterService.setSimAccessPermission(dev,
                            mAdapterService.setSimAccessPermission(dev,
                                    BluetoothDevice.ACCESS_UNKNOWN);
                                    BluetoothDevice.ACCESS_UNKNOWN);
                            // Set the profile Priorities to undefined
                            // Set the profile Priorities to undefined
                            clearProfilePriorty(dev);
                            clearProfilePriority(dev);
                        }
                        else if (newState == BluetoothDevice.BOND_BONDED)
                        {
                           // Do not set profile priority
                           // Profile priority should be set after SDP completion

                           // Restore the profile priorty settings
                           //setProfilePriorty(dev);
                        }
                        }
                    }
                    }
                    else if(!mDevices.contains(dev))
                    else if(!mDevices.contains(dev))
@@ -450,28 +442,7 @@ final class BondStateMachine extends StateMachine {
        sendMessage(msg);
        sendMessage(msg);
    }
    }


    private void setProfilePriorty (BluetoothDevice device){
    private void clearProfilePriority(BluetoothDevice device) {
        HidService hidService = HidService.getHidService();
        A2dpService a2dpService = A2dpService.getA2dpService();
        HeadsetService headsetService = HeadsetService.getHeadsetService();

        if ((hidService != null) &&
            (hidService.getPriority(device) == BluetoothProfile.PRIORITY_UNDEFINED)){
            hidService.setPriority(device,BluetoothProfile.PRIORITY_ON);
        }

        if ((a2dpService != null) &&
            (a2dpService.getPriority(device) == BluetoothProfile.PRIORITY_UNDEFINED)){
            a2dpService.setPriority(device,BluetoothProfile.PRIORITY_ON);
        }

        if ((headsetService != null) &&
            (headsetService.getPriority(device) == BluetoothProfile.PRIORITY_UNDEFINED)){
            headsetService.setPriority(device,BluetoothProfile.PRIORITY_ON);
        }
    }

    private void clearProfilePriorty (BluetoothDevice device){
        HidService hidService = HidService.getHidService();
        HidService hidService = HidService.getHidService();
        A2dpService a2dpService = A2dpService.getA2dpService();
        A2dpService a2dpService = A2dpService.getA2dpService();
        HeadsetService headsetService = HeadsetService.getHeadsetService();
        HeadsetService headsetService = HeadsetService.getHeadsetService();