From: Ajay Panicker Date: Wed, 30 Aug 2017 01:30:43 +0000 (-0700) Subject: Don't reject notifications and wait until new addressed player is ready (2/2) X-Git-Tag: android-x86-9.0-r1~186^2~4^2~2^2~99^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b72a002756513757b493db9e1e746cc6e958c14e;p=android-x86%2Fsystem-bt.git Don't reject notifications and wait until new addressed player is ready (2/2) There are some carkits like the ones found in the 2016 Honda CRZ and some Audi's that do not follow the spec and do not honor reject pending notification messages after switching players. This causes an issue whenever you switch players, the metadata freezes due to the fact that the carkit never re-registers for new track changed notifications. This patch removes the reject notification and reorders the current notifications. Bug: 64142363 Test: Test with Audi S7 and 2016 Honda CRZ and see that switching players works TestTracker: 105391/3975 Change-Id: Iaec70863594e13217916ab740d529f526d27c2d1 (cherry picked from commit dd535e70c767fe214c1634b46618d0fb5ed4385d) --- diff --git a/btif/src/btif_rc.cc b/btif/src/btif_rc.cc index 9c8804a67..fc10b8b61 100644 --- a/btif/src/btif_rc.cc +++ b/btif/src/btif_rc.cc @@ -1861,32 +1861,6 @@ static bt_status_t get_element_attr_rsp(RawAddress* bd_addr, uint8_t num_attr, /*************************************************************************** * - * Function reject_pending_notification - * - * Description Utility function to reject a pending notification. When - * AddressedPlayer change is received, all pending - * notifications should be completed. - * - * Returns void - * - **************************************************************************/ -static void reject_pending_notification(btrc_event_id_t event_id, int idx) { - tAVRC_RESPONSE avrc_rsp; - memset(&(avrc_rsp.reg_notif), 0, sizeof(tAVRC_REG_NOTIF_RSP)); - - avrc_rsp.reg_notif.event_id = event_id; - avrc_rsp.reg_notif.pdu = AVRC_PDU_REGISTER_NOTIFICATION; - avrc_rsp.reg_notif.opcode = opcode_from_pdu(AVRC_PDU_REGISTER_NOTIFICATION); - avrc_rsp.reg_notif.status = AVRC_STS_ADDR_PLAYER_CHG; - BTIF_TRACE_WARNING("%s: Handling event ID: 0x%x", __func__, event_id); - - send_metamsg_rsp(&btif_rc_cb.rc_multi_cb[idx], -1, - btif_rc_cb.rc_multi_cb[idx].rc_notif[event_id - 1].label, - AVRC_RSP_REJ, &avrc_rsp); -} - -/*************************************************************************** - * * Function register_notification_rsp * * Description Response to the register notification request. @@ -1969,22 +1943,6 @@ static bt_status_t register_notification_rsp( ((type == BTRC_NOTIFICATION_TYPE_INTERIM) ? AVRC_CMD_NOTIF : AVRC_RSP_CHANGED), &avrc_rsp); - - /* if notification type is address player changed, then complete all player - * specific - * notifications with AV/C C-Type REJECTED with error code Addressed Player - * Changed. */ - if (event_id == BTRC_EVT_ADDR_PLAYER_CHANGE && - type == BTRC_NOTIFICATION_TYPE_CHANGED) { - /* array includes notifications to be completed on addressed player change - */ - btrc_event_id_t evt_id[] = { - BTRC_EVT_PLAY_STATUS_CHANGED, BTRC_EVT_TRACK_CHANGE, - BTRC_EVT_PLAY_POS_CHANGED, BTRC_EVT_NOW_PLAYING_CONTENT_CHANGED}; - for (uint8_t id = 0; id < sizeof(evt_id) / sizeof((evt_id)[0]); id++) { - reject_pending_notification(evt_id[id], idx); - } - } } return BT_STATUS_SUCCESS; }