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

Commit 60decee6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Introduce public APIs to check whether a remote bluetooth headset...

Merge "Introduce public APIs to check whether a remote bluetooth headset supports voice recognition as well as echo cancellation and/or noise reduction via the AT+BRSF bitmask" am: 1fb77703 am: e429dd34 am: f791c034

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie4fafafa85b429baeb79ecd69a345f599a2d6b01
parents 85191e98 f791c034
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -8977,6 +8977,8 @@ package android.bluetooth {
    method public int getConnectionState(android.bluetooth.BluetoothDevice);
    method public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int[]);
    method public boolean isAudioConnected(android.bluetooth.BluetoothDevice);
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean isNoiseReductionSupported(@NonNull android.bluetooth.BluetoothDevice);
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean isVoiceRecognitionSupported(@NonNull android.bluetooth.BluetoothDevice);
    method public boolean sendVendorSpecificResultCode(android.bluetooth.BluetoothDevice, String, String);
    method public boolean startVoiceRecognition(android.bluetooth.BluetoothDevice);
    method public boolean stopVoiceRecognition(android.bluetooth.BluetoothDevice);
+42 −0
Original line number Diff line number Diff line
@@ -681,6 +681,48 @@ public final class BluetoothHeadset implements BluetoothProfile {
        return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
    }

    /**
     * Checks whether the headset supports some form of noise reduction
     *
     * @param device Bluetooth device
     * @return true if echo cancellation and/or noise reduction is supported, false otherwise
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public boolean isNoiseReductionSupported(@NonNull BluetoothDevice device) {
        if (DBG) log("isNoiseReductionSupported()");
        final IBluetoothHeadset service = mService;
        if (service != null && isEnabled() && isValidDevice(device)) {
            try {
                return service.isNoiseReductionSupported(device);
            } catch (RemoteException e) {
                Log.e(TAG, Log.getStackTraceString(new Throwable()));
            }
        }
        if (service == null) Log.w(TAG, "Proxy not attached to service");
        return false;
    }

    /**
     * Checks whether the headset supports voice recognition
     *
     * @param device Bluetooth device
     * @return true if voice recognition is supported, false otherwise
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public boolean isVoiceRecognitionSupported(@NonNull BluetoothDevice device) {
        if (DBG) log("isVoiceRecognitionSupported()");
        final IBluetoothHeadset service = mService;
        if (service != null && isEnabled() && isValidDevice(device)) {
            try {
                return service.isVoiceRecognitionSupported(device);
            } catch (RemoteException e) {
                Log.e(TAG, Log.getStackTraceString(new Throwable()));
            }
        }
        if (service == null) Log.w(TAG, "Proxy not attached to service");
        return false;
    }

    /**
     * Start Bluetooth voice recognition. This methods sends the voice
     * recognition AT command to the headset and establishes the