OSDN Git Service

Implement Bluetooth settings factory reset (2/5)
authorAjay Panicker <apanicke@google.com>
Tue, 28 Jul 2015 23:52:09 +0000 (16:52 -0700)
committerAjay Panicker <apanicke@google.com>
Wed, 5 Aug 2015 17:35:15 +0000 (10:35 -0700)
Implemented the factory reset function to be used to reset all bluetooth
settings on device to factory default

Bug: 16161518

core/java/android/bluetooth/BluetoothAdapter.java
core/java/android/bluetooth/IBluetooth.aidl

index 97afafa..1f3ff51 100644 (file)
@@ -1002,6 +1002,25 @@ public final class BluetoothAdapter {
     }
 
     /**
+     * Factory reset bluetooth settings.
+     *
+     * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}
+     * permission
+     *
+     * @return true to indicate that the config file was successfully cleared
+     *
+     * @hide
+     */
+    public boolean factoryReset() {
+        try {
+            if (mService != null) {
+                return mService.factoryReset();
+            }
+        } catch (RemoteException e) {Log.e(TAG, "", e);}
+        return false;
+    }
+
+    /**
      * Get the UUIDs supported by the local Bluetooth adapter.
      *
      * <p>Requires {@link android.Manifest.permission#BLUETOOTH}
index 7a894ae..66f3418 100644 (file)
@@ -92,6 +92,7 @@ interface IBluetooth
     ParcelFileDescriptor createSocketChannel(int type, in String serviceName, in ParcelUuid uuid, int port, int flag);
 
     boolean configHciSnoopLog(boolean enable);
+    boolean factoryReset();
 
     boolean isMultiAdvertisementSupported();
     boolean isPeripheralModeSupported();