diff options
| author | 2019-01-15 06:19:49 -0800 | |
|---|---|---|
| committer | 2019-01-15 06:19:49 -0800 | |
| commit | 03eafcfd065ee0552db36ed569933e51c72b24e3 (patch) | |
| tree | c9ec6d6fa976e84ccc4f038ec7287c049ccda308 /cmds/dumpstate/DumpstateService.cpp | |
| parent | d5ea8f33633b1cbaadccc52626adf56e38dbc993 (diff) | |
| parent | bb45d3c3f4f43490ac5f700ecdb5a8028f0c5ac9 (diff) | |
Merge "Wire up new binder method arguments" am: 61cb76e711
am: bb45d3c3f4
Change-Id: I29b019d46df6a40f75145d3966d1fa324de8d33c
Diffstat (limited to 'cmds/dumpstate/DumpstateService.cpp')
| -rw-r--r-- | cmds/dumpstate/DumpstateService.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/cmds/dumpstate/DumpstateService.cpp b/cmds/dumpstate/DumpstateService.cpp index 909bdd7134..6596fa246c 100644 --- a/cmds/dumpstate/DumpstateService.cpp +++ b/cmds/dumpstate/DumpstateService.cpp @@ -98,11 +98,10 @@ binder::Status DumpstateService::setListener(const std::string& name, return binder::Status::ok(); } -binder::Status DumpstateService::startBugreport(const android::base::unique_fd& /* bugreportFd */, - const android::base::unique_fd& /* screenshotFd */, +binder::Status DumpstateService::startBugreport(const android::base::unique_fd& bugreport_fd, + const android::base::unique_fd& screenshot_fd, int bugreport_mode, - const sp<IDumpstateListener>& /* listener */) { - // TODO(b/111441001): Pass in fds & other arguments to DumpOptions. + const sp<IDumpstateListener>& listener) { MYLOGI("startBugreport() with mode: %d\n", bugreport_mode); if (bugreport_mode != Dumpstate::BugreportMode::BUGREPORT_FULL && @@ -116,9 +115,20 @@ binder::Status DumpstateService::startBugreport(const android::base::unique_fd& StringPrintf("Invalid bugreport mode: %d", bugreport_mode)); } + if (bugreport_fd.get() == -1 || screenshot_fd.get() == -1) { + return exception(binder::Status::EX_ILLEGAL_ARGUMENT, "Invalid file descriptor"); + } + std::unique_ptr<Dumpstate::DumpOptions> options = std::make_unique<Dumpstate::DumpOptions>(); - options->Initialize(static_cast<Dumpstate::BugreportMode>(bugreport_mode)); + options->Initialize(static_cast<Dumpstate::BugreportMode>(bugreport_mode), bugreport_fd, + screenshot_fd); + + std::lock_guard<std::mutex> lock(lock_); + // TODO(b/111441001): Disallow multiple simultaneous bugreports. ds_.SetOptions(std::move(options)); + if (listener != nullptr) { + ds_.listener_ = listener; + } pthread_t thread; status_t err = pthread_create(&thread, nullptr, callAndNotify, &ds_); |