From 16bac8513e2f5be0fc8e7d7fe261b1756a0231d1 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Mon, 10 Aug 2020 12:53:14 +0900 Subject: [PATCH] Switch aidl::nullable to std::optional AIDL's @nullable is represented as std::optional in C++ backend. The previous aidl::nullable was a temporary solution to avoid merge-conflicts between rvc-dev and master branches. Bug: 151275535 Test: m Change-Id: I8fe5bfc1763087e7ff364b4408f862436492d1db --- cmds/idmap2/idmap2d/Idmap2Service.cpp | 4 ++-- cmds/idmap2/idmap2d/Idmap2Service.h | 3 +-- services/incremental/IncrementalService.cpp | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cmds/idmap2/idmap2d/Idmap2Service.cpp b/cmds/idmap2/idmap2d/Idmap2Service.cpp index a6c402ccc0750..15e22a3410cfa 100644 --- a/cmds/idmap2/idmap2d/Idmap2Service.cpp +++ b/cmds/idmap2/idmap2d/Idmap2Service.cpp @@ -166,7 +166,7 @@ Status Idmap2Service::verifyIdmap(const std::string& target_apk_path, Status Idmap2Service::createIdmap(const std::string& target_apk_path, const std::string& overlay_apk_path, int32_t fulfilled_policies, bool enforce_overlayable, int32_t user_id ATTRIBUTE_UNUSED, - aidl::nullable* _aidl_return) { + std::optional* _aidl_return) { assert(_aidl_return); SYSTRACE << "Idmap2Service::createIdmap " << target_apk_path << " " << overlay_apk_path; _aidl_return->reset(); @@ -214,7 +214,7 @@ Status Idmap2Service::createIdmap(const std::string& target_apk_path, return error("failed to write to idmap path " + idmap_path); } - *_aidl_return = aidl::make_nullable(idmap_path); + *_aidl_return = idmap_path; return ok(); } diff --git a/cmds/idmap2/idmap2d/Idmap2Service.h b/cmds/idmap2/idmap2d/Idmap2Service.h index 55fb5ad077819..abee999dd2b29 100644 --- a/cmds/idmap2/idmap2d/Idmap2Service.h +++ b/cmds/idmap2/idmap2d/Idmap2Service.h @@ -19,7 +19,6 @@ #include #include -#include #include "android/os/BnIdmap2.h" @@ -45,7 +44,7 @@ class Idmap2Service : public BinderService, public BnIdmap2 { binder::Status createIdmap(const std::string& target_apk_path, const std::string& overlay_apk_path, int32_t fulfilled_policies, bool enforce_overlayable, int32_t user_id, - aidl::nullable* _aidl_return) override; + std::optional* _aidl_return) override; private: // Cache the crc of the android framework package since the crc cannot change without a reboot. diff --git a/services/incremental/IncrementalService.cpp b/services/incremental/IncrementalService.cpp index a5f0d045948ca..f7082a9a1a0c6 100644 --- a/services/incremental/IncrementalService.cpp +++ b/services/incremental/IncrementalService.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -1404,7 +1403,7 @@ void IncrementalService::prepareDataLoaderLocked(IncFsMount& ifs, DataLoaderPara } FileSystemControlParcel fsControlParcel; - fsControlParcel.incremental = aidl::make_nullable(); + fsControlParcel.incremental = std::make_optional(); fsControlParcel.incremental->cmd.reset(dup(ifs.control.cmd())); fsControlParcel.incremental->pendingReads.reset(dup(ifs.control.pendingReads())); fsControlParcel.incremental->log.reset(dup(ifs.control.logs()));