summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Escande <wescande@google.com>2022-03-21 17:20:59 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-21 17:20:59 +0000
commit01a5b80bc351c06ffac9ad3a56ef59c4b39b565c (patch)
tree3a652ab64687949f3b0bca42ebd67f3ec95139fd
parentb32ce43b8b7e35ba50a8d34e3e439ba5726dccc4 (diff)
parentd10df2dcf7c2f3ae8db559961f78839ad8fcb8f0 (diff)
Merge "API Review: factoryReset->clearBluetooth" am: 85d45e8ee6 am: d10df2dcf7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2028171 Change-Id: Icc8872efa94ebbb55e3b672f8f1b9bc11aac57c0
-rw-r--r--android/blueberry/server/src/com/android/blueberry/Host.kt2
-rw-r--r--framework/api/system-current.txt2
-rw-r--r--framework/java/android/bluetooth/BluetoothAdapter.java18
3 files changed, 19 insertions, 3 deletions
diff --git a/android/blueberry/server/src/com/android/blueberry/Host.kt b/android/blueberry/server/src/com/android/blueberry/Host.kt
index 373cabbd20..433c75287c 100644
--- a/android/blueberry/server/src/com/android/blueberry/Host.kt
+++ b/android/blueberry/server/src/com/android/blueberry/Host.kt
@@ -76,7 +76,7 @@ class Host(private val context: Context, private val server: Server) : HostImplB
grpcUnary<Empty>(scope, responseObserver) {
Log.i(TAG, "reset")
- bluetoothAdapter.factoryReset()
+ bluetoothAdapter.clearBluetooth()
val stateFlow =
flow.filter { it.getAction() == BluetoothAdapter.ACTION_STATE_CHANGED }.map {
diff --git a/framework/api/system-current.txt b/framework/api/system-current.txt
index fbecf1fad7..282b7eed19 100644
--- a/framework/api/system-current.txt
+++ b/framework/api/system-current.txt
@@ -54,11 +54,11 @@ package android.bluetooth {
public final class BluetoothAdapter {
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean addOnMetadataChangedListener(@NonNull android.bluetooth.BluetoothDevice, @NonNull java.util.concurrent.Executor, @NonNull android.bluetooth.BluetoothAdapter.OnMetadataChangedListener);
+ method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean clearBluetooth();
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean disable(boolean);
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean disableBLE();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean enableBLE();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean enableNoAutoConnect();
- method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean factoryReset();
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public void generateLocalOobData(int, @NonNull java.util.concurrent.Executor, @NonNull android.bluetooth.BluetoothAdapter.OobDataCallback);
method @NonNull @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public java.util.List<android.bluetooth.BluetoothDevice> getActiveDevices(int);
method public int getConnectionState();
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java
index 2b03261cd6..aedd85d156 100644
--- a/framework/java/android/bluetooth/BluetoothAdapter.java
+++ b/framework/java/android/bluetooth/BluetoothAdapter.java
@@ -1412,7 +1412,7 @@ public final class BluetoothAdapter {
android.Manifest.permission.BLUETOOTH_CONNECT,
android.Manifest.permission.BLUETOOTH_PRIVILEGED,
})
- public boolean factoryReset() {
+ public boolean clearBluetooth() {
try {
mServiceLock.readLock().lock();
if (mService != null) {
@@ -1434,6 +1434,22 @@ public final class BluetoothAdapter {
return false;
}
+ /**
+ * See {@link #clearBluetooth()}
+ *
+ * @return true to indicate that the config file was successfully cleared
+ * @hide
+ */
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
+ @RequiresBluetoothConnectPermission
+ @RequiresPermission(allOf = {
+ android.Manifest.permission.BLUETOOTH_CONNECT,
+ android.Manifest.permission.BLUETOOTH_PRIVILEGED,
+ })
+ public boolean factoryReset() {
+ return clearBluetooth();
+ }
+
/**
* Get the UUIDs supported by the local Bluetooth adapter.
*