summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2014-11-27 18:28:20 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2014-11-27 18:28:20 -0800
commitc15e99458099da3d1f1e12ce48f2c6f2e65767ca (patch)
tree2afac4d7680e1de84305922e9edeb37814ddb8e1
parentc7c9a230ac47120fc82739bac450e997cbb923f6 (diff)
parent1530c41fbf2ddb38964658f288e063654d3e424b (diff)
downloadandroid_packages_apps_Bluetooth-c15e99458099da3d1f1e12ce48f2c6f2e65767ca.tar.gz
android_packages_apps_Bluetooth-c15e99458099da3d1f1e12ce48f2c6f2e65767ca.tar.bz2
android_packages_apps_Bluetooth-c15e99458099da3d1f1e12ce48f2c6f2e65767ca.zip
Merge "AVRCP: Properly handle player set attribute response"
-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