[nit] Clean up the resource resolution debugging

- Better struct memory layout
- Get rid of unneeded unordered_map

Bug: n/a
Test: builds
Change-Id: I3c7d8d99bff5aa35621b61956a0fd2f5a7a48aa3
diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp
index 68f5e4a..bc46cf5 100644
--- a/libs/androidfw/AssetManager2.cpp
+++ b/libs/androidfw/AssetManager2.cpp
@@ -632,7 +632,7 @@
 
         if (UNLIKELY(logging_enabled)) {
           last_resolution_.steps.push_back(
-              Resolution::Step{Resolution::Step::Type::OVERLAID_INLINE, String8(), result->cookie});
+              Resolution::Step{Resolution::Step::Type::OVERLAID_INLINE, result->cookie, String8()});
           if (auto path = apk_assets_[result->cookie]->GetPath()) {
             const std::string overlay_path = path->data();
             if (IsFabricatedOverlay(overlay_path)) {
@@ -682,8 +682,8 @@
 
       if (UNLIKELY(logging_enabled)) {
         last_resolution_.steps.push_back(
-            Resolution::Step{Resolution::Step::Type::OVERLAID, overlay_result->config.toString(),
-                             overlay_result->cookie});
+            Resolution::Step{Resolution::Step::Type::OVERLAID, overlay_result->cookie,
+                             overlay_result->config.toString()});
         last_resolution_.best_package_name =
             overlay_result->package_name->c_str();
         overlaid = true;
@@ -769,8 +769,7 @@
       } else {
         if (UNLIKELY(logging_enabled)) {
           last_resolution_.steps.push_back(Resolution::Step{Resolution::Step::Type::SKIPPED,
-                                                      this_config.toString(),
-                                                      cookie});
+                                                            cookie, this_config.toString()});
         }
         continue;
       }
@@ -786,8 +785,7 @@
       if (!offset.has_value()) {
         if (UNLIKELY(logging_enabled)) {
           last_resolution_.steps.push_back(Resolution::Step{Resolution::Step::Type::NO_ENTRY,
-                                                      this_config.toString(),
-                                                      cookie});
+                                                            cookie, this_config.toString()});
         }
         continue;
       }
@@ -800,8 +798,7 @@
 
       if (UNLIKELY(logging_enabled)) {
         last_resolution_.steps.push_back(Resolution::Step{resolution_type,
-                                                          this_config.toString(),
-                                                          cookie});
+                                                          cookie, this_config.toString()});
       }
 
       // Any configuration will suffice, so break.
@@ -839,13 +836,7 @@
 }
 
 void AssetManager2::ResetResourceResolution() const {
-  last_resolution_.cookie = kInvalidCookie;
-  last_resolution_.resid = 0;
-  last_resolution_.steps.clear();
-  last_resolution_.type_string_ref = StringPoolRef();
-  last_resolution_.entry_string_ref = StringPoolRef();
-  last_resolution_.best_config_name.clear();
-  last_resolution_.best_package_name.clear();
+  last_resolution_ = Resolution{};
 }
 
 void AssetManager2::SetResourceResolutionLoggingEnabled(bool enabled) {
@@ -885,21 +876,21 @@
                                    configuration_.toString().c_str());
 
   for (const Resolution::Step& step : last_resolution_.steps) {
-    const static std::unordered_map<Resolution::Step::Type, const char*> kStepStrings = {
-        {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"}
+    constexpr static std::array kStepStrings = {
+        "Found initial",
+        "Found better",
+        "Overlaid",
+        "Overlaid inline",
+        "Skipped",
+        "No entry"
     };
 
-    const auto prefix = kStepStrings.find(step.type);
-    if (prefix == kStepStrings.end()) {
+    if (step.type < Resolution::Step::Type::INITIAL
+        || step.type > Resolution::Step::Type::NO_ENTRY) {
       continue;
     }
-
-    log_stream << "\n\t" << prefix->second << ": " << apk_assets_[step.cookie]->GetDebugName();
+    const auto prefix = kStepStrings[int(step.type) - int(Resolution::Step::Type::INITIAL)];
+    log_stream << "\n\t" << prefix << ": " << apk_assets_[step.cookie]->GetDebugName();
     if (!step.config_name.isEmpty()) {
       log_stream << " - " << step.config_name;
     }
diff --git a/libs/androidfw/include/androidfw/AssetManager2.h b/libs/androidfw/include/androidfw/AssetManager2.h
index f10cb9b..c116240 100644
--- a/libs/androidfw/include/androidfw/AssetManager2.h
+++ b/libs/androidfw/include/androidfw/AssetManager2.h
@@ -463,10 +463,10 @@
       // Marks what kind of override this step was.
       Type type;
 
+      ApkAssetsCookie cookie = kInvalidCookie;
+
       // Built name of configuration for this step.
       String8 config_name;
-
-      ApkAssetsCookie cookie = kInvalidCookie;
     };
 
     // Last resolved resource ID.