From 801c44115ecdee5511160f1837b514dd274f6a32 Mon Sep 17 00:00:00 2001 From: Yurii Zubrytskyi Date: Wed, 30 Nov 2022 16:47:23 -0800 Subject: [res] Properly create ZipAssetsProvider with fd Bug: 237583012 Test: atest com.android.overlaytest Change-Id: If79b4297edfcefe72bf579b50931a40f73bdfd58 --- libs/androidfw/ApkAssets.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) mode change 100755 => 100644 libs/androidfw/ApkAssets.cpp (limited to 'libs/androidfw/ApkAssets.cpp') diff --git a/libs/androidfw/ApkAssets.cpp b/libs/androidfw/ApkAssets.cpp old mode 100755 new mode 100644 index c0fa63a08fac..15aaae25f754 --- a/libs/androidfw/ApkAssets.cpp +++ b/libs/androidfw/ApkAssets.cpp @@ -18,6 +18,7 @@ #include "android-base/errors.h" #include "android-base/logging.h" +#include "android-base/utf8.h" namespace android { @@ -84,7 +85,7 @@ std::unique_ptr ApkAssets::LoadOverlay(const std::string& idmap_path, } std::string overlay_path(loaded_idmap->OverlayApkPath()); - auto fd = unique_fd(::open(overlay_path.c_str(), O_RDONLY|O_CLOEXEC)); + auto fd = unique_fd(base::utf8::open(overlay_path.c_str(), O_RDONLY | O_CLOEXEC)); std::unique_ptr overlay_assets; if (IsFabricatedOverlay(fd)) { // Fabricated overlays do not contain resource definitions. All of the overlay resource values @@ -92,7 +93,7 @@ std::unique_ptr ApkAssets::LoadOverlay(const std::string& idmap_path, overlay_assets = EmptyAssetsProvider::Create(std::move(overlay_path)); } else { // The overlay should be an APK. - overlay_assets = ZipAssetsProvider::Create(std::move(fd), std::move(overlay_path), flags); + overlay_assets = ZipAssetsProvider::Create(std::move(overlay_path), flags, std::move(fd)); } if (overlay_assets == nullptr) { return {}; -- cgit v1.2.3-59-g8ed1b