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

Commit d44309e8 authored by tim peng's avatar tim peng Committed by Automerger Merge Worker
Browse files

Merge "Switch the audio path from the settings during the call, and the music...

Merge "Switch the audio path from the settings during the call, and the music will be transferred to the DUT at the end of the call" into sc-v2-dev am: 4cf0808c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16212299

Change-Id: I7fbc6c7ec6abe56ea4e84685ffd8a454a627acbb
parents bb7f681d 4cf0808c
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -16,7 +16,8 @@

package com.android.settingslib.bluetooth;

import static android.bluetooth.BluetoothAdapter.ACTIVE_DEVICE_ALL;
import static android.bluetooth.BluetoothAdapter.ACTIVE_DEVICE_AUDIO;
import static android.bluetooth.BluetoothAdapter.ACTIVE_DEVICE_PHONE_CALL;
import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED;
import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;

@@ -29,6 +30,7 @@ import android.content.Context;
import android.util.Log;

import com.android.settingslib.R;
import com.android.settingslib.Utils;

import java.util.ArrayList;
import java.util.List;
@@ -162,9 +164,12 @@ public class HearingAidProfile implements LocalBluetoothProfile {
        if (mBluetoothAdapter == null) {
            return false;
        }
        int profiles = Utils.isAudioModeOngoingCall(mContext)
                ? ACTIVE_DEVICE_PHONE_CALL
                : ACTIVE_DEVICE_AUDIO;
        return device == null
                ? mBluetoothAdapter.removeActiveDevice(ACTIVE_DEVICE_ALL)
                : mBluetoothAdapter.setActiveDevice(device, ACTIVE_DEVICE_ALL);
                ? mBluetoothAdapter.removeActiveDevice(profiles)
                : mBluetoothAdapter.setActiveDevice(device, profiles);
    }

    public List<BluetoothDevice> getActiveDevices() {