Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31ab4671 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7256110 from bed56d94 to sc-release

Change-Id: If0e97a5bb421b6f27592568bda3e137105bbccab
parents 251e6a31 bed56d94
Loading
Loading
Loading
Loading
+1 −24
Original line number Diff line number Diff line
@@ -36,20 +36,8 @@ namespace avrcp {
AvrcpService* AvrcpService::instance_ = nullptr;
AvrcpService::ServiceInterfaceImpl* AvrcpService::service_interface_ = nullptr;

std::mutex jni_mutex_;
btbase::AbstractMessageLoop* jni_message_loop_ = nullptr;
base::CancelableTaskTracker task_tracker_;

void do_in_avrcp_jni(const base::Closure& task) {
  std::lock_guard<std::mutex> lock(jni_mutex_);

  if (jni_message_loop_ == nullptr) {
    LOG(WARNING) << __func__ << ": jni_message_loop_ is null";
    return;
  }

  task_tracker_.PostTask(jni_message_loop_->task_runner().get(), FROM_HERE,
                         task);
  do_in_jni_thread(FROM_HERE, task);
}

class A2dpInterfaceImpl : public A2dpInterface {
@@ -466,11 +454,6 @@ void AvrcpService::ServiceInterfaceImpl::Init(
  CHECK(instance_ == nullptr);
  instance_ = new AvrcpService();

  {
    std::lock_guard<std::mutex> jni_lock(jni_mutex_);
    jni_message_loop_ = get_jni_message_loop();
  }

  do_in_main_thread(FROM_HERE,
                    base::Bind(&AvrcpService::Init, base::Unretained(instance_),
                               media_interface, volume_interface));
@@ -522,12 +505,6 @@ bool AvrcpService::ServiceInterfaceImpl::Cleanup() {

  if (instance_ == nullptr) return false;

  {
    std::lock_guard<std::mutex> jni_lock(jni_mutex_);
    task_tracker_.TryCancelAll();
    jni_message_loop_ = nullptr;
  }

  do_in_main_thread(FROM_HERE,
                    base::Bind(&AvrcpService::Cleanup, base::Owned(instance_)));

+1 −2
Original line number Diff line number Diff line
@@ -54,8 +54,7 @@ class OnceClosure {
  }

  void Run() const {
    base::SequencedTaskRunnerHandle::Get()->PostTask(
        FROM_HERE, std::move(*closure_));
    std::move(*closure_).Run();
    delete closure_;
    ((OnceClosure*)this)->closure_ = nullptr;
  }
+7 −0
Original line number Diff line number Diff line
@@ -428,12 +428,19 @@ static tAVRC_STS avrc_pars_browse_rsp(tAVRC_MSG_BROWSE* p_msg,
    case AVRC_PDU_GET_ITEM_ATTRIBUTES: {
      tAVRC_GET_ATTRS_RSP* get_attr_rsp = &(p_rsp->get_attrs);
      get_attr_rsp->pdu = pdu;
      min_len += 2;
      if (pkt_len < min_len) {
        android_errorWriteLog(0x534e4554, "179162665");
        goto browse_length_error;
      }
      BE_STREAM_TO_UINT8(get_attr_rsp->status, p)
      BE_STREAM_TO_UINT8(get_attr_rsp->num_attrs, p);
      get_attr_rsp->p_attrs = (tAVRC_ATTR_ENTRY*)osi_malloc(
          get_attr_rsp->num_attrs * sizeof(tAVRC_ATTR_ENTRY));
      for (int i = 0; i < get_attr_rsp->num_attrs; i++) {
        tAVRC_ATTR_ENTRY* attr_entry = &(get_attr_rsp->p_attrs[i]);
        min_len += 8;
        if (pkt_len < min_len) goto browse_length_error;
        BE_STREAM_TO_UINT32(attr_entry->attr_id, p);
        BE_STREAM_TO_UINT16(attr_entry->name.charset_id, p);
        BE_STREAM_TO_UINT16(attr_entry->name.str_len, p);
+4 −3
Original line number Diff line number Diff line
@@ -73,9 +73,10 @@ static void rfc_mx_conf_cnf(tRFC_MCB* p_mcb, uint16_t result);
void rfc_mx_sm_execute(tRFC_MCB* p_mcb, uint16_t event, void* p_data) {
  CHECK(p_mcb != nullptr) << __func__ << ": NULL mcb for event " << event;

  LOG_DEBUG("RFCOMM peer:%s event:%s state:%s", PRIVATE_ADDRESS(p_mcb->bd_addr),
            rfcomm_mx_state_text(static_cast<tRFC_MX_STATE>(event)).c_str(),
            std::to_string(p_mcb->state).c_str());
  LOG_DEBUG(
      "RFCOMM peer:%s event:%d state:%s", PRIVATE_ADDRESS(p_mcb->bd_addr),
      event,
      rfcomm_mx_state_text(static_cast<tRFC_MX_STATE>(p_mcb->state)).c_str());

  switch (p_mcb->state) {
    case RFC_MX_STATE_IDLE: