diff options
Diffstat (limited to 'tools/aapt2/dump')
-rw-r--r-- | tools/aapt2/dump/DumpManifest.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/tools/aapt2/dump/DumpManifest.cpp b/tools/aapt2/dump/DumpManifest.cpp index d1957fb30cb9..c66f4e5b7c30 100644 --- a/tools/aapt2/dump/DumpManifest.cpp +++ b/tools/aapt2/dump/DumpManifest.cpp @@ -16,6 +16,8 @@ #include "DumpManifest.h" +#include <androidfw/ApkParsing.h> + #include <algorithm> #include <array> #include <memory> @@ -2729,19 +2731,25 @@ bool ManifestExtractor::Extract(android::IDiagnostics* diag) { })); supports_screen_ = screen ? screen : &default_screens; + bool has_renderscript_bitcode = false; + auto it = apk_->GetFileCollection()->Iterator(); + while (it->HasNext()) { + if (it->Next()->GetSource().path.ends_with(".bc")) { + has_renderscript_bitcode = true; + break; + } + } + // Gather the supported architectures_ of the app std::set<std::string> architectures_from_apk; - auto it = apk_->GetFileCollection()->Iterator(); + it = apk_->GetFileCollection()->Iterator(); while (it->HasNext()) { - auto file_path = it->Next()->GetSource().path; - if (file_path.starts_with("lib/")) { - file_path = file_path.substr(4); - size_t pos = file_path.find('/'); - if (pos != std::string::npos) { - file_path = file_path.substr(0, pos); - } + auto file_path = it->Next()->GetSource().path.c_str(); - architectures_from_apk.insert(file_path); + const char* last_slash = + android::util::ValidLibraryPathLastSlash(file_path, has_renderscript_bitcode, false); + if (last_slash) { + architectures_from_apk.insert(std::string(file_path + APK_LIB_LEN, last_slash)); } } |