summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAyan Ghosh <abghosh@codeaurora.org>2014-11-21 12:54:48 +0530
committerAyan Ghosh <abghosh@codeaurora.org>2014-11-21 12:56:00 +0530
commit1530c41fbf2ddb38964658f288e063654d3e424b (patch)
tree290f840b2011c24569070ba9d9f704822fe2640b
parent087a6cf7a9bf66d7789c9901cc111451b466d57b (diff)
downloadandroid_packages_apps_Bluetooth-1530c41fbf2ddb38964658f288e063654d3e424b.tar.gz
android_packages_apps_Bluetooth-1530c41fbf2ddb38964658f288e063654d3e424b.tar.bz2
android_packages_apps_Bluetooth-1530c41fbf2ddb38964658f288e063654d3e424b.zip
AVRCP: Properly handle player set attribute response
Properly handle player set attribute response Change-Id: I5efd1fb05c145ba5201e5e8c090a4e1dc3e993bd
-rw-r--r--src/com/android/bluetooth/avrcp/Avrcp.java28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/com/android/bluetooth/avrcp/Avrcp.java b/src/com/android/bluetooth/avrcp/Avrcp.java
index e7cd00885..dfa24d2f0 100644
--- a/src/com/android/bluetooth/avrcp/Avrcp.java
+++ b/src/com/android/bluetooth/avrcp/Avrcp.java
@@ -402,14 +402,19 @@ public final class Avrcp {
GET_INVALID);
byte [] data;
String [] text;
+ boolean isSetAttrValRsp = false;
synchronized (mPendingCmds) {
Integer val = new Integer(getResponse);
if (mPendingCmds.contains(val)) {
+ if (getResponse == SET_ATTRIBUTE_VALUES) {
+ isSetAttrValRsp = true;
+ if (DEBUG) Log.v(TAG,"Response received for SET_ATTRIBUTE_VALUES");
+ }
mHandler.removeMessages(MESSAGE_PLAYERSETTINGS_TIMEOUT);
mPendingCmds.remove(val);
}
}
- if (DEBUG) Log.v(TAG,"getResponse" + getResponse);
+ if (DEBUG) Log.v(TAG,"getResponse " + getResponse);
switch (getResponse) {
case GET_ATTRIBUTE_IDS:
data = intent.getByteArrayExtra(EXTRA_ATTIBUTE_ID_ARRAY);
@@ -420,14 +425,14 @@ public final class Avrcp {
case GET_VALUE_IDS:
data = intent.getByteArrayExtra(EXTRA_VALUE_ID_ARRAY);
numAttr = (byte) data.length;
- if (DEBUG) Log.v(TAG,"GET_VALUE_IDS" + numAttr);
+ if (DEBUG) Log.v(TAG,"GET_VALUE_IDS " + numAttr);
getPlayerAppValueRspNative(numAttr, data);
break;
case GET_ATTRIBUTE_VALUES:
data = intent.getByteArrayExtra(EXTRA_ATTRIB_VALUE_PAIRS);
updateLocalPlayerSettings(data);
numAttr = (byte) data.length;
- if (DEBUG) Log.v(TAG,"GET_ATTRIBUTE_VALUES" + numAttr);
+ if (DEBUG) Log.v(TAG,"GET_ATTRIBUTE_VALUES " + numAttr);
SendCurrentPlayerValueRspNative(numAttr, data);
break;
case SET_ATTRIBUTE_VALUES:
@@ -437,17 +442,20 @@ public final class Avrcp {
if (data[0] == ATTRIBUTE_EQUALIZER ||
data[0] == ATTRIBUTE_REPEATMODE ||
data[0] == ATTRIBUTE_SHUFFLEMODE) {
- if (mPlayerStatusChangeNT == NOTIFICATION_TYPE_INTERIM) {
- Log.v(TAG,"Send Player appl attribute changed response");
- mPlayerStatusChangeNT = NOTIFICATION_TYPE_CHANGED;
- sendPlayerAppChangedRsp(mPlayerStatusChangeNT);
- } else {
+ if (isSetAttrValRsp){
+ isSetAttrValRsp = false;
Log.v(TAG,"Respond to SET_ATTRIBUTE_VALUES request");
if (data[1] == ATTRIBUTE_NOTSUPPORTED) {
SendSetPlayerAppRspNative(INTERNAL_ERROR);
} else {
SendSetPlayerAppRspNative(OPERATION_SUCCESSFUL);
}
+ } else if (mPlayerStatusChangeNT == NOTIFICATION_TYPE_INTERIM) {
+ Log.v(TAG,"Send Player appl attribute changed response");
+ mPlayerStatusChangeNT = NOTIFICATION_TYPE_CHANGED;
+ sendPlayerAppChangedRsp(mPlayerStatusChangeNT);
+ } else {
+ Log.v(TAG,"Drop Set Attr Val update from media player");
}
}
break;
@@ -3425,7 +3433,7 @@ private void updateLocalPlayerSettings( byte[] data) {
//PDU 0x14
private void setPlayerAppSetting( byte num , byte [] attr_id , byte [] attr_val )
{
- if (DEBUG) Log.v(TAG, "setPlayerAppSetting" + num );
+ if (DEBUG) Log.v(TAG, "setPlayerAppSetting " + num );
byte[] array = new byte[num*2];
for ( int i = 0; i < num; i++)
{
@@ -3440,7 +3448,7 @@ private void updateLocalPlayerSettings( byte[] data) {
msg.what = MESSAGE_PLAYERSETTINGS_TIMEOUT;
msg.arg1 = SET_ATTRIBUTE_VALUES;
mPendingCmds.add(new Integer(msg.arg1));
- mHandler.sendMessageDelayed(msg, 130);
+ mHandler.sendMessageDelayed(msg, 500);
}
//PDU 0x15