Loading android/app/jni/com_android_bluetooth_gatt.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -1645,7 +1645,13 @@ static void gattServerSendResponseNative(JNIEnv* env, jobject object, response.attr_value.len = 0; if (val != NULL) { if (env->GetArrayLength(val) < BTGATT_MAX_ATTR_LEN) { response.attr_value.len = (uint16_t)env->GetArrayLength(val); } else { android_errorWriteLog(0x534e4554, "78787521"); response.attr_value.len = BTGATT_MAX_ATTR_LEN; } jbyte* array = env->GetByteArrayElements(val, 0); for (int i = 0; i != response.attr_value.len; ++i) Loading android/app/src/com/android/bluetooth/a2dp/A2dpService.java +10 −3 Original line number Diff line number Diff line Loading @@ -442,10 +442,17 @@ public class A2dpService extends ProfileService { // disconnected. Please see comment in broadcastActiveDevice() for why. broadcastActiveDevice(null); if (previousActiveDevice != null) { // Make sure the Audio Manager knows the previous Active device is disconnected mAudioManager.setBluetoothA2dpDeviceConnectionState( // Make sure the Audio Manager knows the previous Active device is disconnected. // However, if A2DP is still connected for that remote device, the user has // explicitly switched the output to the local device and music should // continue playing. Otherwise, the remote device has been indeed disconnected, // and audio should be suspended before switching the output to the local // device. mAudioManager.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent( previousActiveDevice, BluetoothProfile.STATE_DISCONNECTED, BluetoothProfile.A2DP); BluetoothProfile.A2DP, getConnectionState(previousActiveDevice) == BluetoothProfile.STATE_CONNECTED); // Make sure the Active device in native layer is set to null and audio is off if (!mA2dpNativeInterface.setActiveDevice(null)) { Log.w(TAG, "setActiveDevice(null): Cannot remove active device in native " Loading android/app/src/com/android/bluetooth/newavrcp/MediaPlayerWrapper.java +10 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,16 @@ class MediaPlayerWrapper { } Metadata getCurrentMetadata() { // Try to use the now playing list if the information exists. if (getActiveQueueID() != -1) { for (Metadata data : getCurrentQueue()) { if (data.mediaId.equals(Util.NOW_PLAYING_PREFIX + getActiveQueueID())) { d("getCurrentMetadata: Using playlist data: " + data.toString()); return data.clone(); } } } return Util.toMetadata(getMetadata()); } Loading android/app/src/com/android/bluetooth/newavrcp/helpers/Util.java +5 −2 Original line number Diff line number Diff line Loading @@ -209,8 +209,11 @@ class Util { if (items == null) return list; for (MediaSession.QueueItem item : items) { list.add(toMetadata(item)); for (int i = 0; i < items.size(); i++) { Metadata data = toMetadata(items.get(i)); data.trackNum = "" + (i + 1); data.numTracks = "" + items.size(); list.add(data); } return list; Loading android/app/src/com/android/bluetooth/pbap/BluetoothPbapVcardManager.java +14 −3 Original line number Diff line number Diff line Loading @@ -344,6 +344,9 @@ public class BluetoothPbapVcardManager { Log.e(TAG, "Failed to read a contact. Error reason: " + composer.getErrorReason()); return nameList; } else if (vcard.isEmpty()) { Log.i(TAG, "Contact may have been deleted during operation"); continue; } if (V) { Log.v(TAG, "Checking selected bits in the vcard composer" + vcard); Loading Loading @@ -739,6 +742,9 @@ public class BluetoothPbapVcardManager { Log.e(TAG, "Failed to read a contact. Error reason: " + composer.getErrorReason()); return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR; } else if (vcard.isEmpty()) { Log.i(TAG, "Contact may have been deleted during operation"); continue; } if (V) { Log.v(TAG, "vCard from composer: " + vcard); Loading Loading @@ -835,6 +841,9 @@ public class BluetoothPbapVcardManager { Log.e(TAG, "Failed to read a contact. Error reason: " + composer.getErrorReason()); return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR; } else if (vcard.isEmpty()) { Log.i(TAG, "Contact may have been deleted during operation"); continue; } if (V) { Log.v(TAG, "Checking selected bits in the vcard composer" + vcard); Loading Loading @@ -921,14 +930,16 @@ public class BluetoothPbapVcardManager { continue; } if (needSendBody == NEED_SEND_BODY) { if (vcard != null) { vcard = vcardfilter.apply(vcard, vcardType21); } if (vcard == null) { Log.e(TAG, "Failed to read a contact. Error reason: " + composer.getErrorReason()); return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR; } else if (vcard.isEmpty()) { Log.i(TAG, "Call Log may have been deleted during operation"); continue; } vcard = vcardfilter.apply(vcard, vcardType21); if (V) { Log.v(TAG, "Vcard Entry:"); Log.v(TAG, vcard); Loading Loading
android/app/jni/com_android_bluetooth_gatt.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -1645,7 +1645,13 @@ static void gattServerSendResponseNative(JNIEnv* env, jobject object, response.attr_value.len = 0; if (val != NULL) { if (env->GetArrayLength(val) < BTGATT_MAX_ATTR_LEN) { response.attr_value.len = (uint16_t)env->GetArrayLength(val); } else { android_errorWriteLog(0x534e4554, "78787521"); response.attr_value.len = BTGATT_MAX_ATTR_LEN; } jbyte* array = env->GetByteArrayElements(val, 0); for (int i = 0; i != response.attr_value.len; ++i) Loading
android/app/src/com/android/bluetooth/a2dp/A2dpService.java +10 −3 Original line number Diff line number Diff line Loading @@ -442,10 +442,17 @@ public class A2dpService extends ProfileService { // disconnected. Please see comment in broadcastActiveDevice() for why. broadcastActiveDevice(null); if (previousActiveDevice != null) { // Make sure the Audio Manager knows the previous Active device is disconnected mAudioManager.setBluetoothA2dpDeviceConnectionState( // Make sure the Audio Manager knows the previous Active device is disconnected. // However, if A2DP is still connected for that remote device, the user has // explicitly switched the output to the local device and music should // continue playing. Otherwise, the remote device has been indeed disconnected, // and audio should be suspended before switching the output to the local // device. mAudioManager.setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent( previousActiveDevice, BluetoothProfile.STATE_DISCONNECTED, BluetoothProfile.A2DP); BluetoothProfile.A2DP, getConnectionState(previousActiveDevice) == BluetoothProfile.STATE_CONNECTED); // Make sure the Active device in native layer is set to null and audio is off if (!mA2dpNativeInterface.setActiveDevice(null)) { Log.w(TAG, "setActiveDevice(null): Cannot remove active device in native " Loading
android/app/src/com/android/bluetooth/newavrcp/MediaPlayerWrapper.java +10 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,16 @@ class MediaPlayerWrapper { } Metadata getCurrentMetadata() { // Try to use the now playing list if the information exists. if (getActiveQueueID() != -1) { for (Metadata data : getCurrentQueue()) { if (data.mediaId.equals(Util.NOW_PLAYING_PREFIX + getActiveQueueID())) { d("getCurrentMetadata: Using playlist data: " + data.toString()); return data.clone(); } } } return Util.toMetadata(getMetadata()); } Loading
android/app/src/com/android/bluetooth/newavrcp/helpers/Util.java +5 −2 Original line number Diff line number Diff line Loading @@ -209,8 +209,11 @@ class Util { if (items == null) return list; for (MediaSession.QueueItem item : items) { list.add(toMetadata(item)); for (int i = 0; i < items.size(); i++) { Metadata data = toMetadata(items.get(i)); data.trackNum = "" + (i + 1); data.numTracks = "" + items.size(); list.add(data); } return list; Loading
android/app/src/com/android/bluetooth/pbap/BluetoothPbapVcardManager.java +14 −3 Original line number Diff line number Diff line Loading @@ -344,6 +344,9 @@ public class BluetoothPbapVcardManager { Log.e(TAG, "Failed to read a contact. Error reason: " + composer.getErrorReason()); return nameList; } else if (vcard.isEmpty()) { Log.i(TAG, "Contact may have been deleted during operation"); continue; } if (V) { Log.v(TAG, "Checking selected bits in the vcard composer" + vcard); Loading Loading @@ -739,6 +742,9 @@ public class BluetoothPbapVcardManager { Log.e(TAG, "Failed to read a contact. Error reason: " + composer.getErrorReason()); return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR; } else if (vcard.isEmpty()) { Log.i(TAG, "Contact may have been deleted during operation"); continue; } if (V) { Log.v(TAG, "vCard from composer: " + vcard); Loading Loading @@ -835,6 +841,9 @@ public class BluetoothPbapVcardManager { Log.e(TAG, "Failed to read a contact. Error reason: " + composer.getErrorReason()); return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR; } else if (vcard.isEmpty()) { Log.i(TAG, "Contact may have been deleted during operation"); continue; } if (V) { Log.v(TAG, "Checking selected bits in the vcard composer" + vcard); Loading Loading @@ -921,14 +930,16 @@ public class BluetoothPbapVcardManager { continue; } if (needSendBody == NEED_SEND_BODY) { if (vcard != null) { vcard = vcardfilter.apply(vcard, vcardType21); } if (vcard == null) { Log.e(TAG, "Failed to read a contact. Error reason: " + composer.getErrorReason()); return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR; } else if (vcard.isEmpty()) { Log.i(TAG, "Call Log may have been deleted during operation"); continue; } vcard = vcardfilter.apply(vcard, vcardType21); if (V) { Log.v(TAG, "Vcard Entry:"); Log.v(TAG, vcard); Loading