summaryrefslogtreecommitdiff
path: root/libs/binder/IAppOpsService.cpp
diff options
context:
space:
mode:
author Jooyung Han <jooyung@google.com> 2020-01-23 12:45:10 +0900
committer Jooyung Han <jooyung@google.com> 2020-02-27 03:05:50 +0000
commit9fcc4ef9bbf746b7551a51c8b62cd4f8c8b4551c (patch)
tree4cb5cc80282c51d145dfed4fcca77206a20064c4 /libs/binder/IAppOpsService.cpp
parent61addf0da3ec9645c47279e11394d346f98093e5 (diff)
Use std::optional for @nullable (AIDL)
Previously, nullable types were mapped to std::unique_ptr for C++ backend. But std::unique_ptr typically involves unnecessary alloc/dealloc. For example, if nullable string is represented in unique_ptr<string>, we should do "unique_ptr<string>(new string(value))" to set a value. To avoid breaking all hand-written parcelables, only new read/write functions are added to Parcel class and they are used only by aidl-generated code and their implementations. Bug: 144773267 Test: build/flash/boot atest --test-mapping frameworks/native/libs/binder Merged-In: I2c801e3b69f2f8ccf44267f15cbf79e1d8fbf19e Change-Id: I2c801e3b69f2f8ccf44267f15cbf79e1d8fbf19e (cherry picked from commit 1e1c5fbbbe8a76150fe832c8f974cbd543aa0860) Exempt-From-Owner-Approval: CP from master
Diffstat (limited to 'libs/binder/IAppOpsService.cpp')
-rw-r--r--libs/binder/IAppOpsService.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libs/binder/IAppOpsService.cpp b/libs/binder/IAppOpsService.cpp
index b2bd9e50b0..e5f0a11aa0 100644
--- a/libs/binder/IAppOpsService.cpp
+++ b/libs/binder/IAppOpsService.cpp
@@ -22,6 +22,8 @@
#include <binder/Parcel.h>
#include <utils/String8.h>
+#include <optional>
+
namespace android {
// ----------------------------------------------------------------------