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

Commit d6799723 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Validate profile is enabled if setting device as active for it"

parents 1fce8e20 808afe34
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -2309,16 +2309,21 @@ public class AdapterService extends Service {
                return false;
        }

        if (setA2dp && mA2dpService != null) {
        if (setA2dp && mA2dpService != null && mA2dpService.getConnectionPolicy(device)
                == BluetoothProfile.CONNECTION_POLICY_ALLOWED) {
            Log.i(TAG, "setActiveDevice: Setting active A2dp device " + device.getAddress());
            mA2dpService.setActiveDevice(device);
        }

        // Always sets as active device for hearing aid profile
        if (mHearingAidService != null) {
        if (mHearingAidService != null && mHearingAidService.getConnectionPolicy(device)
                == BluetoothProfile.CONNECTION_POLICY_ALLOWED) {
            Log.i(TAG, "setActiveDevice: Setting active Hearing Aid " + device.getAddress());
            mHearingAidService.setActiveDevice(device);
        }

        if (setHeadset && mHeadsetService != null) {
        if (setHeadset && mHeadsetService != null && mHeadsetService.getConnectionPolicy(device)
                == BluetoothProfile.CONNECTION_POLICY_ALLOWED) {
            Log.i(TAG, "setActiveDevice: Setting active Headset " + device.getAddress());
            mHeadsetService.setActiveDevice(device);
        }