diff options
| -rw-r--r-- | core/api/current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/bluetooth/BluetoothHeadset.java | 42 |
2 files changed, 44 insertions, 0 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 2e821b3080af..9f497932ed1a 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -8909,6 +8909,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); diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java index 57d1411aa68a..41610963c047 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. |