diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-06-27 01:09:54 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-06-27 01:09:54 +0000 |
commit | da6f592006b3d3c548e353cdd239a30dfe7c3dff (patch) | |
tree | 05aca48a4ee5a77bba7d877950ff967d13e66d40 | |
parent | 249e88c335f860675ae33221879438be58165136 (diff) | |
parent | e059d4003cb7d4772ccf16f20ee6af30ee26a957 (diff) | |
download | native-da6f592006b3d3c548e353cdd239a30dfe7c3dff.tar.gz |
Snap for 6633916 from e059d4003cb7d4772ccf16f20ee6af30ee26a957 to rvc-d1-release
Change-Id: Ia2ea98f4851fd9e5b42c9307ab9f093fc16f0b5b
-rw-r--r-- | cmds/atrace/atrace.rc | 2 | ||||
-rw-r--r-- | libs/adbd_auth/adbd_auth.cpp | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/cmds/atrace/atrace.rc b/cmds/atrace/atrace.rc index 9b2f4a8861..f442dae66f 100644 --- a/cmds/atrace/atrace.rc +++ b/cmds/atrace/atrace.rc @@ -125,6 +125,8 @@ on late-init chmod 0666 /sys/kernel/tracing/events/task/task_rename/enable chmod 0666 /sys/kernel/debug/tracing/events/task/task_newtask/enable chmod 0666 /sys/kernel/tracing/events/task/task_newtask/enable + chmod 0666 /sys/kernel/debug/tracing/events/gpu_mem/gpu_mem_total/enable + chmod 0666 /sys/kernel/tracing/events/gpu_mem/gpu_mem_total/enable # disk chmod 0666 /sys/kernel/tracing/events/f2fs/f2fs_get_data_block/enable diff --git a/libs/adbd_auth/adbd_auth.cpp b/libs/adbd_auth/adbd_auth.cpp index 0e5d474612..dae6eebaa5 100644 --- a/libs/adbd_auth/adbd_auth.cpp +++ b/libs/adbd_auth/adbd_auth.cpp @@ -206,12 +206,18 @@ public: void AllowUsbDevice(std::string_view buf) EXCLUDES(mutex_) { std::lock_guard<std::mutex> lock(mutex_); CHECK(buf.empty()); - CHECK(dispatched_prompt_.has_value()); - auto& [id, key, arg] = *dispatched_prompt_; - keys_.emplace(id, std::move(key)); - callbacks_.key_authorized(arg, id); - dispatched_prompt_ = std::nullopt; + if (dispatched_prompt_.has_value()) { + // It's possible for the framework to send us a response without our having sent a + // request to it: e.g. if adbd restarts while we have a pending request. + auto& [id, key, arg] = *dispatched_prompt_; + keys_.emplace(id, std::move(key)); + + callbacks_.key_authorized(arg, id); + dispatched_prompt_ = std::nullopt; + } else { + LOG(WARNING) << "adbd_auth: received authorization for unknown prompt, ignoring"; + } // We need to dispatch pending prompts here upon success as well, // since we might have multiple queued prompts. |