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
diff --git a/cmds/installd/dexopt.h b/cmds/installd/dexopt.h
index ef739ba..92b13c7 100644
--- a/cmds/installd/dexopt.h
+++ b/cmds/installd/dexopt.h
@@ -21,6 +21,8 @@
 
 #include <sys/types.h>
 
+#include <optional>
+
 #include <cutils/multiuser.h>
 
 namespace android {
@@ -98,17 +100,17 @@
                          appid_t app_id,
                          const std::string& profile_name,
                          const std::string& code_path,
-                         const std::unique_ptr<std::string>& dex_metadata);
+                         const std::optional<std::string>& dex_metadata);
 
 bool delete_odex(const char* apk_path, const char* instruction_set, const char* output_path);
 
 bool reconcile_secondary_dex_file(const std::string& dex_path,
         const std::string& pkgname, int uid, const std::vector<std::string>& isas,
-        const std::unique_ptr<std::string>& volumeUuid, int storage_flag,
+        const std::optional<std::string>& volumeUuid, int storage_flag,
         /*out*/bool* out_secondary_dex_exists);
 
 bool hash_secondary_dex_file(const std::string& dex_path,
-        const std::string& pkgname, int uid, const std::unique_ptr<std::string>& volume_uuid,
+        const std::string& pkgname, int uid, const std::optional<std::string>& volume_uuid,
         int storage_flag, std::vector<uint8_t>* out_secondary_dex_hash);
 
 int dexopt(const char *apk_path, uid_t uid, const char *pkgName, const char *instruction_set,