diff options
| -rw-r--r-- | cmds/dumpstate/DumpstateService.cpp | 4 | ||||
| -rw-r--r-- | cmds/dumpstate/DumpstateService.h | 4 | ||||
| -rw-r--r-- | cmds/dumpstate/tests/dumpstate_smoke_test.cpp | 12 | ||||
| -rw-r--r-- | cmds/installd/InstalldNativeService.cpp | 2 | ||||
| -rw-r--r-- | cmds/installd/InstalldNativeService.h | 2 |
5 files changed, 14 insertions, 10 deletions
diff --git a/cmds/dumpstate/DumpstateService.cpp b/cmds/dumpstate/DumpstateService.cpp index f98df99534..10d3d1756b 100644 --- a/cmds/dumpstate/DumpstateService.cpp +++ b/cmds/dumpstate/DumpstateService.cpp @@ -115,8 +115,8 @@ binder::Status DumpstateService::setListener(const std::string& name, binder::Status DumpstateService::startBugreport(int32_t calling_uid, const std::string& calling_package, - const android::base::unique_fd& bugreport_fd, - const android::base::unique_fd& screenshot_fd, + android::base::unique_fd bugreport_fd, + android::base::unique_fd screenshot_fd, int bugreport_mode, const sp<IDumpstateListener>& listener) { MYLOGI("startBugreport() with mode: %d\n", bugreport_mode); diff --git a/cmds/dumpstate/DumpstateService.h b/cmds/dumpstate/DumpstateService.h index 68eda4763a..aaaa4286cc 100644 --- a/cmds/dumpstate/DumpstateService.h +++ b/cmds/dumpstate/DumpstateService.h @@ -43,8 +43,8 @@ class DumpstateService : public BinderService<DumpstateService>, public BnDumpst sp<IDumpstateToken>* returned_token) override; binder::Status startBugreport(int32_t calling_uid, const std::string& calling_package, - const android::base::unique_fd& bugreport_fd, - const android::base::unique_fd& screenshot_fd, int bugreport_mode, + android::base::unique_fd bugreport_fd, + android::base::unique_fd screenshot_fd, int bugreport_mode, const sp<IDumpstateListener>& listener) override; // No-op diff --git a/cmds/dumpstate/tests/dumpstate_smoke_test.cpp b/cmds/dumpstate/tests/dumpstate_smoke_test.cpp index 7e6f6f53e5..256dc055e1 100644 --- a/cmds/dumpstate/tests/dumpstate_smoke_test.cpp +++ b/cmds/dumpstate/tests/dumpstate_smoke_test.cpp @@ -449,7 +449,7 @@ TEST_F(DumpstateBinderTest, Baseline) { sp<DumpstateListener> listener(new DumpstateListener(dup(fileno(stdout)))); android::binder::Status status = - ds_binder->startBugreport(123, "com.dummy.package", bugreport_fd, screenshot_fd, + ds_binder->startBugreport(123, "com.dummy.package", std::move(bugreport_fd), std::move(screenshot_fd), Dumpstate::BugreportMode::BUGREPORT_INTERACTIVE, listener); // startBugreport is an async call. Verify binder call succeeded first, then wait till listener // gets expected callbacks. @@ -485,7 +485,7 @@ TEST_F(DumpstateBinderTest, ServiceDies_OnInvalidInput) { // Call startBugreport with bad arguments. sp<DumpstateListener> listener(new DumpstateListener(dup(fileno(stdout)))); android::binder::Status status = - ds_binder->startBugreport(123, "com.dummy.package", bugreport_fd, screenshot_fd, + ds_binder->startBugreport(123, "com.dummy.package", std::move(bugreport_fd), std::move(screenshot_fd), 2000, // invalid bugreport mode listener); EXPECT_EQ(listener->getErrorCode(), IDumpstateListener::BUGREPORT_ERROR_INVALID_INPUT); @@ -506,20 +506,24 @@ TEST_F(DumpstateBinderTest, SimultaneousBugreportsNotAllowed) { // Prepare arguments unique_fd bugreport_fd(OpenForWrite("/data/local/tmp/tmp.zip")); + unique_fd bugreport_fd2(dup(bugreport_fd.get())); unique_fd screenshot_fd(OpenForWrite("/data/local/tmp/tmp.png")); + unique_fd screenshot_fd2(dup(screenshot_fd.get())); EXPECT_NE(bugreport_fd.get(), -1); + EXPECT_NE(bugreport_fd2.get(), -1); EXPECT_NE(screenshot_fd.get(), -1); + EXPECT_NE(screenshot_fd2.get(), -1); sp<DumpstateListener> listener1(new DumpstateListener(dup(fileno(stdout)))); android::binder::Status status = - ds_binder->startBugreport(123, "com.dummy.package", bugreport_fd, screenshot_fd, + ds_binder->startBugreport(123, "com.dummy.package", std::move(bugreport_fd), std::move(screenshot_fd), Dumpstate::BugreportMode::BUGREPORT_INTERACTIVE, listener1); EXPECT_TRUE(status.isOk()); // try to make another call to startBugreport. This should fail. sp<DumpstateListener> listener2(new DumpstateListener(dup(fileno(stdout)))); - status = ds_binder->startBugreport(123, "com.dummy.package", bugreport_fd, screenshot_fd, + status = ds_binder->startBugreport(123, "com.dummy.package", std::move(bugreport_fd2), std::move(screenshot_fd2), Dumpstate::BugreportMode::BUGREPORT_INTERACTIVE, listener2); EXPECT_FALSE(status.isOk()); WaitTillExecutionComplete(listener2.get()); diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp index a6e4e4efb6..737c6c9582 100644 --- a/cmds/installd/InstalldNativeService.cpp +++ b/cmds/installd/InstalldNativeService.cpp @@ -2625,7 +2625,7 @@ struct fsverity_measurement { #endif binder::Status InstalldNativeService::installApkVerity(const std::string& filePath, - const ::android::base::unique_fd& verityInputAshmem, int32_t contentSize) { + android::base::unique_fd verityInputAshmem, int32_t contentSize) { ENFORCE_UID(AID_SYSTEM); CHECK_ARGUMENT_PATH(filePath); std::lock_guard<std::recursive_mutex> lock(mLock); diff --git a/cmds/installd/InstalldNativeService.h b/cmds/installd/InstalldNativeService.h index 2b7bf33cbc..149936dbaf 100644 --- a/cmds/installd/InstalldNativeService.h +++ b/cmds/installd/InstalldNativeService.h @@ -136,7 +136,7 @@ public: binder::Status deleteOdex(const std::string& apkPath, const std::string& instructionSet, const std::unique_ptr<std::string>& outputPath); binder::Status installApkVerity(const std::string& filePath, - const ::android::base::unique_fd& verityInput, int32_t contentSize); + android::base::unique_fd verityInput, int32_t contentSize); binder::Status assertFsverityRootHashMatches(const std::string& filePath, const std::vector<uint8_t>& expectedHash); binder::Status reconcileSecondaryDexFile(const std::string& dexPath, |