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

Commit cd29fbf8 authored by Sanket Agarwal's avatar Sanket Agarwal
Browse files

Unset the priorities for car profiles on unpair.

When the device is unpaired the priorities should not be retained since
on the next pairing we will persist priorities if they are anything
other than UNDEFINED.

Bug: b/31021525

Change-Id: Ifd7dbf93aff3abcd0f6207395fbac90480624415
(cherry picked from commit 5312f3c9017634ed596a941fc375a6f70ed3aa13)
parent afed03a3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -129,6 +129,10 @@ public class A2dpSinkService extends ProfileService {
            return false;
        }

        if (getPriority(device) == BluetoothProfile.PRIORITY_OFF) {
            return false;
        }

        mStateMachine.sendMessage(A2dpSinkStateMachine.CONNECT, device);
        return true;
    }
+17 −5
Original line number Diff line number Diff line
@@ -23,6 +23,9 @@ import android.bluetooth.BluetoothDevice;
import com.android.bluetooth.a2dp.A2dpService;
import com.android.bluetooth.hid.HidService;
import com.android.bluetooth.hfp.HeadsetService;
import com.android.bluetooth.a2dpsink.A2dpSinkService;
import com.android.bluetooth.hfpclient.HeadsetClientService;
import com.android.bluetooth.pbapclient.PbapClientService;

import android.bluetooth.OobData;
import android.content.Intent;
@@ -445,6 +448,9 @@ final class BondStateMachine extends StateMachine {
        HidService hidService = HidService.getHidService();
        A2dpService a2dpService = A2dpService.getA2dpService();
        HeadsetService headsetService = HeadsetService.getHeadsetService();
        HeadsetClientService headsetClientService = HeadsetClientService.getHeadsetClientService();
        A2dpSinkService a2dpSinkService = A2dpSinkService.getA2dpSinkService();
        PbapClientService pbapClientService = PbapClientService.getPbapClientService();

        if (hidService != null)
            hidService.setPriority(device, BluetoothProfile.PRIORITY_UNDEFINED);
@@ -452,6 +458,12 @@ final class BondStateMachine extends StateMachine {
            a2dpService.setPriority(device, BluetoothProfile.PRIORITY_UNDEFINED);
        if (headsetService != null)
            headsetService.setPriority(device, BluetoothProfile.PRIORITY_UNDEFINED);
        if (headsetClientService != null)
            headsetClientService.setPriority(device, BluetoothProfile.PRIORITY_UNDEFINED);
        if (a2dpSinkService != null)
            a2dpSinkService.setPriority(device, BluetoothProfile.PRIORITY_UNDEFINED);
        if (pbapClientService != null)
            pbapClientService.setPriority(device, BluetoothProfile.PRIORITY_UNDEFINED);

        // Clear Absolute Volume black list
        if(a2dpService != null)