diff options
author | 2022-08-19 16:34:26 +0000 | |
---|---|---|
committer | 2022-08-24 11:42:19 +0000 | |
commit | 499ecd35d37df8847813158a70315611154a8ec6 (patch) | |
tree | 39a1242c869f93cea252d069af9e5b4509b00b3a /tools/aapt2/dump | |
parent | 10a0a4a61bc9bae6311d9f3754692620f1805cb4 (diff) |
Fix achitectures and 'camera' component extraction in 'dump badging'.
Logic is synchronised with 'aapt':
* use 'android.media.*' intents for 'camera' component detection;
* use only 'lib/' under root to parse supported archs.
Bug: b/243145989
Test: Dump_test.cpp
Change-Id: I90fbe802a97a4382e3021b344d0c5e9708563389
Diffstat (limited to 'tools/aapt2/dump')
-rw-r--r-- | tools/aapt2/dump/DumpManifest.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/aapt2/dump/DumpManifest.cpp b/tools/aapt2/dump/DumpManifest.cpp index 39ac24b29f35..b3165d320e9b 100644 --- a/tools/aapt2/dump/DumpManifest.cpp +++ b/tools/aapt2/dump/DumpManifest.cpp @@ -1981,10 +1981,11 @@ class Action : public ManifestExtractor::Element { if (ElementCast<Activity>(parent_stack[1])) { // Detects the presence of a particular type of activity. Activity* activity = ElementCast<Activity>(parent_stack[1]); - auto map = std::map<std::string, std::string>({ - { "android.intent.action.MAIN" , "main" }, - { "android.intent.action.VIDEO_CAMERA" , "camera" }, - { "android.intent.action.STILL_IMAGE_CAMERA_SECURE" , "camera-secure" }, + static const auto map = std::map<std::string, std::string>({ + {"android.intent.action.MAIN", "main"}, + {"android.media.action.VIDEO_CAMERA", "camera"}, + {"android.media.action.STILL_IMAGE_CAMERA", "camera"}, + {"android.media.action.STILL_IMAGE_CAMERA_SECURE", "camera-secure"}, }); auto entry = map.find(action); @@ -2735,10 +2736,9 @@ bool ManifestExtractor::Extract(android::IDiagnostics* diag) { auto it = apk_->GetFileCollection()->Iterator(); while (it->HasNext()) { auto file_path = it->Next()->GetSource().path; - size_t pos = file_path.find("lib/"); - if (pos != std::string::npos) { - file_path = file_path.substr(pos + 4); - pos = file_path.find('/'); + 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); } |