summaryrefslogtreecommitdiff
path: root/libs/androidfw/ApkAssets.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/androidfw/ApkAssets.cpp')
-rw-r--r--libs/androidfw/ApkAssets.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/libs/androidfw/ApkAssets.cpp b/libs/androidfw/ApkAssets.cpp
index 55f4c3ce6e76..9a08f638f230 100644
--- a/libs/androidfw/ApkAssets.cpp
+++ b/libs/androidfw/ApkAssets.cpp
@@ -28,7 +28,16 @@
namespace android {
std::unique_ptr<ApkAssets> ApkAssets::Load(const std::string& path) {
- ATRACE_NAME("ApkAssets::Load");
+ return ApkAssets::LoadImpl(path, false /*load_as_shared_library*/);
+}
+
+std::unique_ptr<ApkAssets> ApkAssets::LoadAsSharedLibrary(const std::string& path) {
+ return ApkAssets::LoadImpl(path, true /*load_as_shared_library*/);
+}
+
+std::unique_ptr<ApkAssets> ApkAssets::LoadImpl(const std::string& path,
+ bool load_as_shared_library) {
+ ATRACE_CALL();
::ZipArchiveHandle unmanaged_handle;
int32_t result = ::OpenArchive(path.c_str(), &unmanaged_handle);
if (result != 0) {
@@ -61,7 +70,7 @@ std::unique_ptr<ApkAssets> ApkAssets::Load(const std::string& path) {
loaded_apk->path_ = path;
loaded_apk->loaded_arsc_ =
LoadedArsc::Load(loaded_apk->resources_asset_->getBuffer(true /*wordAligned*/),
- loaded_apk->resources_asset_->getLength());
+ loaded_apk->resources_asset_->getLength(), load_as_shared_library);
if (loaded_apk->loaded_arsc_ == nullptr) {
return {};
}