Loading android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +16 −1 Original line number Diff line number Diff line Loading @@ -904,6 +904,20 @@ Fail: return -1; } static jboolean configHciSnoopLogNative(JNIEnv* env, jobject obj, jboolean enable) { ALOGV("%s:",__FUNCTION__); jboolean result = JNI_FALSE; if (!sBluetoothInterface) return result; int ret = sBluetoothInterface->config_hci_snoop_log(enable); result = (ret == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; return result; } static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"classInitNative", "()V", (void *) classInitNative}, Loading @@ -926,7 +940,8 @@ static JNINativeMethod sMethods[] = { {"getRemoteServicesNative", "([B)Z", (void*) getRemoteServicesNative}, {"connectSocketNative", "([BI[BII)I", (void*) connectSocketNative}, {"createSocketChannelNative", "(ILjava/lang/String;[BII)I", (void*) createSocketChannelNative} (void*) createSocketChannelNative}, {"configHciSnoopLogNative", "(Z)Z", (void*) configHciSnoopLogNative} }; int register_com_android_bluetooth_btservice_AdapterService(JNIEnv* env) Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +19 −0 Original line number Diff line number Diff line Loading @@ -872,6 +872,18 @@ public class AdapterService extends Service { return service.createSocketChannel(type, serviceName, uuid, port, flag); } public boolean configHciSnoopLog(boolean enable) { if ((Binder.getCallingUid() != Process.SYSTEM_UID) && (!Utils.checkCaller())) { Log.w(TAG,"configHciSnoopLog(): not allowed for non-active user"); return false; } AdapterService service = getService(); if (service == null) return false; return service.configHciSnoopLog(enable); } public void registerCallback(IBluetoothCallback cb) { AdapterService service = getService(); if (service == null) return ; Loading Loading @@ -1322,6 +1334,11 @@ public class AdapterService extends Service { return ParcelFileDescriptor.adoptFd(fd); } boolean configHciSnoopLog(boolean enable) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return configHciSnoopLogNative(enable); } void registerCallback(IBluetoothCallback cb) { mCallbacks.register(cb); } Loading Loading @@ -1396,6 +1413,8 @@ public class AdapterService extends Service { private native int createSocketChannelNative(int type, String serviceName, byte[] uuid, int port, int flag); /*package*/ native boolean configHciSnoopLogNative(boolean enable); protected void finalize() { cleanup(); if (TRACE_REF) { Loading Loading
android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +16 −1 Original line number Diff line number Diff line Loading @@ -904,6 +904,20 @@ Fail: return -1; } static jboolean configHciSnoopLogNative(JNIEnv* env, jobject obj, jboolean enable) { ALOGV("%s:",__FUNCTION__); jboolean result = JNI_FALSE; if (!sBluetoothInterface) return result; int ret = sBluetoothInterface->config_hci_snoop_log(enable); result = (ret == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; return result; } static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"classInitNative", "()V", (void *) classInitNative}, Loading @@ -926,7 +940,8 @@ static JNINativeMethod sMethods[] = { {"getRemoteServicesNative", "([B)Z", (void*) getRemoteServicesNative}, {"connectSocketNative", "([BI[BII)I", (void*) connectSocketNative}, {"createSocketChannelNative", "(ILjava/lang/String;[BII)I", (void*) createSocketChannelNative} (void*) createSocketChannelNative}, {"configHciSnoopLogNative", "(Z)Z", (void*) configHciSnoopLogNative} }; int register_com_android_bluetooth_btservice_AdapterService(JNIEnv* env) Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +19 −0 Original line number Diff line number Diff line Loading @@ -872,6 +872,18 @@ public class AdapterService extends Service { return service.createSocketChannel(type, serviceName, uuid, port, flag); } public boolean configHciSnoopLog(boolean enable) { if ((Binder.getCallingUid() != Process.SYSTEM_UID) && (!Utils.checkCaller())) { Log.w(TAG,"configHciSnoopLog(): not allowed for non-active user"); return false; } AdapterService service = getService(); if (service == null) return false; return service.configHciSnoopLog(enable); } public void registerCallback(IBluetoothCallback cb) { AdapterService service = getService(); if (service == null) return ; Loading Loading @@ -1322,6 +1334,11 @@ public class AdapterService extends Service { return ParcelFileDescriptor.adoptFd(fd); } boolean configHciSnoopLog(boolean enable) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); return configHciSnoopLogNative(enable); } void registerCallback(IBluetoothCallback cb) { mCallbacks.register(cb); } Loading Loading @@ -1396,6 +1413,8 @@ public class AdapterService extends Service { private native int createSocketChannelNative(int type, String serviceName, byte[] uuid, int port, int flag); /*package*/ native boolean configHciSnoopLogNative(boolean enable); protected void finalize() { cleanup(); if (TRACE_REF) { Loading