Merge "Use optional for nullable types" into rvc-dev-plus-aosp

This commit is contained in:
Jooyung Han
2020-02-26 16:22:46 +00:00
committed by Android (Google) Code Review
3 changed files with 6 additions and 6 deletions

View File

@@ -113,10 +113,10 @@ Status Idmap2Service::verifyIdmap(const std::string& overlay_apk_path,
Status Idmap2Service::createIdmap(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, const std::string& overlay_apk_path, int32_t fulfilled_policies,
bool enforce_overlayable, int32_t user_id ATTRIBUTE_UNUSED, bool enforce_overlayable, int32_t user_id ATTRIBUTE_UNUSED,
std::unique_ptr<std::string>* _aidl_return) { std::optional<std::string>* _aidl_return) {
assert(_aidl_return); assert(_aidl_return);
SYSTRACE << "Idmap2Service::createIdmap " << target_apk_path << " " << overlay_apk_path; SYSTRACE << "Idmap2Service::createIdmap " << target_apk_path << " " << overlay_apk_path;
_aidl_return->reset(nullptr); _aidl_return->reset();
const PolicyBitmask policy_bitmask = ConvertAidlArgToPolicyBitmask(fulfilled_policies); const PolicyBitmask policy_bitmask = ConvertAidlArgToPolicyBitmask(fulfilled_policies);
@@ -155,7 +155,7 @@ Status Idmap2Service::createIdmap(const std::string& target_apk_path,
return error("failed to write to idmap path " + idmap_path); return error("failed to write to idmap path " + idmap_path);
} }
*_aidl_return = std::make_unique<std::string>(idmap_path); *_aidl_return = idmap_path;
return ok(); return ok();
} }

View File

@@ -20,7 +20,7 @@
#include <android-base/unique_fd.h> #include <android-base/unique_fd.h>
#include <binder/BinderService.h> #include <binder/BinderService.h>
#include <memory> #include <optional>
#include <string> #include <string>
#include "android/os/BnIdmap2.h" #include "android/os/BnIdmap2.h"
@@ -46,7 +46,7 @@ class Idmap2Service : public BinderService<Idmap2Service>, public BnIdmap2 {
binder::Status createIdmap(const std::string& target_apk_path, binder::Status createIdmap(const std::string& target_apk_path,
const std::string& overlay_apk_path, int32_t fulfilled_policies, const std::string& overlay_apk_path, int32_t fulfilled_policies,
bool enforce_overlayable, int32_t user_id, bool enforce_overlayable, int32_t user_id,
std::unique_ptr<std::string>* _aidl_return) override; std::optional<std::string>* _aidl_return) override;
}; };
} // namespace android::os } // namespace android::os

View File

@@ -1078,7 +1078,7 @@ bool IncrementalService::prepareDataLoader(IncrementalService::IncFsMount& ifs,
return false; return false;
} }
FileSystemControlParcel fsControlParcel; FileSystemControlParcel fsControlParcel;
fsControlParcel.incremental = std::make_unique<IncrementalFileSystemControlParcel>(); fsControlParcel.incremental = IncrementalFileSystemControlParcel();
fsControlParcel.incremental->cmd.reset(base::unique_fd(::dup(ifs.control.cmd))); fsControlParcel.incremental->cmd.reset(base::unique_fd(::dup(ifs.control.cmd)));
fsControlParcel.incremental->pendingReads.reset( fsControlParcel.incremental->pendingReads.reset(
base::unique_fd(::dup(ifs.control.pendingReads))); base::unique_fd(::dup(ifs.control.pendingReads)));