Loading android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -1123,6 +1123,13 @@ static void dumpNative(JNIEnv *env, jobject obj, jobject fdObj) sBluetoothInterface->dump(fd); } static jboolean factoryResetNative(JNIEnv *env, jobject obj) { ALOGV("%s:", __FUNCTION__); if (!sBluetoothInterface) return JNI_FALSE; int ret = sBluetoothInterface->config_clear(); return (ret == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; } static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"classInitNative", "()V", (void *) classInitNative}, Loading Loading @@ -1151,6 +1158,7 @@ static JNINativeMethod sMethods[] = { {"alarmFiredNative", "()V", (void *) alarmFiredNative}, {"readEnergyInfo", "()I", (void*) readEnergyInfo}, {"dumpNative", "(Ljava/io/FileDescriptor;)V", (void*) dumpNative}, {"factoryResetNative", "()Z", (void*)factoryResetNative} }; int register_com_android_bluetooth_btservice_AdapterService(JNIEnv* env) Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +14 −0 Original line number Diff line number Diff line Loading @@ -1212,6 +1212,14 @@ public class AdapterService extends Service { return service.configHciSnoopLog(enable); } public boolean factoryReset() { AdapterService service = getService(); if (service == null) return false; service.disable(); return service.factoryReset(); } public void registerCallback(IBluetoothCallback cb) { AdapterService service = getService(); if (service == null) return ; Loading Loading @@ -1821,6 +1829,11 @@ public class AdapterService extends Service { return configHciSnoopLogNative(enable); } boolean factoryReset() { enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, "Need BLUETOOTH permission"); return factoryResetNative(); } void registerCallback(IBluetoothCallback cb) { mCallbacks.register(cb); } Loading Loading @@ -2121,6 +2134,7 @@ public class AdapterService extends Service { byte[] uuid, int port, int flag); /*package*/ native boolean configHciSnoopLogNative(boolean enable); /*package*/ native boolean factoryResetNative(); private native void alarmFiredNative(); private native void dumpNative(FileDescriptor fd); Loading Loading
android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -1123,6 +1123,13 @@ static void dumpNative(JNIEnv *env, jobject obj, jobject fdObj) sBluetoothInterface->dump(fd); } static jboolean factoryResetNative(JNIEnv *env, jobject obj) { ALOGV("%s:", __FUNCTION__); if (!sBluetoothInterface) return JNI_FALSE; int ret = sBluetoothInterface->config_clear(); return (ret == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; } static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"classInitNative", "()V", (void *) classInitNative}, Loading Loading @@ -1151,6 +1158,7 @@ static JNINativeMethod sMethods[] = { {"alarmFiredNative", "()V", (void *) alarmFiredNative}, {"readEnergyInfo", "()I", (void*) readEnergyInfo}, {"dumpNative", "(Ljava/io/FileDescriptor;)V", (void*) dumpNative}, {"factoryResetNative", "()Z", (void*)factoryResetNative} }; int register_com_android_bluetooth_btservice_AdapterService(JNIEnv* env) Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +14 −0 Original line number Diff line number Diff line Loading @@ -1212,6 +1212,14 @@ public class AdapterService extends Service { return service.configHciSnoopLog(enable); } public boolean factoryReset() { AdapterService service = getService(); if (service == null) return false; service.disable(); return service.factoryReset(); } public void registerCallback(IBluetoothCallback cb) { AdapterService service = getService(); if (service == null) return ; Loading Loading @@ -1821,6 +1829,11 @@ public class AdapterService extends Service { return configHciSnoopLogNative(enable); } boolean factoryReset() { enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, "Need BLUETOOTH permission"); return factoryResetNative(); } void registerCallback(IBluetoothCallback cb) { mCallbacks.register(cb); } Loading Loading @@ -2121,6 +2134,7 @@ public class AdapterService extends Service { byte[] uuid, int port, int flag); /*package*/ native boolean configHciSnoopLogNative(boolean enable); /*package*/ native boolean factoryResetNative(); private native void alarmFiredNative(); private native void dumpNative(FileDescriptor fd); Loading