summaryrefslogtreecommitdiff
path: root/core/java/android/bluetooth/BluetoothHeadset.java
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2021-01-07 17:55:04 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-01-07 17:55:04 +0000
commit1fb77703811707fe94d652968dfd1ad7fccd4b48 (patch)
treea4ef278f5cb7849330523a566acbb4535a1758e4 /core/java/android/bluetooth/BluetoothHeadset.java
parent5a5613209d4ccdbd138779ad700873b688b66410 (diff)
parent2b2f76b7bb1c7cb45374e904de0ba76d4f9b1a20 (diff)
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"
Diffstat (limited to 'core/java/android/bluetooth/BluetoothHeadset.java')
-rw-r--r--core/java/android/bluetooth/BluetoothHeadset.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java
index adb7e2f773a9..f59ae338ee2f 100644
--- a/core/java/android/bluetooth/BluetoothHeadset.java
+++ b/core/java/android/bluetooth/BluetoothHeadset.java
@@ -682,6 +682,48 @@ public final class BluetoothHeadset implements BluetoothProfile {
}
/**
+ * 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
* audio connection.