summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrakesh reddy <ramare@codeaurora.org>2014-09-24 11:30:15 +0530
committerLinux Build Service Account <lnxbuild@localhost>2014-11-04 08:26:35 -0700
commite68ba26f62fad64de0f9ed657af7db5c0448d8e1 (patch)
tree2002833f91454cdb34be46ed2120c14e0c99bb7e
parentbc7cbb628447ef58a8730ea84d85f1bd46b22bc6 (diff)
downloadandroid_packages_apps_Bluetooth-e68ba26f62fad64de0f9ed657af7db5c0448d8e1.tar.gz
android_packages_apps_Bluetooth-e68ba26f62fad64de0f9ed657af7db5c0448d8e1.tar.bz2
android_packages_apps_Bluetooth-e68ba26f62fad64de0f9ed657af7db5c0448d8e1.zip
Properly handle Set player setting attributes response path.
- Properly handle Set player setting attributes response path and send error code based on whether operation succeeds or fails. Change-Id: I3f1bf6ccabfdf0dbbae0d136b363efd1c10657d2
-rw-r--r--jni/com_android_bluetooth_avrcp.cpp6
-rw-r--r--src/com/android/bluetooth/avrcp/Avrcp.java34
2 files changed, 27 insertions, 13 deletions
diff --git a/jni/com_android_bluetooth_avrcp.cpp b/jni/com_android_bluetooth_avrcp.cpp
index 903fd961a..eaed3bd5d 100644
--- a/jni/com_android_bluetooth_avrcp.cpp
+++ b/jni/com_android_bluetooth_avrcp.cpp
@@ -721,10 +721,10 @@ static jboolean SendCurrentPlayerValueRspNative(JNIEnv *env, jobject object ,
//JNI Method called to Respond to PDU 0x14
-static jboolean SendSetPlayerAppRspNative(JNIEnv *env, jobject object)
+static jboolean SendSetPlayerAppRspNative(JNIEnv *env, jobject object , jint attr_status)
{
bt_status_t status;
- btrc_status_t player_rsp = BTRC_STS_NO_ERROR;
+ btrc_status_t player_rsp = (btrc_status_t) attr_status;
if ((status = sBluetoothAvrcpInterface->set_player_app_value_rsp(player_rsp)) !=
BT_STATUS_SUCCESS) {
ALOGE("Failed get_element_attr_rsp, status: %d", status);
@@ -1569,7 +1569,7 @@ static JNINativeMethod sMethods[] = {
(void *) registerNotificationPlayerAppRspNative},
{"registerNotificationRspTrackChangeNative", "(I[B)Z",
(void *) registerNotificationRspTrackChangeNative},
- {"SendSetPlayerAppRspNative", "()Z",
+ {"SendSetPlayerAppRspNative", "(I)Z",
(void *) SendSetPlayerAppRspNative},
{"sendSettingsTextRspNative" , "(I[BI[Ljava/lang/String;)Z",
(void *) sendSettingsTextRspNative},
diff --git a/src/com/android/bluetooth/avrcp/Avrcp.java b/src/com/android/bluetooth/avrcp/Avrcp.java
index f6cd24599..b734a89f3 100644
--- a/src/com/android/bluetooth/avrcp/Avrcp.java
+++ b/src/com/android/bluetooth/avrcp/Avrcp.java
@@ -287,6 +287,7 @@ public final class Avrcp {
public static final int VALUE_REPEATMODE_SINGLE = 2;
public static final int VALUE_REPEATMODE_ALL = 3;
public static final int VALUE_INVALID = 0;
+ public static final int ATTRIBUTE_NOTSUPPORTED = -1;
public static final int ATTRIBUTE_EQUALIZER = 1;
public static final int ATTRIBUTE_REPEATMODE = 2;
@@ -423,18 +424,31 @@ public final class Avrcp {
getPlayerAppValueRspNative(numAttr, data);
break;
case GET_ATTRIBUTE_VALUES:
- case NOTIFY_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 (mPlayerStatusChangeNT == NOTIFICATION_TYPE_INTERIM && getResponse
- == NOTIFY_ATTRIBUTE_VALUES) {
- mPlayerStatusChangeNT = NOTIFICATION_TYPE_CHANGED;
- sendPlayerAppChangedRsp(mPlayerStatusChangeNT);
- }
- else {
- SendCurrentPlayerValueRspNative(numAttr, data);
+ SendCurrentPlayerValueRspNative(numAttr, data);
+ break;
+ case SET_ATTRIBUTE_VALUES:
+ data = intent.getByteArrayExtra(EXTRA_ATTRIB_VALUE_PAIRS);
+ updateLocalPlayerSettings(data);
+ Log.v(TAG,"SET_ATTRIBUTE_VALUES: " + data[0] + ", " + data[1]);
+ 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 {
+ Log.v(TAG,"Respond to SET_ATTRIBUTE_VALUES request");
+ if (data[1] == ATTRIBUTE_NOTSUPPORTED) {
+ SendSetPlayerAppRspNative(INTERNAL_ERROR);
+ } else {
+ SendSetPlayerAppRspNative(OPERATION_SUCCESSFUL);
+ }
+ }
}
break;
case GET_ATTRIBUTE_TEXT:
@@ -746,7 +760,7 @@ public final class Avrcp {
SendCurrentPlayerValueRspNative((byte)retVal.length, retVal);
break;
case SET_ATTRIBUTE_VALUES :
- SendSetPlayerAppRspNative();
+ SendSetPlayerAppRspNative(INTERNAL_ERROR);
break;
case GET_ATTRIBUTE_TEXT:
case GET_VALUE_TEXT:
@@ -3771,7 +3785,7 @@ private void updateLocalPlayerSettings( byte[] data) {
private native boolean getListPlayerappAttrRspNative(byte attr, byte[] attrIds);
private native boolean getPlayerAppValueRspNative(byte numberattr, byte[]values );
private native boolean SendCurrentPlayerValueRspNative(byte numberattr, byte[]attr );
- private native boolean SendSetPlayerAppRspNative();
+ private native boolean SendSetPlayerAppRspNative(int attr_status);
private native boolean sendSettingsTextRspNative(int num_attr, byte[] attr,
int length, String[]text);
private native boolean sendValueTextRspNative(int num_attr, byte[] attr,