From cda6e878cd1b11e10c0b9b4b903b14e11586a963 Mon Sep 17 00:00:00 2001 From: Ajay Panicker Date: Tue, 28 Jul 2015 16:52:09 -0700 Subject: [PATCH] Implement Bluetooth settings factory reset (2/5) 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 | 19 +++++++++++++++++++ core/java/android/bluetooth/IBluetooth.aidl | 1 + 2 files changed, 20 insertions(+) diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 97afafa4c8b7..1f3ff5148716 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -1002,6 +1002,25 @@ public final class BluetoothAdapter { } /** + * Factory reset bluetooth settings. + * + *

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. * *

Requires {@link android.Manifest.permission#BLUETOOTH} diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl index 7a894ae67aff..66f3418c620f 100644 --- a/core/java/android/bluetooth/IBluetooth.aidl +++ b/core/java/android/bluetooth/IBluetooth.aidl @@ -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(); -- 2.11.0