From 943ac64f973dd963b153af880ae6d0aa09ffa972 Mon Sep 17 00:00:00 2001 From: Roopa Sattiraju Date: Fri, 20 Aug 2021 15:06:57 -0700 Subject: [PATCH] Changing BluetoothHeadset APIs from @hide to @SystemApi For isInbandringing API - it is used in the call journey and would change the behavior(undeterministic) of the call if not used. Stop/StartScoUsingVirtualVoiceCall is used in the BluetoothShim layer specifically for testing and mocking in the Android Apps. Seems reasonable to keep this as a SystemAPI given that it has no params and unlikely to be changed. Bug: 195160939 Tag: #feature Test: Manual Merged-In: I02b2e7e5e0be3b462f7c25b655e669e2c7fe47eb Change-Id: I02b2e7e5e0be3b462f7c25b655e669e2c7fe47eb --- core/api/system-current.txt | 3 +++ core/java/android/bluetooth/BluetoothHeadset.java | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index aa528ba007263..41e655bb366cc 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -1559,7 +1559,10 @@ package android.bluetooth { method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean connect(android.bluetooth.BluetoothDevice); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean disconnect(android.bluetooth.BluetoothDevice); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public int getConnectionPolicy(@NonNull android.bluetooth.BluetoothDevice); + method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean isInbandRingingEnabled(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean setConnectionPolicy(@NonNull android.bluetooth.BluetoothDevice, int); + method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean startScoUsingVirtualVoiceCall(); + method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean stopScoUsingVirtualVoiceCall(); } public final class BluetoothHearingAid implements android.bluetooth.BluetoothProfile { diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java index 632572dea3c60..18aa23a07b87c 100644 --- a/core/java/android/bluetooth/BluetoothHeadset.java +++ b/core/java/android/bluetooth/BluetoothHeadset.java @@ -1018,8 +1018,8 @@ public final class BluetoothHeadset implements BluetoothProfile { * - binder is dead or Bluetooth is disabled or other error * @hide */ + @SystemApi @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) - @UnsupportedAppUsage public boolean startScoUsingVirtualVoiceCall() { if (DBG) log("startScoUsingVirtualVoiceCall()"); final IBluetoothHeadset service = mService; @@ -1048,8 +1048,8 @@ public final class BluetoothHeadset implements BluetoothProfile { * - binder is dead or Bluetooth is disabled or other error * @hide */ + @SystemApi @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) - @UnsupportedAppUsage public boolean stopScoUsingVirtualVoiceCall() { if (DBG) log("stopScoUsingVirtualVoiceCall()"); final IBluetoothHeadset service = mService; @@ -1227,7 +1227,8 @@ public final class BluetoothHeadset implements BluetoothProfile { * @return true if in-band ringing is enabled, false if in-band ringing is disabled * @hide */ - @RequiresPermission(android.Manifest.permission.BLUETOOTH) + @SystemApi + @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean isInbandRingingEnabled() { if (DBG) { log("isInbandRingingEnabled()");