summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jiyong Park <jiyong@google.com> 2019-11-25 11:03:38 +0900
committer Jiyong Park <jiyong@google.com> 2019-11-30 20:58:45 +0900
commitb8ba23418aa6868ec14e82c29311021e382a19bc (patch)
tree5da0e254ba6fd03803a9c30ec3b77be1a5bca283
parentc850bdbec58228e8f441133378158cf41d385718 (diff)
unique_fd is passed by value in AIDL interfaces
FileDescriptor type in AIDL was translated into const unique_fd& in C++. Now, it is unique_fd, i.e. passed by value, to make it easier to keep it beyond the scope of the call. Bug: 144943748 Test: m Change-Id: I2b87761401361f9cf96cdda070f26e70a5c6c935
-rw-r--r--cmds/incident/main.cpp4
-rw-r--r--cmds/incidentd/src/IncidentService.cpp4
-rw-r--r--cmds/incidentd/src/IncidentService.h4
3 files changed, 6 insertions, 6 deletions
diff --git a/cmds/incident/main.cpp b/cmds/incident/main.cpp
index 6c3d19715c2e..eb2b98a666b9 100644
--- a/cmds/incident/main.cpp
+++ b/cmds/incident/main.cpp
@@ -375,7 +375,7 @@ main(int argc, char** argv)
if (destination == DEST_STDOUT) {
// Call into the service
sp<StatusListener> listener(new StatusListener());
- status = service->reportIncidentToStream(args, listener, writeEnd);
+ status = service->reportIncidentToStream(args, listener, std::move(writeEnd));
if (!status.isOk()) {
fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().string());
@@ -388,7 +388,7 @@ main(int argc, char** argv)
} else if (destination == DEST_DUMPSTATE) {
// Call into the service
sp<StatusListener> listener(new StatusListener());
- status = service->reportIncidentToDumpstate(writeEnd, listener);
+ status = service->reportIncidentToDumpstate(std::move(writeEnd), listener);
if (!status.isOk()) {
fprintf(stderr, "reportIncident returned \"%s\"\n", status.toString8().string());
return 1;
diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp
index 999936bda1d3..cfd77c2357cd 100644
--- a/cmds/incidentd/src/IncidentService.cpp
+++ b/cmds/incidentd/src/IncidentService.cpp
@@ -279,7 +279,7 @@ Status IncidentService::reportIncident(const IncidentReportArgs& args) {
Status IncidentService::reportIncidentToStream(const IncidentReportArgs& args,
const sp<IIncidentReportStatusListener>& listener,
- const unique_fd& stream) {
+ unique_fd stream) {
IncidentReportArgs argsCopy(args);
// Streaming reports can not also be broadcast.
@@ -306,7 +306,7 @@ Status IncidentService::reportIncidentToStream(const IncidentReportArgs& args,
return Status::ok();
}
-Status IncidentService::reportIncidentToDumpstate(const unique_fd& stream,
+Status IncidentService::reportIncidentToDumpstate(unique_fd stream,
const sp<IIncidentReportStatusListener>& listener) {
uid_t caller = IPCThreadState::self()->getCallingUid();
if (caller != AID_ROOT && caller != AID_SHELL) {
diff --git a/cmds/incidentd/src/IncidentService.h b/cmds/incidentd/src/IncidentService.h
index fb013d0bf92d..b2c7f233e11b 100644
--- a/cmds/incidentd/src/IncidentService.h
+++ b/cmds/incidentd/src/IncidentService.h
@@ -121,9 +121,9 @@ public:
virtual Status reportIncidentToStream(const IncidentReportArgs& args,
const sp<IIncidentReportStatusListener>& listener,
- const unique_fd& stream);
+ unique_fd stream);
- virtual Status reportIncidentToDumpstate(const unique_fd& stream,
+ virtual Status reportIncidentToDumpstate(unique_fd stream,
const sp<IIncidentReportStatusListener>& listener);
virtual Status systemRunning();