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

Commit 0d12e935 authored by William Escande's avatar William Escande
Browse files

API Review: factoryReset->clearBluetooth

> Consider renaming the factoryReset method to “clearBluetooth”.

Bug: 222725037
Test: TH
Tag; #refactor
Change-Id: Idb86dc5b57b2482401f563daf71eef37610d3f0a
parent cc894359
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
@@ -1405,7 +1405,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) {
@@ -1427,6 +1427,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.
     *