OSDN Git Service

Find cover art supported feature and send up to JNI
authorSal Savage <salsavage@google.com>
Thu, 31 Oct 2019 21:10:46 +0000 (14:10 -0700)
committerSal Savage <salsavage@google.com>
Wed, 12 Feb 2020 21:46:26 +0000 (13:46 -0800)
Bug: b/132812696
Test: Connect with a AVRCP Target device that indicates support for
cover art in their 0x311 supported features attribute in their SDP
record. Make sure we report that the device supports cover art in our
object that is sent up to the JNI and Java.

Change-Id: I98beafdf8a803e944abc9b2f8248ae580595f087

bta/av/bta_av_act.cc
bta/include/bta_av_api.h
btif/src/btif_av.cc
btif/src/btif_rc.cc
include/hardware/bt_rc.h

index 7bc7a46..40411d3 100644 (file)
@@ -1720,26 +1720,32 @@ tBTA_AV_FEAT bta_avk_check_peer_features(uint16_t service_uuid) {
       if (peer_rc_version >= AVRC_REV_1_3)
         peer_features |= (BTA_AV_FEAT_VENDOR | BTA_AV_FEAT_METADATA);
 
-      /*
-       * Though Absolute Volume came after in 1.4 and above, but there are few
-       * devices
-       * in market which supports absolute Volume and they are still 1.3
-       * TO avoid IOT issuses with those devices, we check for 1.3 as minimum
-       * version
-       */
-      if (peer_rc_version >= AVRC_REV_1_3) {
-        /* get supported features */
-        tSDP_DISC_ATTR* p_attr =
-            SDP_FindAttributeInRec(p_rec, ATTR_ID_SUPPORTED_FEATURES);
-        if (p_attr != NULL) {
-          uint16_t categories = p_attr->attr_value.v.u16;
-          if (categories & AVRC_SUPF_CT_CAT2)
+      /* Get supported features */
+      tSDP_DISC_ATTR* p_attr =
+          SDP_FindAttributeInRec(p_rec, ATTR_ID_SUPPORTED_FEATURES);
+      if (p_attr != NULL) {
+        uint16_t categories = p_attr->attr_value.v.u16;
+        /*
+         * Though Absolute Volume came after in 1.4 and above, but there are
+         * few devices in market which supports absolute Volume and they are
+         * still 1.3. To avoid IOP issuses with those devices, we check for
+         * 1.3 as minimum version
+         */
+        if (peer_rc_version >= AVRC_REV_1_3) {
+          if (categories & AVRC_SUPF_TG_CAT2)
             peer_features |= (BTA_AV_FEAT_ADV_CTRL);
-          if (categories & AVRC_SUPF_CT_APP_SETTINGS)
+          if (categories & AVRC_SUPF_TG_APP_SETTINGS)
             peer_features |= (BTA_AV_FEAT_APP_SETTING);
-          if (categories & AVRC_SUPF_CT_BROWSE)
+          if (categories & AVRC_SUPF_TG_BROWSE)
             peer_features |= (BTA_AV_FEAT_BROWSE);
         }
+
+        /* AVRCP Cover Artwork over BIP */
+        if (peer_rc_version >= AVRC_REV_1_6) {
+          if (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_TARGET &&
+              categories & AVRC_SUPF_TG_PLAYER_COVER_ART)
+            peer_features |= (BTA_AV_FEAT_COVER_ARTWORK);
+        }
       }
     }
     /* get next record; if none found, we're done */
index 418f012..e6b05c5 100644 (file)
@@ -72,6 +72,7 @@ typedef uint8_t tBTA_AV_STATUS;
 #define BTA_AV_FEAT_DELAY_RPT 0x0400 /* allow delay reporting */
 #define BTA_AV_FEAT_ACP_START \
   0x0800 /* start stream when 2nd SNK was accepted   */
+#define BTA_AV_FEAT_COVER_ARTWORK 0x1000 /* use cover art feature */
 #define BTA_AV_FEAT_APP_SETTING 0x2000 /* Player app setting support */
 
 /* Internal features */
index 5742a3b..426bdbd 100644 (file)
@@ -3070,7 +3070,7 @@ bt_status_t btif_av_sink_execute_service(bool enable) {
     tBTA_AV_FEAT features = BTA_AV_FEAT_NO_SCO_SSPD | BTA_AV_FEAT_RCCT |
                             BTA_AV_FEAT_METADATA | BTA_AV_FEAT_VENDOR |
                             BTA_AV_FEAT_ADV_CTRL | BTA_AV_FEAT_RCTG |
-                            BTA_AV_FEAT_BROWSE;
+                            BTA_AV_FEAT_BROWSE | BTA_AV_FEAT_COVER_ARTWORK;
     BTA_AvEnable(BTA_SEC_AUTHENTICATE, features, bta_av_sink_callback);
     btif_av_sink.RegisterAllBtaHandles();
     return BT_STATUS_SUCCESS;
index b668444..a3741f3 100755 (executable)
@@ -485,6 +485,11 @@ void handle_rc_ctrl_features(btif_rc_device_cb_t* p_dev) {
     rc_features |= BTRC_FEAT_BROWSE;
   }
 
+  /* Add cover art feature capability */
+  if (p_dev->rc_features & BTA_AV_FEAT_COVER_ARTWORK) {
+    rc_features |= BTRC_FEAT_COVER_ARTWORK;
+  }
+
   BTIF_TRACE_DEBUG("%s: Update rc features to CTRL: %d", __func__, rc_features);
   do_in_jni_thread(FROM_HERE, base::Bind(bt_rc_ctrl_callbacks->getrcfeatures_cb,
                                          p_dev->rc_addr, rc_features));
@@ -1750,6 +1755,7 @@ static bt_status_t init_ctrl(btrc_ctrl_callbacks_t* callbacks) {
            sizeof(btif_rc_cb.rc_multi_cb[idx]));
     btif_rc_cb.rc_multi_cb[idx].rc_vol_label = MAX_LABEL;
     btif_rc_cb.rc_multi_cb[idx].rc_volume = MAX_VOLUME;
+    btif_rc_cb.rc_multi_cb[idx].rc_features_processed = FALSE;
   }
   lbl_init();
 
index 66c1103..49c8b8c 100755 (executable)
@@ -86,6 +86,7 @@ typedef enum {
   BTRC_FEAT_METADATA = 0x01,        /* AVRCP 1.3 */
   BTRC_FEAT_ABSOLUTE_VOLUME = 0x02, /* Supports TG role and volume sync */
   BTRC_FEAT_BROWSE = 0x04, /* AVRCP 1.4 and up, with Browsing support */
+  BTRC_FEAT_COVER_ARTWORK = 0x8,    /* AVRCP 1.6 and up, Cover Art */
 } btrc_remote_features_t;
 
 typedef enum {