From bdc0ae12471f1a4a4cae8adbbf83f33a0f3e4ea9 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Mon, 1 Mar 2021 15:18:15 -0800 Subject: Set ApkAssets path for fabricated rros Fabricated RROs do not provide assets but are stored on disk. Ensure that the path to the frro is returned when querying for the ApkAssets path (which is mostly for debug purposes). Bug: 181338216 Test: enable frro, use cmd overlay lookup to see path in resolution Change-Id: Ibf9b1bf0a995325affbf084c71b1e87c5682e734 --- libs/androidfw/AssetManager2.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'libs/androidfw/AssetManager2.cpp') diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp index 7e45f952d389..237effeed889 100644 --- a/libs/androidfw/AssetManager2.cpp +++ b/libs/androidfw/AssetManager2.cpp @@ -602,6 +602,11 @@ base::expected AssetManager2::FindEntry( result->entry = overlay_entry.GetInlineValue(); result->dynamic_ref_table = id_map.overlay_res_maps_.GetOverlayDynamicRefTable(); result->cookie = id_map.cookie; + + if (UNLIKELY(logging_enabled)) { + last_resolution_.steps.push_back( + Resolution::Step{Resolution::Step::Type::OVERLAID_INLINE, String8(), result->cookie}); + } continue; } @@ -630,7 +635,6 @@ base::expected AssetManager2::FindEntry( if (UNLIKELY(logging_enabled)) { last_resolution_.steps.push_back( Resolution::Step{Resolution::Step::Type::OVERLAID, overlay_result->config.toString(), - overlay_result->package_name, overlay_result->cookie}); } } @@ -713,7 +717,6 @@ base::expected AssetManager2::FindEntryInternal( if (UNLIKELY(logging_enabled)) { resolution_steps.push_back(Resolution::Step{Resolution::Step::Type::SKIPPED, this_config.toString(), - &loaded_package->GetPackageName(), cookie}); } continue; @@ -731,7 +734,6 @@ base::expected AssetManager2::FindEntryInternal( if (UNLIKELY(logging_enabled)) { resolution_steps.push_back(Resolution::Step{Resolution::Step::Type::NO_ENTRY, this_config.toString(), - &loaded_package->GetPackageName(), cookie}); } continue; @@ -746,7 +748,6 @@ base::expected AssetManager2::FindEntryInternal( if (UNLIKELY(logging_enabled)) { last_resolution_.steps.push_back(Resolution::Step{resolution_type, this_config.toString(), - &loaded_package->GetPackageName(), cookie}); } @@ -829,18 +830,18 @@ std::string AssetManager2::GetLastResourceResolution() const { } std::stringstream log_stream; - log_stream << base::StringPrintf("Resolution for 0x%08x ", resid) - << resource_name_string - << "\n\tFor config -" - << configuration_.toString(); + log_stream << base::StringPrintf("Resolution for 0x%08x %s\n" + "\tFor config - %s", resid, resource_name_string.c_str(), + configuration_.toString().c_str()); for (const Resolution::Step& step : last_resolution_.steps) { const static std::unordered_map kStepStrings = { - {Resolution::Step::Type::INITIAL, "Found initial"}, - {Resolution::Step::Type::BETTER_MATCH, "Found better"}, - {Resolution::Step::Type::OVERLAID, "Overlaid"}, - {Resolution::Step::Type::SKIPPED, "Skipped"}, - {Resolution::Step::Type::NO_ENTRY, "No entry"} + {Resolution::Step::Type::INITIAL, "Found initial"}, + {Resolution::Step::Type::BETTER_MATCH, "Found better"}, + {Resolution::Step::Type::OVERLAID, "Overlaid"}, + {Resolution::Step::Type::OVERLAID_INLINE, "Overlaid inline"}, + {Resolution::Step::Type::SKIPPED, "Skipped"}, + {Resolution::Step::Type::NO_ENTRY, "No entry"} }; const auto prefix = kStepStrings.find(step.type); @@ -848,10 +849,9 @@ std::string AssetManager2::GetLastResourceResolution() const { continue; } - log_stream << "\n\t" << prefix->second << ": " << *step.package_name << " (" - << apk_assets_[step.cookie]->GetDebugName() << ")"; + log_stream << "\n\t" << prefix->second << ": " << apk_assets_[step.cookie]->GetDebugName(); if (!step.config_name.isEmpty()) { - log_stream << " -" << step.config_name; + log_stream << " - " << step.config_name; } } -- cgit v1.2.3-59-g8ed1b