Bug 953045 - Fix a bug of bluetooth AVRCP to support media metadata updating correctly. f=shuang, r=echou

This commit is contained in:
Jamin Liu 2014-01-17 18:15:37 +08:00
parent b43ef033c1
commit 578696351b

View File

@ -3119,6 +3119,13 @@ BluetoothDBusService::SendMetaData(const nsAString& aTitle,
nsCString tempMediaNumber = EmptyCString(); nsCString tempMediaNumber = EmptyCString();
nsCString tempTotalMediaCount = EmptyCString(); nsCString tempTotalMediaCount = EmptyCString();
nsCString tempDuration = EmptyCString(); nsCString tempDuration = EmptyCString();
// We currently don't support genre field in music player.
// In order to send media metadata through AVRCP, we set genre to an empty
// string to match the BlueZ method "UpdateMetaData" with signature "sssssss",
// which takes genre field as the last parameter.
nsCString tempGenre = EmptyCString();
if (aMediaNumber >= 0) { if (aMediaNumber >= 0) {
tempMediaNumber.AppendInt(aMediaNumber); tempMediaNumber.AppendInt(aMediaNumber);
} }
@ -3135,6 +3142,7 @@ BluetoothDBusService::SendMetaData(const nsAString& aTitle,
const char* mediaNumber = tempMediaNumber.get(); const char* mediaNumber = tempMediaNumber.get();
const char* totalMediaCount = tempTotalMediaCount.get(); const char* totalMediaCount = tempTotalMediaCount.get();
const char* duration = tempDuration.get(); const char* duration = tempDuration.get();
const char* genre = tempGenre.get();
nsAutoString prevTitle, prevAlbum; nsAutoString prevTitle, prevAlbum;
a2dp->GetTitle(prevTitle); a2dp->GetTitle(prevTitle);
@ -3161,6 +3169,7 @@ BluetoothDBusService::SendMetaData(const nsAString& aTitle,
DBUS_TYPE_STRING, &mediaNumber, DBUS_TYPE_STRING, &mediaNumber,
DBUS_TYPE_STRING, &totalMediaCount, DBUS_TYPE_STRING, &totalMediaCount,
DBUS_TYPE_STRING, &duration, DBUS_TYPE_STRING, &duration,
DBUS_TYPE_STRING, &genre,
DBUS_TYPE_INVALID); DBUS_TYPE_INVALID);
NS_ENSURE_TRUE_VOID(ret); NS_ENSURE_TRUE_VOID(ret);