Remove no-op setListener method from dumpstate listener
Bugreports using Bugreport API flow is stable, remove unused
legacy flow method: setListener.
* Remove DumpstateToken as it was only used by setListener.
* Remove listener_name_ and report_section_
Bug: 136066578
Test: Build and flash. Takes bugreport as expected.
Test: atest dumpstate_test
Test: `adb bugreport` works as expected.
Change-Id: I31d1795fa91275091950320c71f4cf085895e4e0
diff --git a/cmds/dumpstate/DumpstateService.cpp b/cmds/dumpstate/DumpstateService.cpp
index f98df99..2c845e6 100644
--- a/cmds/dumpstate/DumpstateService.cpp
+++ b/cmds/dumpstate/DumpstateService.cpp
@@ -58,8 +58,6 @@
exit(0);
}
-class DumpstateToken : public BnDumpstateToken {};
-
} // namespace
DumpstateService::DumpstateService() : ds_(nullptr) {
@@ -81,38 +79,6 @@
return android::OK;
}
-// Note: this method is part of the old flow and is not expected to be used in combination
-// with startBugreport.
-binder::Status DumpstateService::setListener(const std::string& name,
- const sp<IDumpstateListener>& listener,
- bool getSectionDetails,
- sp<IDumpstateToken>* returned_token) {
- *returned_token = nullptr;
- if (name.empty()) {
- MYLOGE("setListener(): name not set\n");
- return binder::Status::ok();
- }
- if (listener == nullptr) {
- MYLOGE("setListener(): listener not set\n");
- return binder::Status::ok();
- }
- std::lock_guard<std::mutex> lock(lock_);
- if (ds_ == nullptr) {
- ds_ = &(Dumpstate::GetInstance());
- }
- if (ds_->listener_ != nullptr) {
- MYLOGE("setListener(%s): already set (%s)\n", name.c_str(), ds_->listener_name_.c_str());
- return binder::Status::ok();
- }
-
- ds_->listener_name_ = name;
- ds_->listener_ = listener;
- ds_->report_section_ = getSectionDetails;
- *returned_token = new DumpstateToken();
-
- return binder::Status::ok();
-}
-
binder::Status DumpstateService::startBugreport(int32_t calling_uid,
const std::string& calling_package,
const android::base::unique_fd& bugreport_fd,
@@ -121,8 +87,7 @@
const sp<IDumpstateListener>& listener) {
MYLOGI("startBugreport() with mode: %d\n", bugreport_mode);
- // This is the bugreporting API flow, so ensure there is only one bugreport in progress at a
- // time.
+ // Ensure there is only one bugreport in progress at a time.
std::lock_guard<std::mutex> lock(lock_);
if (ds_ != nullptr) {
MYLOGE("Error! There is already a bugreport in progress. Returning.");
@@ -216,7 +181,6 @@
dprintf(fd, "name: %s\n", ds_->name_.c_str());
dprintf(fd, "now: %ld\n", ds_->now_);
dprintf(fd, "is_zipping: %s\n", ds_->IsZipping() ? "true" : "false");
- dprintf(fd, "listener: %s\n", ds_->listener_name_.c_str());
dprintf(fd, "notification title: %s\n", ds_->options_->notification_title.c_str());
dprintf(fd, "notification description: %s\n", ds_->options_->notification_description.c_str());