Loading android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -832,7 +832,7 @@ static jboolean cancelDiscoveryNative(JNIEnv* env, jobject obj) { return result; } static jboolean createBondNative(JNIEnv* env, jobject obj, jbyteArray address) { static jboolean createBondNative(JNIEnv* env, jobject obj, jbyteArray address, jint transport) { ALOGV("%s:",__FUNCTION__); jbyte *addr; Loading @@ -846,7 +846,7 @@ static jboolean createBondNative(JNIEnv* env, jobject obj, jbyteArray address) { return result; } int ret = sBluetoothInterface->create_bond((bt_bdaddr_t *)addr); int ret = sBluetoothInterface->create_bond((bt_bdaddr_t *)addr, transport); env->ReleaseByteArrayElements(address, addr, 0); result = (ret == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; Loading Loading @@ -1221,7 +1221,7 @@ static JNINativeMethod sMethods[] = { {"setDevicePropertyNative", "([BI[B)Z", (void*) setDevicePropertyNative}, {"startDiscoveryNative", "()Z", (void*) startDiscoveryNative}, {"cancelDiscoveryNative", "()Z", (void*) cancelDiscoveryNative}, {"createBondNative", "([B)Z", (void*) createBondNative}, {"createBondNative", "([BI)Z", (void*) createBondNative}, {"removeBondNative", "([B)Z", (void*) removeBondNative}, {"cancelBondNative", "([B)Z", (void*) cancelBondNative}, {"isConnectedNative", "([B)Z", (void*) isConnectedNative}, Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +5 −4 Original line number Diff line number Diff line Loading @@ -792,7 +792,7 @@ public class AdapterService extends Service { return service.getProfileConnectionState(profile); } public boolean createBond(BluetoothDevice device) { public boolean createBond(BluetoothDevice device, int transport) { if (!Utils.checkCaller()) { Log.w(TAG, "createBond() - Not allowed for non-active user"); return false; Loading @@ -800,7 +800,7 @@ public class AdapterService extends Service { AdapterService service = getService(); if (service == null) return false; return service.createBond(device); return service.createBond(device, transport); } public boolean cancelBondProcess(BluetoothDevice device) { Loading Loading @@ -1202,7 +1202,7 @@ public class AdapterService extends Service { return mAdapterProperties.getProfileConnectionState(profile); } boolean createBond(BluetoothDevice device) { boolean createBond(BluetoothDevice device, int transport) { enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission"); DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(device); Loading @@ -1216,6 +1216,7 @@ public class AdapterService extends Service { Message msg = mBondStateMachine.obtainMessage(BondStateMachine.CREATE_BOND); msg.obj = device; msg.arg1 = transport; mBondStateMachine.sendMessage(msg); return true; } Loading Loading @@ -1718,7 +1719,7 @@ public class AdapterService extends Service { setDevicePropertyNative(byte[] address, int type, byte[] val); /*package*/ native boolean getDevicePropertyNative(byte[] address, int type); /*package*/ native boolean createBondNative(byte[] address); /*package*/ native boolean createBondNative(byte[] address, int transport); /*package*/ native boolean removeBondNative(byte[] address); /*package*/ native boolean cancelBondNative(byte[] address); Loading android/app/src/com/android/bluetooth/btservice/BondStateMachine.java +4 −4 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ final class BondStateMachine extends StateMachine { switch(msg.what) { case CREATE_BOND: createBond(dev, true); createBond(dev, msg.arg1, true); break; case REMOVE_BOND: removeBond(dev, true); Loading Loading @@ -160,7 +160,7 @@ final class BondStateMachine extends StateMachine { switch (msg.what) { case CREATE_BOND: result = createBond(dev, false); result = createBond(dev, msg.arg1, false); break; case REMOVE_BOND: result = removeBond(dev, false); Loading Loading @@ -237,11 +237,11 @@ final class BondStateMachine extends StateMachine { return false; } private boolean createBond(BluetoothDevice dev, boolean transition) { private boolean createBond(BluetoothDevice dev, int transport, boolean transition) { if (dev.getBondState() == BluetoothDevice.BOND_NONE) { infoLog("Bond address is:" + dev); byte[] addr = Utils.getBytesFromAddress(dev.getAddress()); if (!mAdapterService.createBondNative(addr)) { if (!mAdapterService.createBondNative(addr, transport)) { sendIntent(dev, BluetoothDevice.BOND_NONE, BluetoothDevice.UNBOND_REASON_REMOVED); return false; Loading Loading
android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -832,7 +832,7 @@ static jboolean cancelDiscoveryNative(JNIEnv* env, jobject obj) { return result; } static jboolean createBondNative(JNIEnv* env, jobject obj, jbyteArray address) { static jboolean createBondNative(JNIEnv* env, jobject obj, jbyteArray address, jint transport) { ALOGV("%s:",__FUNCTION__); jbyte *addr; Loading @@ -846,7 +846,7 @@ static jboolean createBondNative(JNIEnv* env, jobject obj, jbyteArray address) { return result; } int ret = sBluetoothInterface->create_bond((bt_bdaddr_t *)addr); int ret = sBluetoothInterface->create_bond((bt_bdaddr_t *)addr, transport); env->ReleaseByteArrayElements(address, addr, 0); result = (ret == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; Loading Loading @@ -1221,7 +1221,7 @@ static JNINativeMethod sMethods[] = { {"setDevicePropertyNative", "([BI[B)Z", (void*) setDevicePropertyNative}, {"startDiscoveryNative", "()Z", (void*) startDiscoveryNative}, {"cancelDiscoveryNative", "()Z", (void*) cancelDiscoveryNative}, {"createBondNative", "([B)Z", (void*) createBondNative}, {"createBondNative", "([BI)Z", (void*) createBondNative}, {"removeBondNative", "([B)Z", (void*) removeBondNative}, {"cancelBondNative", "([B)Z", (void*) cancelBondNative}, {"isConnectedNative", "([B)Z", (void*) isConnectedNative}, Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +5 −4 Original line number Diff line number Diff line Loading @@ -792,7 +792,7 @@ public class AdapterService extends Service { return service.getProfileConnectionState(profile); } public boolean createBond(BluetoothDevice device) { public boolean createBond(BluetoothDevice device, int transport) { if (!Utils.checkCaller()) { Log.w(TAG, "createBond() - Not allowed for non-active user"); return false; Loading @@ -800,7 +800,7 @@ public class AdapterService extends Service { AdapterService service = getService(); if (service == null) return false; return service.createBond(device); return service.createBond(device, transport); } public boolean cancelBondProcess(BluetoothDevice device) { Loading Loading @@ -1202,7 +1202,7 @@ public class AdapterService extends Service { return mAdapterProperties.getProfileConnectionState(profile); } boolean createBond(BluetoothDevice device) { boolean createBond(BluetoothDevice device, int transport) { enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission"); DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(device); Loading @@ -1216,6 +1216,7 @@ public class AdapterService extends Service { Message msg = mBondStateMachine.obtainMessage(BondStateMachine.CREATE_BOND); msg.obj = device; msg.arg1 = transport; mBondStateMachine.sendMessage(msg); return true; } Loading Loading @@ -1718,7 +1719,7 @@ public class AdapterService extends Service { setDevicePropertyNative(byte[] address, int type, byte[] val); /*package*/ native boolean getDevicePropertyNative(byte[] address, int type); /*package*/ native boolean createBondNative(byte[] address); /*package*/ native boolean createBondNative(byte[] address, int transport); /*package*/ native boolean removeBondNative(byte[] address); /*package*/ native boolean cancelBondNative(byte[] address); Loading
android/app/src/com/android/bluetooth/btservice/BondStateMachine.java +4 −4 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ final class BondStateMachine extends StateMachine { switch(msg.what) { case CREATE_BOND: createBond(dev, true); createBond(dev, msg.arg1, true); break; case REMOVE_BOND: removeBond(dev, true); Loading Loading @@ -160,7 +160,7 @@ final class BondStateMachine extends StateMachine { switch (msg.what) { case CREATE_BOND: result = createBond(dev, false); result = createBond(dev, msg.arg1, false); break; case REMOVE_BOND: result = removeBond(dev, false); Loading Loading @@ -237,11 +237,11 @@ final class BondStateMachine extends StateMachine { return false; } private boolean createBond(BluetoothDevice dev, boolean transition) { private boolean createBond(BluetoothDevice dev, int transport, boolean transition) { if (dev.getBondState() == BluetoothDevice.BOND_NONE) { infoLog("Bond address is:" + dev); byte[] addr = Utils.getBytesFromAddress(dev.getAddress()); if (!mAdapterService.createBondNative(addr)) { if (!mAdapterService.createBondNative(addr, transport)) { sendIntent(dev, BluetoothDevice.BOND_NONE, BluetoothDevice.UNBOND_REASON_REMOVED); return false; Loading