diff options
-rw-r--r-- | android/blueberry/server/src/com/android/blueberry/Host.kt | 2 | ||||
-rw-r--r-- | framework/api/system-current.txt | 2 | ||||
-rw-r--r-- | framework/java/android/bluetooth/BluetoothAdapter.java | 18 |
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 aa75707efc..020955f866 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 84eddad0f9..8481601ba9 100644 --- a/framework/java/android/bluetooth/BluetoothAdapter.java +++ b/framework/java/android/bluetooth/BluetoothAdapter.java @@ -1518,7 +1518,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) { @@ -1540,6 +1540,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. * |