Loading android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -900,7 +900,7 @@ static jboolean cancelBondNative(JNIEnv* env, jobject obj, jbyteArray address) { return result; } static jboolean isConnectedNative(JNIEnv* env, jobject obj, jbyteArray address) { static int getConnectionStateNative(JNIEnv* env, jobject obj, jbyteArray address) { ALOGV("%s:",__FUNCTION__); if (!sBluetoothInterface) return JNI_FALSE; Loading @@ -913,7 +913,7 @@ static jboolean isConnectedNative(JNIEnv* env, jobject obj, jbyteArray address) int ret = sBluetoothInterface->get_connection_state((bt_bdaddr_t *)addr); env->ReleaseByteArrayElements(address, addr, 0); return (ret != 0 ? JNI_TRUE : JNI_FALSE); return ret; } static jboolean pinReplyNative(JNIEnv *env, jobject obj, jbyteArray address, jboolean accept, Loading Loading @@ -1231,7 +1231,7 @@ static JNINativeMethod sMethods[] = { {"createBondNative", "([BI)Z", (void*) createBondNative}, {"removeBondNative", "([B)Z", (void*) removeBondNative}, {"cancelBondNative", "([B)Z", (void*) cancelBondNative}, {"isConnectedNative", "([B)Z", (void*) isConnectedNative}, {"getConnectionStateNative", "([B)I", (void*) getConnectionStateNative}, {"pinReplyNative", "([BZI[B)Z", (void*) pinReplyNative}, {"sspReplyNative", "([BIZI)Z", (void*) sspReplyNative}, {"getRemoteServicesNative", "([B)Z", (void*) getRemoteServicesNative}, Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +6 −8 Original line number Diff line number Diff line Loading @@ -858,12 +858,10 @@ public class AdapterService extends Service { return service.getBondState(device); } public boolean isConnected(BluetoothDevice device) { public int getConnectionState(BluetoothDevice device) { AdapterService service = getService(); if (service == null) { return false; } return service.isConnected(device); if (service == null) return 0; return service.getConnectionState(device); } public String getRemoteName(BluetoothDevice device) { Loading Loading @@ -1462,10 +1460,10 @@ public class AdapterService extends Service { return deviceProp.getBondState(); } boolean isConnected(BluetoothDevice device) { int getConnectionState(BluetoothDevice device) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); byte[] addr = Utils.getBytesFromAddress(device.getAddress()); return isConnectedNative(addr); return getConnectionStateNative(addr); } String getRemoteName(BluetoothDevice device) { Loading Loading @@ -1875,7 +1873,7 @@ public class AdapterService extends Service { /*package*/ native boolean removeBondNative(byte[] address); /*package*/ native boolean cancelBondNative(byte[] address); /*package*/ native boolean isConnectedNative(byte[] address); /*package*/ native int getConnectionStateNative(byte[] address); private native boolean startDiscoveryNative(); private native boolean cancelDiscoveryNative(); Loading Loading
android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -900,7 +900,7 @@ static jboolean cancelBondNative(JNIEnv* env, jobject obj, jbyteArray address) { return result; } static jboolean isConnectedNative(JNIEnv* env, jobject obj, jbyteArray address) { static int getConnectionStateNative(JNIEnv* env, jobject obj, jbyteArray address) { ALOGV("%s:",__FUNCTION__); if (!sBluetoothInterface) return JNI_FALSE; Loading @@ -913,7 +913,7 @@ static jboolean isConnectedNative(JNIEnv* env, jobject obj, jbyteArray address) int ret = sBluetoothInterface->get_connection_state((bt_bdaddr_t *)addr); env->ReleaseByteArrayElements(address, addr, 0); return (ret != 0 ? JNI_TRUE : JNI_FALSE); return ret; } static jboolean pinReplyNative(JNIEnv *env, jobject obj, jbyteArray address, jboolean accept, Loading Loading @@ -1231,7 +1231,7 @@ static JNINativeMethod sMethods[] = { {"createBondNative", "([BI)Z", (void*) createBondNative}, {"removeBondNative", "([B)Z", (void*) removeBondNative}, {"cancelBondNative", "([B)Z", (void*) cancelBondNative}, {"isConnectedNative", "([B)Z", (void*) isConnectedNative}, {"getConnectionStateNative", "([B)I", (void*) getConnectionStateNative}, {"pinReplyNative", "([BZI[B)Z", (void*) pinReplyNative}, {"sspReplyNative", "([BIZI)Z", (void*) sspReplyNative}, {"getRemoteServicesNative", "([B)Z", (void*) getRemoteServicesNative}, Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +6 −8 Original line number Diff line number Diff line Loading @@ -858,12 +858,10 @@ public class AdapterService extends Service { return service.getBondState(device); } public boolean isConnected(BluetoothDevice device) { public int getConnectionState(BluetoothDevice device) { AdapterService service = getService(); if (service == null) { return false; } return service.isConnected(device); if (service == null) return 0; return service.getConnectionState(device); } public String getRemoteName(BluetoothDevice device) { Loading Loading @@ -1462,10 +1460,10 @@ public class AdapterService extends Service { return deviceProp.getBondState(); } boolean isConnected(BluetoothDevice device) { int getConnectionState(BluetoothDevice device) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); byte[] addr = Utils.getBytesFromAddress(device.getAddress()); return isConnectedNative(addr); return getConnectionStateNative(addr); } String getRemoteName(BluetoothDevice device) { Loading Loading @@ -1875,7 +1873,7 @@ public class AdapterService extends Service { /*package*/ native boolean removeBondNative(byte[] address); /*package*/ native boolean cancelBondNative(byte[] address); /*package*/ native boolean isConnectedNative(byte[] address); /*package*/ native int getConnectionStateNative(byte[] address); private native boolean startDiscoveryNative(); private native boolean cancelDiscoveryNative(); Loading