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

Commit 0141c8d8 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6176706 from 44fe7fcb3a3d1c53f42ecfa5ea7076c2558b38c4 to rvc-release

Change-Id: I95461f24c4e53a619afd043742e177d6082d2025
parents 4aa41500 884fee5e
Loading
Loading
Loading
Loading
+51 −4
Original line number Diff line number Diff line
@@ -1766,6 +1766,45 @@ public final class BluetoothAdapter {
    }

    /**
     * Removes the active device for the grouping of @ActiveDeviceUse specified
     *
     * @param profiles represents the purpose for which we are setting this as the active device.
     *                 Possible values are:
     *                 {@link BluetoothAdapter#ACTIVE_DEVICE_AUDIO},
     *                 {@link BluetoothAdapter#ACTIVE_DEVICE_PHONE_CALL},
     *                 {@link BluetoothAdapter#ACTIVE_DEVICE_ALL}
     * @return false on immediate error, true otherwise
     * @throws IllegalArgumentException if device is null or profiles is not one of
     * {@link ActiveDeviceUse}
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    public boolean removeActiveDevice(@ActiveDeviceUse int profiles) {
        if (profiles != ACTIVE_DEVICE_AUDIO && profiles != ACTIVE_DEVICE_PHONE_CALL
                && profiles != ACTIVE_DEVICE_ALL) {
            Log.e(TAG, "Invalid profiles param value in removeActiveDevice");
            throw new IllegalArgumentException("Profiles must be one of "
                    + "BluetoothAdapter.ACTIVE_DEVICE_AUDIO, "
                    + "BluetoothAdapter.ACTIVE_DEVICE_PHONE_CALL, or "
                    + "BluetoothAdapter.ACTIVE_DEVICE_ALL");
        }
        try {
            mServiceLock.readLock().lock();
            if (mService != null) {
                return mService.removeActiveDevice(profiles);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        } finally {
            mServiceLock.readLock().unlock();
        }

        return false;
    }

    /**
     * Sets device as the active devices for the profiles passed into the function
     *
     * @param device is the remote bluetooth device
     * @param profiles represents the purpose for which we are setting this as the active device.
@@ -1774,18 +1813,26 @@ public final class BluetoothAdapter {
     *                 {@link BluetoothAdapter#ACTIVE_DEVICE_PHONE_CALL},
     *                 {@link BluetoothAdapter#ACTIVE_DEVICE_ALL}
     * @return false on immediate error, true otherwise
     * @throws IllegalArgumentException if device is null or profiles is not one of
     * {@link ActiveDeviceUse}
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean setActiveDevice(@Nullable BluetoothDevice device,
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    public boolean setActiveDevice(@NonNull BluetoothDevice device,
            @ActiveDeviceUse int profiles) {
        if (device == null) {
            Log.e(TAG, "setActiveDevice: Null device passed as parameter");
            throw new IllegalArgumentException("device cannot be null");
        }
        if (profiles != ACTIVE_DEVICE_AUDIO && profiles != ACTIVE_DEVICE_PHONE_CALL
                && profiles != ACTIVE_DEVICE_ALL) {
            Log.e(TAG, "Invalid profiles param value in setActiveDevice");
            return false;
            throw new IllegalArgumentException("Profiles must be one of "
                    + "BluetoothAdapter.ACTIVE_DEVICE_AUDIO, "
                    + "BluetoothAdapter.ACTIVE_DEVICE_PHONE_CALL, or "
                    + "BluetoothAdapter.ACTIVE_DEVICE_ALL");
        }

        try {
            mServiceLock.readLock().lock();
            if (mService != null) {
+4 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
@@ -179,9 +180,10 @@ public final class BluetoothDevice implements Parcelable {
     * <p>Always contains the extra field {@link #EXTRA_DEVICE}.
     * <p>Requires {@link android.Manifest.permission#BLUETOOTH} to receive.
     */
    @SuppressLint("ActionValue")
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_ALIAS_CHANGED =
            "android.bluetooth.action.ALIAS_CHANGED";
            "android.bluetooth.device.action.ALIAS_CHANGED";

    /**
     * Broadcast Action: Indicates a change in the bond state of a remote
@@ -1091,7 +1093,7 @@ public final class BluetoothDevice implements Parcelable {
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
    public boolean setAlias(@NonNull String alias) {
        final IBluetooth service = sService;
        if (service == null) {