Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d10df2dc authored by William Escande's avatar William Escande Committed by Automerger Merge Worker
Browse files

Merge "API Review: factoryReset->clearBluetooth" am: 85d45e8e

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2028171

Change-Id: I41efc9c82c74ece8dfbcdba41b7350b9d519bea4
parents eda65c7a 85d45e8e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 {
+1 −1
Original line number Diff line number Diff line
@@ -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();
+17 −1
Original line number Diff line number Diff line
@@ -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.
     *