diff --git a/libs/androidfw/tests/AssetManager2_bench.cpp b/libs/androidfw/tests/AssetManager2_bench.cpp
index c7ae618..437e147 100644
--- a/libs/androidfw/tests/AssetManager2_bench.cpp
+++ b/libs/androidfw/tests/AssetManager2_bench.cpp
@@ -139,13 +139,9 @@
   assets.SetApkAssets({apk.get()});
 
   while (state.KeepRunning()) {
-    auto bag = assets.GetBag(app::R::style::StyleTwo);
-    if (!bag.has_value()) {
-      state.SkipWithError("Failed to load get bag");
-      return;
-    }
-    const auto bag_end = end(*bag);
-    for (auto iter = begin(*bag); iter != bag_end; ++iter) {
+    const ResolvedBag* bag = assets.GetBag(app::R::style::StyleTwo);
+    const auto bag_end = end(bag);
+    for (auto iter = begin(bag); iter != bag_end; ++iter) {
       uint32_t key = iter->key;
       Res_value value = iter->value;
       benchmark::DoNotOptimize(key);
diff --git a/libs/androidfw/tests/AssetManager2_test.cpp b/libs/androidfw/tests/AssetManager2_test.cpp
index 3638ce1..8c255d1 100644
--- a/libs/androidfw/tests/AssetManager2_test.cpp
+++ b/libs/androidfw/tests/AssetManager2_test.cpp
@@ -108,18 +108,24 @@
   assetmanager.SetConfiguration(desired_config);
   assetmanager.SetApkAssets({basic_assets_.get()});
 
-  auto value = assetmanager.GetResource(basic::R::string::test1);
-  ASSERT_TRUE(value.has_value());
+  Res_value value;
+  ResTable_config selected_config;
+  uint32_t flags;
+
+  ApkAssetsCookie cookie =
+      assetmanager.GetResource(basic::R::string::test1, false /*may_be_bag*/,
+                               0 /*density_override*/, &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
 
   // Came from our ApkAssets.
-  EXPECT_EQ(0, value->cookie);
+  EXPECT_EQ(0, cookie);
 
   // It is the default config.
-  EXPECT_EQ(0, value->config.language[0]);
-  EXPECT_EQ(0, value->config.language[1]);
+  EXPECT_EQ(0, selected_config.language[0]);
+  EXPECT_EQ(0, selected_config.language[1]);
 
   // It is a string.
-  EXPECT_EQ(Res_value::TYPE_STRING, value->type);
+  EXPECT_EQ(Res_value::TYPE_STRING, value.dataType);
 }
 
 TEST_F(AssetManager2Test, FindsResourceFromMultipleApkAssets) {
@@ -132,18 +138,24 @@
   assetmanager.SetConfiguration(desired_config);
   assetmanager.SetApkAssets({basic_assets_.get(), basic_de_fr_assets_.get()});
 
-  auto value = assetmanager.GetResource(basic::R::string::test1);
-  ASSERT_TRUE(value.has_value());
+  Res_value value;
+  ResTable_config selected_config;
+  uint32_t flags;
+
+  ApkAssetsCookie cookie =
+      assetmanager.GetResource(basic::R::string::test1, false /*may_be_bag*/,
+                               0 /*density_override*/, &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
 
   // Came from our de_fr ApkAssets.
-  EXPECT_EQ(1, value->cookie);
+  EXPECT_EQ(1, cookie);
 
   // The configuration is German.
-  EXPECT_EQ('d', value->config.language[0]);
-  EXPECT_EQ('e', value->config.language[1]);
+  EXPECT_EQ('d', selected_config.language[0]);
+  EXPECT_EQ('e', selected_config.language[1]);
 
   // It is a string.
-  EXPECT_EQ(Res_value::TYPE_STRING, value->type);
+  EXPECT_EQ(Res_value::TYPE_STRING, value.dataType);
 }
 
 TEST_F(AssetManager2Test, FindsResourceFromSharedLibrary) {
@@ -154,35 +166,44 @@
   assetmanager.SetApkAssets(
       {lib_two_assets_.get(), lib_one_assets_.get(), libclient_assets_.get()});
 
-  auto value = assetmanager.GetResource(libclient::R::string::foo_one);
-  ASSERT_TRUE(value.has_value());
+  Res_value value;
+  ResTable_config selected_config;
+  uint32_t flags;
+
+  ApkAssetsCookie cookie =
+      assetmanager.GetResource(libclient::R::string::foo_one, false /*may_be_bag*/,
+                               0 /*density_override*/, &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
 
   // Reference comes from libclient.
-  EXPECT_EQ(2, value->cookie);
-  EXPECT_EQ(Res_value::TYPE_REFERENCE, value->type);
+  EXPECT_EQ(2, cookie);
+  EXPECT_EQ(Res_value::TYPE_REFERENCE, value.dataType);
 
   // Lookup the reference.
-  value = assetmanager.GetResource(value->data);
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(1, value->cookie);
-  EXPECT_EQ(Res_value::TYPE_STRING, value->type);
+  cookie = assetmanager.GetResource(value.data, false /* may_be_bag */, 0 /* density_override*/,
+                                    &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(1, cookie);
+  EXPECT_EQ(Res_value::TYPE_STRING, value.dataType);
   EXPECT_EQ(std::string("Foo from lib_one"),
-            GetStringFromPool(assetmanager.GetStringPoolForCookie(value->cookie), value->data));
+            GetStringFromPool(assetmanager.GetStringPoolForCookie(cookie), value.data));
 
-  value = assetmanager.GetResource(libclient::R::string::foo_two);
-  ASSERT_TRUE(value.has_value());
+  cookie = assetmanager.GetResource(libclient::R::string::foo_two, false /*may_be_bag*/,
+                                    0 /*density_override*/, &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
 
   // Reference comes from libclient.
-  EXPECT_EQ(2, value->cookie);
-  EXPECT_EQ(Res_value::TYPE_REFERENCE, value->type);
+  EXPECT_EQ(2, cookie);
+  EXPECT_EQ(Res_value::TYPE_REFERENCE, value.dataType);
 
   // Lookup the reference.
-  value = assetmanager.GetResource(value->data);
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(0, value->cookie);
-  EXPECT_EQ(Res_value::TYPE_STRING, value->type);
+  cookie = assetmanager.GetResource(value.data, false /* may_be_bag */, 0 /* density_override*/,
+                                    &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(0, cookie);
+  EXPECT_EQ(Res_value::TYPE_STRING, value.dataType);
   EXPECT_EQ(std::string("Foo from lib_two"),
-            GetStringFromPool(assetmanager.GetStringPoolForCookie(value->cookie), value->data));
+            GetStringFromPool(assetmanager.GetStringPoolForCookie(cookie), value.data));
 }
 
 TEST_F(AssetManager2Test, FindsResourceFromAppLoadedAsSharedLibrary) {
@@ -190,10 +211,16 @@
   assetmanager.SetApkAssets({appaslib_assets_.get()});
 
   // The appaslib package will have been assigned the package ID 0x02.
-  auto value = assetmanager.GetResource(fix_package_id(appaslib::R::integer::number1, 0x02));
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(Res_value::TYPE_REFERENCE, value->type);
-  EXPECT_EQ(fix_package_id(appaslib::R::array::integerArray1, 0x02), value->data);
+
+  Res_value value;
+  ResTable_config selected_config;
+  uint32_t flags;
+  ApkAssetsCookie cookie = assetmanager.GetResource(
+      fix_package_id(appaslib::R::integer::number1, 0x02), false /*may_be_bag*/,
+      0u /*density_override*/, &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_REFERENCE, value.dataType);
+  EXPECT_EQ(fix_package_id(appaslib::R::array::integerArray1, 0x02), value.data);
 }
 
 TEST_F(AssetManager2Test, AssignsOverlayPackageIdLast) {
@@ -211,40 +238,40 @@
     return assetmanager.GetAssignedPackageId(apkAssets->GetLoadedArsc()->GetPackages()[0].get());
   };
 
-  ASSERT_EQ(0x7f, get_first_package_id(overlayable_assets_.get()));
-  ASSERT_EQ(0x03, get_first_package_id(overlay_assets_.get()));
-  ASSERT_EQ(0x02, get_first_package_id(lib_one_assets_.get()));
+  ASSERT_EQ(get_first_package_id(overlayable_assets_.get()), 0x7f);
+  ASSERT_EQ(get_first_package_id(overlay_assets_.get()), 0x03);
+  ASSERT_EQ(get_first_package_id(lib_one_assets_.get()), 0x02);
 }
 
 TEST_F(AssetManager2Test, GetSharedLibraryResourceName) {
   AssetManager2 assetmanager;
   assetmanager.SetApkAssets({lib_one_assets_.get()});
 
-  auto name = assetmanager.GetResourceName(lib_one::R::string::foo);
-  ASSERT_TRUE(name.has_value());
-  ASSERT_EQ("com.android.lib_one:string/foo", ToFormattedResourceString(*name));
+  AssetManager2::ResourceName name;
+  ASSERT_TRUE(assetmanager.GetResourceName(lib_one::R::string::foo, &name));
+  std::string formatted_name = ToFormattedResourceString(&name);
+  ASSERT_EQ(formatted_name, "com.android.lib_one:string/foo");
 }
 
 TEST_F(AssetManager2Test, FindsBagResourceFromSingleApkAssets) {
   AssetManager2 assetmanager;
   assetmanager.SetApkAssets({basic_assets_.get()});
 
-  auto bag = assetmanager.GetBag(basic::R::array::integerArray1);
-  ASSERT_TRUE(bag.has_value());
+  const ResolvedBag* bag = assetmanager.GetBag(basic::R::array::integerArray1);
+  ASSERT_NE(nullptr, bag);
+  ASSERT_EQ(3u, bag->entry_count);
 
-  ASSERT_EQ(3u, (*bag)->entry_count);
+  EXPECT_EQ(static_cast<uint8_t>(Res_value::TYPE_INT_DEC), bag->entries[0].value.dataType);
+  EXPECT_EQ(1u, bag->entries[0].value.data);
+  EXPECT_EQ(0, bag->entries[0].cookie);
 
-  EXPECT_EQ(static_cast<uint8_t>(Res_value::TYPE_INT_DEC), (*bag)->entries[0].value.dataType);
-  EXPECT_EQ(1u, (*bag)->entries[0].value.data);
-  EXPECT_EQ(0, (*bag)->entries[0].cookie);
+  EXPECT_EQ(static_cast<uint8_t>(Res_value::TYPE_INT_DEC), bag->entries[1].value.dataType);
+  EXPECT_EQ(2u, bag->entries[1].value.data);
+  EXPECT_EQ(0, bag->entries[1].cookie);
 
-  EXPECT_EQ(static_cast<uint8_t>(Res_value::TYPE_INT_DEC), (*bag)->entries[1].value.dataType);
-  EXPECT_EQ(2u, (*bag)->entries[1].value.data);
-  EXPECT_EQ(0, (*bag)->entries[1].cookie);
-
-  EXPECT_EQ(static_cast<uint8_t>(Res_value::TYPE_INT_DEC), (*bag)->entries[2].value.dataType);
-  EXPECT_EQ(3u, (*bag)->entries[2].value.data);
-  EXPECT_EQ(0, (*bag)->entries[2].cookie);
+  EXPECT_EQ(static_cast<uint8_t>(Res_value::TYPE_INT_DEC), bag->entries[2].value.dataType);
+  EXPECT_EQ(3u, bag->entries[2].value.data);
+  EXPECT_EQ(0, bag->entries[2].cookie);
 }
 
 TEST_F(AssetManager2Test, FindsBagResourceFromMultipleApkAssets) {}
@@ -257,16 +284,15 @@
   assetmanager.SetApkAssets(
       {lib_two_assets_.get(), lib_one_assets_.get(), libclient_assets_.get()});
 
-  auto bag = assetmanager.GetBag(fix_package_id(lib_one::R::style::Theme, 0x03));
-  ASSERT_TRUE(bag.has_value());
-
-  ASSERT_GE((*bag)->entry_count, 2u);
+  const ResolvedBag* bag = assetmanager.GetBag(fix_package_id(lib_one::R::style::Theme, 0x03));
+  ASSERT_NE(nullptr, bag);
+  ASSERT_GE(bag->entry_count, 2u);
 
   // First two attributes come from lib_one.
-  EXPECT_EQ(1, (*bag)->entries[0].cookie);
-  EXPECT_EQ(0x03, get_package_id((*bag)->entries[0].key));
-  EXPECT_EQ(1, (*bag)->entries[1].cookie);
-  EXPECT_EQ(0x03, get_package_id((*bag)->entries[1].key));
+  EXPECT_EQ(1, bag->entries[0].cookie);
+  EXPECT_EQ(0x03, get_package_id(bag->entries[0].key));
+  EXPECT_EQ(1, bag->entries[1].cookie);
+  EXPECT_EQ(0x03, get_package_id(bag->entries[1].key));
 }
 
 TEST_F(AssetManager2Test, FindsBagResourceFromMultipleSharedLibraries) {
@@ -277,17 +303,17 @@
   assetmanager.SetApkAssets(
       {lib_two_assets_.get(), lib_one_assets_.get(), libclient_assets_.get()});
 
-  auto bag = assetmanager.GetBag(libclient::R::style::ThemeMultiLib);
-  ASSERT_TRUE(bag.has_value());
-  ASSERT_EQ((*bag)->entry_count, 2u);
+  const ResolvedBag* bag = assetmanager.GetBag(libclient::R::style::ThemeMultiLib);
+  ASSERT_NE(nullptr, bag);
+  ASSERT_EQ(bag->entry_count, 2u);
 
   // First attribute comes from lib_two.
-  EXPECT_EQ(2, (*bag)->entries[0].cookie);
-  EXPECT_EQ(0x02, get_package_id((*bag)->entries[0].key));
+  EXPECT_EQ(2, bag->entries[0].cookie);
+  EXPECT_EQ(0x02, get_package_id(bag->entries[0].key));
 
   // The next two attributes come from lib_one.
-  EXPECT_EQ(2, (*bag)->entries[1].cookie);
-  EXPECT_EQ(0x03, get_package_id((*bag)->entries[1].key));
+  EXPECT_EQ(2, bag->entries[1].cookie);
+  EXPECT_EQ(0x03, get_package_id(bag->entries[1].key));
 }
 
 TEST_F(AssetManager2Test, FindsStyleResourceWithParentFromSharedLibrary) {
@@ -298,79 +324,79 @@
   assetmanager.SetApkAssets(
       {lib_two_assets_.get(), lib_one_assets_.get(), libclient_assets_.get()});
 
-  auto bag = assetmanager.GetBag(libclient::R::style::Theme);
-  ASSERT_TRUE(bag.has_value());
-  ASSERT_GE((*bag)->entry_count, 2u);
+  const ResolvedBag* bag = assetmanager.GetBag(libclient::R::style::Theme);
+  ASSERT_NE(nullptr, bag);
+  ASSERT_GE(bag->entry_count, 2u);
 
   // First two attributes come from lib_one.
-  EXPECT_EQ(1, (*bag)->entries[0].cookie);
-  EXPECT_EQ(0x03, get_package_id((*bag)->entries[0].key));
-  EXPECT_EQ(1, (*bag)->entries[1].cookie);
-  EXPECT_EQ(0x03, get_package_id((*bag)->entries[1].key));
+  EXPECT_EQ(1, bag->entries[0].cookie);
+  EXPECT_EQ(0x03, get_package_id(bag->entries[0].key));
+  EXPECT_EQ(1, bag->entries[1].cookie);
+  EXPECT_EQ(0x03, get_package_id(bag->entries[1].key));
 }
 
 TEST_F(AssetManager2Test, MergesStylesWithParentFromSingleApkAssets) {
   AssetManager2 assetmanager;
   assetmanager.SetApkAssets({style_assets_.get()});
 
-  auto bag_one = assetmanager.GetBag(app::R::style::StyleOne);
-  ASSERT_TRUE(bag_one.has_value());
-  ASSERT_EQ(2u, (*bag_one)->entry_count);
+  const ResolvedBag* bag_one = assetmanager.GetBag(app::R::style::StyleOne);
+  ASSERT_NE(nullptr, bag_one);
+  ASSERT_EQ(2u, bag_one->entry_count);
 
-  EXPECT_EQ(app::R::attr::attr_one, (*bag_one)->entries[0].key);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, (*bag_one)->entries[0].value.dataType);
-  EXPECT_EQ(1u, (*bag_one)->entries[0].value.data);
-  EXPECT_EQ(0, (*bag_one)->entries[0].cookie);
+  EXPECT_EQ(app::R::attr::attr_one, bag_one->entries[0].key);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, bag_one->entries[0].value.dataType);
+  EXPECT_EQ(1u, bag_one->entries[0].value.data);
+  EXPECT_EQ(0, bag_one->entries[0].cookie);
 
-  EXPECT_EQ(app::R::attr::attr_two, (*bag_one)->entries[1].key);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, (*bag_one)->entries[1].value.dataType);
-  EXPECT_EQ(2u, (*bag_one)->entries[1].value.data);
-  EXPECT_EQ(0, (*bag_one)->entries[1].cookie);
+  EXPECT_EQ(app::R::attr::attr_two, bag_one->entries[1].key);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, bag_one->entries[1].value.dataType);
+  EXPECT_EQ(2u, bag_one->entries[1].value.data);
+  EXPECT_EQ(0, bag_one->entries[1].cookie);
 
-  auto bag_two = assetmanager.GetBag(app::R::style::StyleTwo);
-  ASSERT_TRUE(bag_two.has_value());
-  ASSERT_EQ(6u, (*bag_two)->entry_count);
+  const ResolvedBag* bag_two = assetmanager.GetBag(app::R::style::StyleTwo);
+  ASSERT_NE(nullptr, bag_two);
+  ASSERT_EQ(6u, bag_two->entry_count);
 
   // attr_one is inherited from StyleOne.
-  EXPECT_EQ(app::R::attr::attr_one, (*bag_two)->entries[0].key);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, (*bag_two)->entries[0].value.dataType);
-  EXPECT_EQ(1u, (*bag_two)->entries[0].value.data);
-  EXPECT_EQ(0, (*bag_two)->entries[0].cookie);
-  EXPECT_EQ(app::R::style::StyleOne, (*bag_two)->entries[0].style);
+  EXPECT_EQ(app::R::attr::attr_one, bag_two->entries[0].key);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, bag_two->entries[0].value.dataType);
+  EXPECT_EQ(1u, bag_two->entries[0].value.data);
+  EXPECT_EQ(0, bag_two->entries[0].cookie);
+  EXPECT_EQ(app::R::style::StyleOne, bag_two->entries[0].style);
 
   // attr_two should be overridden from StyleOne by StyleTwo.
-  EXPECT_EQ(app::R::attr::attr_two, (*bag_two)->entries[1].key);
-  EXPECT_EQ(Res_value::TYPE_STRING, (*bag_two)->entries[1].value.dataType);
-  EXPECT_EQ(0, (*bag_two)->entries[1].cookie);
-  EXPECT_EQ(app::R::style::StyleTwo, (*bag_two)->entries[1].style);
+  EXPECT_EQ(app::R::attr::attr_two, bag_two->entries[1].key);
+  EXPECT_EQ(Res_value::TYPE_STRING, bag_two->entries[1].value.dataType);
+  EXPECT_EQ(0, bag_two->entries[1].cookie);
+  EXPECT_EQ(app::R::style::StyleTwo, bag_two->entries[1].style);
   EXPECT_EQ(std::string("string"), GetStringFromPool(assetmanager.GetStringPoolForCookie(0),
-                                                     (*bag_two)->entries[1].value.data));
+                                                     bag_two->entries[1].value.data));
 
   // The rest are new attributes.
 
-  EXPECT_EQ(app::R::attr::attr_three, (*bag_two)->entries[2].key);
-  EXPECT_EQ(Res_value::TYPE_ATTRIBUTE, (*bag_two)->entries[2].value.dataType);
-  EXPECT_EQ(app::R::attr::attr_indirect, (*bag_two)->entries[2].value.data);
-  EXPECT_EQ(0, (*bag_two)->entries[2].cookie);
-  EXPECT_EQ(app::R::style::StyleTwo, (*bag_two)->entries[2].style);
+  EXPECT_EQ(app::R::attr::attr_three, bag_two->entries[2].key);
+  EXPECT_EQ(Res_value::TYPE_ATTRIBUTE, bag_two->entries[2].value.dataType);
+  EXPECT_EQ(app::R::attr::attr_indirect, bag_two->entries[2].value.data);
+  EXPECT_EQ(0, bag_two->entries[2].cookie);
+  EXPECT_EQ(app::R::style::StyleTwo, bag_two->entries[2].style);
 
-  EXPECT_EQ(app::R::attr::attr_five, (*bag_two)->entries[3].key);
-  EXPECT_EQ(Res_value::TYPE_REFERENCE, (*bag_two)->entries[3].value.dataType);
-  EXPECT_EQ(app::R::string::string_one, (*bag_two)->entries[3].value.data);
-  EXPECT_EQ(0, (*bag_two)->entries[3].cookie);
-  EXPECT_EQ(app::R::style::StyleTwo, (*bag_two)->entries[3].style);
+  EXPECT_EQ(app::R::attr::attr_five, bag_two->entries[3].key);
+  EXPECT_EQ(Res_value::TYPE_REFERENCE, bag_two->entries[3].value.dataType);
+  EXPECT_EQ(app::R::string::string_one, bag_two->entries[3].value.data);
+  EXPECT_EQ(0, bag_two->entries[3].cookie);
+  EXPECT_EQ(app::R::style::StyleTwo, bag_two->entries[3].style);
 
-  EXPECT_EQ(app::R::attr::attr_indirect, (*bag_two)->entries[4].key);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, (*bag_two)->entries[4].value.dataType);
-  EXPECT_EQ(3u, (*bag_two)->entries[4].value.data);
-  EXPECT_EQ(0, (*bag_two)->entries[4].cookie);
-  EXPECT_EQ(app::R::style::StyleTwo, (*bag_two)->entries[4].style);
+  EXPECT_EQ(app::R::attr::attr_indirect, bag_two->entries[4].key);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, bag_two->entries[4].value.dataType);
+  EXPECT_EQ(3u, bag_two->entries[4].value.data);
+  EXPECT_EQ(0, bag_two->entries[4].cookie);
+  EXPECT_EQ(app::R::style::StyleTwo, bag_two->entries[4].style);
 
-  EXPECT_EQ(app::R::attr::attr_empty, (*bag_two)->entries[5].key);
-  EXPECT_EQ(Res_value::TYPE_NULL, (*bag_two)->entries[5].value.dataType);
-  EXPECT_EQ(Res_value::DATA_NULL_EMPTY, (*bag_two)->entries[5].value.data);
-  EXPECT_EQ(0, (*bag_two)->entries[5].cookie);
-  EXPECT_EQ(app::R::style::StyleTwo, (*bag_two)->entries[5].style);
+  EXPECT_EQ(app::R::attr::attr_empty, bag_two->entries[5].key);
+  EXPECT_EQ(Res_value::TYPE_NULL, bag_two->entries[5].value.dataType);
+  EXPECT_EQ(Res_value::DATA_NULL_EMPTY, bag_two->entries[5].value.data);
+  EXPECT_EQ(0, bag_two->entries[5].cookie);
+  EXPECT_EQ(app::R::style::StyleTwo, bag_two->entries[5].style);
 }
 
 TEST_F(AssetManager2Test, MergeStylesCircularDependency) {
@@ -379,41 +405,55 @@
 
   // GetBag should stop traversing the parents of styles when a circular
   // dependency is detected
-  auto bag = assetmanager.GetBag(app::R::style::StyleFour);
-  ASSERT_TRUE(bag.has_value());
-  ASSERT_EQ(3u, (*bag)->entry_count);
+  const ResolvedBag* bag_one = assetmanager.GetBag(app::R::style::StyleFour);
+  ASSERT_NE(nullptr, bag_one);
+  ASSERT_EQ(3u, bag_one->entry_count);
 }
 
 TEST_F(AssetManager2Test, ResolveReferenceToResource) {
   AssetManager2 assetmanager;
   assetmanager.SetApkAssets({basic_assets_.get()});
 
-  auto value = assetmanager.GetResource(basic::R::integer::ref1);
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(Res_value::TYPE_REFERENCE, value->type);
-  EXPECT_EQ(basic::R::integer::ref2, value->data);
+  Res_value value;
+  ResTable_config selected_config;
+  uint32_t flags;
+  ApkAssetsCookie cookie =
+      assetmanager.GetResource(basic::R::integer::ref1, false /*may_be_bag*/,
+                               0u /*density_override*/, &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
 
-  auto result = assetmanager.ResolveReference(*value);
-  ASSERT_TRUE(result.has_value());
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(12000u, value->data);
-  EXPECT_EQ(basic::R::integer::ref2, value->resid);
+  EXPECT_EQ(Res_value::TYPE_REFERENCE, value.dataType);
+  EXPECT_EQ(basic::R::integer::ref2, value.data);
+
+  uint32_t last_ref = 0u;
+  cookie = assetmanager.ResolveReference(cookie, &value, &selected_config, &flags, &last_ref);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(12000u, value.data);
+  EXPECT_EQ(basic::R::integer::ref2, last_ref);
 }
 
 TEST_F(AssetManager2Test, ResolveReferenceToBag) {
   AssetManager2 assetmanager;
   assetmanager.SetApkAssets({basic_assets_.get()});
 
-  auto value = assetmanager.GetResource(basic::R::integer::number2, true /*may_be_bag*/);
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(Res_value::TYPE_REFERENCE, value->type);
-  EXPECT_EQ(basic::R::array::integerArray1, value->data);
+  Res_value value;
+  ResTable_config selected_config;
+  uint32_t flags;
+  ApkAssetsCookie cookie =
+      assetmanager.GetResource(basic::R::integer::number2, true /*may_be_bag*/,
+                               0u /*density_override*/, &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
 
-  auto result = assetmanager.ResolveReference(*value);
-  ASSERT_TRUE(result.has_value());
-  EXPECT_EQ(Res_value::TYPE_REFERENCE, value->type);
-  EXPECT_EQ(basic::R::array::integerArray1, value->data);
-  EXPECT_EQ(basic::R::array::integerArray1, value->resid);
+  EXPECT_EQ(Res_value::TYPE_REFERENCE, value.dataType);
+  EXPECT_EQ(basic::R::array::integerArray1, value.data);
+
+  uint32_t last_ref = 0u;
+  cookie = assetmanager.ResolveReference(cookie, &value, &selected_config, &flags, &last_ref);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_REFERENCE, value.dataType);
+  EXPECT_EQ(basic::R::array::integerArray1, value.data);
+  EXPECT_EQ(basic::R::array::integerArray1, last_ref);
 }
 
 TEST_F(AssetManager2Test, ResolveDeepIdReference) {
@@ -421,25 +461,31 @@
   assetmanager.SetApkAssets({basic_assets_.get()});
 
   // Set up the resource ids
-  auto high_ref = assetmanager.GetResourceId("@id/high_ref", "values", "com.android.basic");
-  ASSERT_TRUE(high_ref.has_value());
-
-  auto middle_ref = assetmanager.GetResourceId("@id/middle_ref", "values", "com.android.basic");
-  ASSERT_TRUE(middle_ref.has_value());
-
-  auto low_ref = assetmanager.GetResourceId("@id/low_ref", "values", "com.android.basic");
-  ASSERT_TRUE(low_ref.has_value());
+  const uint32_t high_ref = assetmanager
+      .GetResourceId("@id/high_ref", "values", "com.android.basic");
+  ASSERT_NE(high_ref, 0u);
+  const uint32_t middle_ref = assetmanager
+      .GetResourceId("@id/middle_ref", "values", "com.android.basic");
+  ASSERT_NE(middle_ref, 0u);
+  const uint32_t low_ref = assetmanager
+      .GetResourceId("@id/low_ref", "values", "com.android.basic");
+  ASSERT_NE(low_ref, 0u);
 
   // Retrieve the most shallow resource
-  auto value = assetmanager.GetResource(*high_ref);
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(Res_value::TYPE_REFERENCE, value->type);
-  EXPECT_EQ(*middle_ref, value->data);;
+  Res_value value;
+  ResTable_config config;
+  uint32_t flags;
+  ApkAssetsCookie cookie = assetmanager.GetResource(high_ref, false /*may_be_bag*/,
+                                                    0 /*density_override*/,
+                                                    &value, &config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_REFERENCE, value.dataType);
+  EXPECT_EQ(middle_ref, value.data);
 
   // Check that resolving the reference resolves to the deepest id
-  auto result = assetmanager.ResolveReference(*value);
-  ASSERT_TRUE(result.has_value());
-  EXPECT_EQ(*low_ref, value->resid);
+  uint32_t last_ref = high_ref;
+  assetmanager.ResolveReference(cookie, &value, &config, &flags, &last_ref);
+  EXPECT_EQ(last_ref, low_ref);
 }
 
 TEST_F(AssetManager2Test, KeepLastReferenceIdUnmodifiedIfNoReferenceIsResolved) {
@@ -449,16 +495,16 @@
   ResTable_config selected_config;
   memset(&selected_config, 0, sizeof(selected_config));
 
-  // Create some kind of value that is NOT a reference.
-  AssetManager2::SelectedValue value{};
-  value.cookie = 1;
-  value.type = Res_value::TYPE_STRING;
-  value.resid = basic::R::string::test1;
+  uint32_t flags = 0u;
 
-  auto result = assetmanager.ResolveReference(value);
-  ASSERT_TRUE(result.has_value());
-  EXPECT_EQ(1, value.cookie);
-  EXPECT_EQ(basic::R::string::test1, value.resid);
+  // Create some kind of Res_value that is NOT a reference.
+  Res_value value;
+  value.dataType = Res_value::TYPE_STRING;
+  value.data = 0;
+
+  uint32_t last_ref = basic::R::string::test1;
+  EXPECT_EQ(1, assetmanager.ResolveReference(1, &value, &selected_config, &flags, &last_ref));
+  EXPECT_EQ(basic::R::string::test1, last_ref);
 }
 
 static bool IsConfigurationPresent(const std::set<ResTable_config>& configurations,
@@ -470,45 +516,43 @@
   AssetManager2 assetmanager;
   assetmanager.SetApkAssets({system_assets_.get(), basic_de_fr_assets_.get()});
 
-  auto configurations = assetmanager.GetResourceConfigurations();
-  ASSERT_TRUE(configurations.has_value());
+  std::set<ResTable_config> configurations = assetmanager.GetResourceConfigurations();
 
   // We expect the locale sv from the system assets, and de and fr from basic_de_fr assets.
   // And one extra for the default configuration.
-  EXPECT_EQ(4u, configurations->size());
+  EXPECT_EQ(4u, configurations.size());
 
   ResTable_config expected_config;
   memset(&expected_config, 0, sizeof(expected_config));
   expected_config.language[0] = 's';
   expected_config.language[1] = 'v';
-  EXPECT_TRUE(IsConfigurationPresent(*configurations, expected_config));
+  EXPECT_TRUE(IsConfigurationPresent(configurations, expected_config));
 
   expected_config.language[0] = 'd';
   expected_config.language[1] = 'e';
-  EXPECT_TRUE(IsConfigurationPresent(*configurations, expected_config));
+  EXPECT_TRUE(IsConfigurationPresent(configurations, expected_config));
 
   expected_config.language[0] = 'f';
   expected_config.language[1] = 'r';
-  EXPECT_TRUE(IsConfigurationPresent(*configurations, expected_config));
+  EXPECT_TRUE(IsConfigurationPresent(configurations, expected_config));
 
   // Take out the system assets.
   configurations = assetmanager.GetResourceConfigurations(true /* exclude_system */);
-  ASSERT_TRUE(configurations.has_value());
 
   // We expect de and fr from basic_de_fr assets.
-  EXPECT_EQ(2u, configurations->size());
+  EXPECT_EQ(2u, configurations.size());
 
   expected_config.language[0] = 's';
   expected_config.language[1] = 'v';
-  EXPECT_FALSE(IsConfigurationPresent(*configurations, expected_config));
+  EXPECT_FALSE(IsConfigurationPresent(configurations, expected_config));
 
   expected_config.language[0] = 'd';
   expected_config.language[1] = 'e';
-  EXPECT_TRUE(IsConfigurationPresent(*configurations, expected_config));
+  EXPECT_TRUE(IsConfigurationPresent(configurations, expected_config));
 
   expected_config.language[0] = 'f';
   expected_config.language[1] = 'r';
-  EXPECT_TRUE(IsConfigurationPresent(*configurations, expected_config));
+  EXPECT_TRUE(IsConfigurationPresent(configurations, expected_config));
 }
 
 TEST_F(AssetManager2Test, GetResourceLocales) {
@@ -534,17 +578,12 @@
   AssetManager2 assetmanager;
   assetmanager.SetApkAssets({basic_assets_.get()});
 
-  auto resid = assetmanager.GetResourceId("com.android.basic:layout/main", "", "");
-  ASSERT_TRUE(resid.has_value());
-  EXPECT_EQ(basic::R::layout::main, *resid);
-
-  resid = assetmanager.GetResourceId("layout/main", "", "com.android.basic");
-  ASSERT_TRUE(resid.has_value());
-  EXPECT_EQ(basic::R::layout::main, *resid);
-
-  resid = assetmanager.GetResourceId("main", "layout", "com.android.basic");
-  ASSERT_TRUE(resid.has_value());
-  EXPECT_EQ(basic::R::layout::main, *resid);
+  EXPECT_EQ(basic::R::layout::main,
+            assetmanager.GetResourceId("com.android.basic:layout/main", "", ""));
+  EXPECT_EQ(basic::R::layout::main,
+            assetmanager.GetResourceId("layout/main", "", "com.android.basic"));
+  EXPECT_EQ(basic::R::layout::main,
+            assetmanager.GetResourceId("main", "layout", "com.android.basic"));
 }
 
 TEST_F(AssetManager2Test, OpensFileFromSingleApkAssets) {
@@ -619,8 +658,14 @@
   assetmanager.SetApkAssets({basic_assets_.get()});
   assetmanager.SetResourceResolutionLoggingEnabled(false);
 
-  auto value = assetmanager.GetResource(basic::R::string::test1);
-  ASSERT_TRUE(value.has_value());
+  Res_value value;
+  ResTable_config selected_config;
+  uint32_t flags;
+
+  ApkAssetsCookie cookie =
+      assetmanager.GetResource(basic::R::string::test1, false /*may_be_bag*/,
+                               0 /*density_override*/, &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
 
   auto result = assetmanager.GetLastResourceResolution();
   EXPECT_EQ("", result);
@@ -648,12 +693,17 @@
   assetmanager.SetConfiguration(desired_config);
   assetmanager.SetApkAssets({basic_assets_.get()});
 
-  auto value = assetmanager.GetResource(basic::R::string::test1);
-  ASSERT_TRUE(value.has_value());
+  Res_value value;
+  ResTable_config selected_config;
+  uint32_t flags;
+
+  ApkAssetsCookie cookie =
+      assetmanager.GetResource(basic::R::string::test1, false /*may_be_bag*/,
+                               0 /*density_override*/, &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
 
   auto result = assetmanager.GetLastResourceResolution();
-  EXPECT_EQ("Resolution for 0x7f030000 com.android.basic:string/test1\n"
-            "\tFor config -de\n\tFound initial: com.android.basic", result);
+  EXPECT_EQ("Resolution for 0x7f030000 com.android.basic:string/test1\n\tFor config -de\n\tFound initial: com.android.basic", result);
 }
 
 TEST_F(AssetManager2Test, GetLastPathWithMultipleApkAssets) {
@@ -667,14 +717,17 @@
   assetmanager.SetConfiguration(desired_config);
   assetmanager.SetApkAssets({basic_assets_.get(), basic_de_fr_assets_.get()});
 
-  auto value = assetmanager.GetResource(basic::R::string::test1);
-  ASSERT_TRUE(value.has_value());
+  Res_value value = Res_value();
+  ResTable_config selected_config;
+  uint32_t flags;
+
+  ApkAssetsCookie cookie =
+      assetmanager.GetResource(basic::R::string::test1, false /*may_be_bag*/,
+                               0 /*density_override*/, &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
 
   auto result = assetmanager.GetLastResourceResolution();
-  EXPECT_EQ("Resolution for 0x7f030000 com.android.basic:string/test1\n"
-            "\tFor config -de\n"
-            "\tFound initial: com.android.basic\n"
-            "\tFound better: com.android.basic -de", result);
+  EXPECT_EQ("Resolution for 0x7f030000 com.android.basic:string/test1\n\tFor config -de\n\tFound initial: com.android.basic\n\tFound better: com.android.basic -de", result);
 }
 
 TEST_F(AssetManager2Test, GetLastPathAfterDisablingReturnsEmpty) {
@@ -686,8 +739,14 @@
   assetmanager.SetConfiguration(desired_config);
   assetmanager.SetApkAssets({basic_assets_.get()});
 
-  auto value = assetmanager.GetResource(basic::R::string::test1);
-  ASSERT_TRUE(value.has_value());
+  Res_value value = Res_value();
+  ResTable_config selected_config;
+  uint32_t flags;
+
+  ApkAssetsCookie cookie =
+      assetmanager.GetResource(basic::R::string::test1, false /*may_be_bag*/,
+                               0 /*density_override*/, &value, &selected_config, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
 
   auto resultEnabled = assetmanager.GetLastResourceResolution();
   ASSERT_NE("", resultEnabled);
diff --git a/libs/androidfw/tests/AttributeResolution_bench.cpp b/libs/androidfw/tests/AttributeResolution_bench.cpp
index ddd8ab8..fa300c5 100644
--- a/libs/androidfw/tests/AttributeResolution_bench.cpp
+++ b/libs/androidfw/tests/AttributeResolution_bench.cpp
@@ -108,20 +108,27 @@
   device_config.screenHeightDp = 1024;
   device_config.sdkVersion = 27;
 
-  auto value = assetmanager.GetResource(basic::R::layout::layoutt);
-  if (!value.has_value()) {
+  Res_value value;
+  ResTable_config config;
+  uint32_t flags = 0u;
+  ApkAssetsCookie cookie =
+      assetmanager.GetResource(basic::R::layout::layoutt, false /*may_be_bag*/,
+                               0u /*density_override*/, &value, &config, &flags);
+  if (cookie == kInvalidCookie) {
     state.SkipWithError("failed to find R.layout.layout");
     return;
   }
 
-  auto layout_path = assetmanager.GetStringPoolForCookie(value->cookie)->string8At(value->data);
-  if (!layout_path.has_value()) {
+  size_t len = 0u;
+  const char* layout_path =
+      assetmanager.GetStringPoolForCookie(cookie)->string8At(value.data, &len);
+  if (layout_path == nullptr || len == 0u) {
     state.SkipWithError("failed to lookup layout path");
     return;
   }
 
-  std::unique_ptr<Asset> asset = assetmanager.OpenNonAsset(layout_path->to_string(), value->cookie,
-                                                           Asset::ACCESS_BUFFER);
+  std::unique_ptr<Asset> asset = assetmanager.OpenNonAsset(
+      StringPiece(layout_path, len).to_string(), cookie, Asset::ACCESS_BUFFER);
   if (asset == nullptr) {
     state.SkipWithError("failed to load layout");
     return;
diff --git a/libs/androidfw/tests/AttributeResolution_test.cpp b/libs/androidfw/tests/AttributeResolution_test.cpp
index bb9129a..24361b5 100644
--- a/libs/androidfw/tests/AttributeResolution_test.cpp
+++ b/libs/androidfw/tests/AttributeResolution_test.cpp
@@ -77,9 +77,9 @@
       {fix_package_id(R::attr::attr_one, 0x02), fix_package_id(R::attr::attr_two, 0x02)}};
   std::array<uint32_t, attrs.size() * STYLE_NUM_ENTRIES> values;
   std::array<uint32_t, attrs.size() + 1> indices;
-  ASSERT_TRUE(ApplyStyle(theme.get(), nullptr /*xml_parser*/, 0u /*def_style_attr*/,
-                         fix_package_id(R::style::StyleOne, 0x02), attrs.data(), attrs.size(),
-                         values.data(), indices.data()).has_value());
+  ApplyStyle(theme.get(), nullptr /*xml_parser*/, 0u /*def_style_attr*/,
+             fix_package_id(R::style::StyleOne, 0x02), attrs.data(), attrs.size(), values.data(),
+             indices.data());
 
   const uint32_t public_flag = ResTable_typeSpec::SPEC_PUBLIC;
 
@@ -102,7 +102,7 @@
 
 TEST_F(AttributeResolutionTest, Theme) {
   std::unique_ptr<Theme> theme = assetmanager_.NewTheme();
-  ASSERT_TRUE(theme->ApplyStyle(R::style::StyleTwo).has_value());
+  ASSERT_TRUE(theme->ApplyStyle(R::style::StyleTwo));
 
   std::array<uint32_t, 5> attrs{{R::attr::attr_one, R::attr::attr_two, R::attr::attr_three,
                                  R::attr::attr_four, R::attr::attr_empty}};
@@ -110,7 +110,7 @@
 
   ASSERT_TRUE(ResolveAttrs(theme.get(), 0u /*def_style_attr*/, 0u /*def_style_res*/,
                            nullptr /*src_values*/, 0 /*src_values_length*/, attrs.data(),
-                           attrs.size(), values.data(), nullptr /*out_indices*/).has_value());
+                           attrs.size(), values.data(), nullptr /*out_indices*/));
 
   const uint32_t public_flag = ResTable_typeSpec::SPEC_PUBLIC;
 
@@ -162,7 +162,7 @@
   std::array<uint32_t, attrs.size() * STYLE_NUM_ENTRIES> values;
 
   ASSERT_TRUE(RetrieveAttributes(&assetmanager_, &xml_parser_, attrs.data(), attrs.size(),
-                                 values.data(), nullptr /*out_indices*/).has_value());
+                                 values.data(), nullptr /*out_indices*/));
 
   uint32_t* values_cursor = values.data();
   EXPECT_EQ(Res_value::TYPE_NULL, values_cursor[STYLE_TYPE]);
@@ -207,15 +207,15 @@
 
 TEST_F(AttributeResolutionXmlTest, ThemeAndXmlParser) {
   std::unique_ptr<Theme> theme = assetmanager_.NewTheme();
-  ASSERT_TRUE(theme->ApplyStyle(R::style::StyleTwo).has_value());
+  ASSERT_TRUE(theme->ApplyStyle(R::style::StyleTwo));
 
   std::array<uint32_t, 6> attrs{{R::attr::attr_one, R::attr::attr_two, R::attr::attr_three,
                                  R::attr::attr_four, R::attr::attr_five, R::attr::attr_empty}};
   std::array<uint32_t, attrs.size() * STYLE_NUM_ENTRIES> values;
   std::array<uint32_t, attrs.size() + 1> indices;
 
-  ASSERT_TRUE(ApplyStyle(theme.get(), &xml_parser_, 0u /*def_style_attr*/, 0u /*def_style_res*/,
-                         attrs.data(), attrs.size(), values.data(), indices.data()).has_value());
+  ApplyStyle(theme.get(), &xml_parser_, 0u /*def_style_attr*/, 0u /*def_style_res*/, attrs.data(),
+             attrs.size(), values.data(), indices.data());
 
   const uint32_t public_flag = ResTable_typeSpec::SPEC_PUBLIC;
 
diff --git a/libs/androidfw/tests/BenchmarkHelpers.cpp b/libs/androidfw/tests/BenchmarkHelpers.cpp
index 0fa0573..faddfe5 100644
--- a/libs/androidfw/tests/BenchmarkHelpers.cpp
+++ b/libs/androidfw/tests/BenchmarkHelpers.cpp
@@ -71,9 +71,15 @@
     assetmanager.SetConfiguration(*config);
   }
 
+  Res_value value;
+  ResTable_config selected_config;
+  uint32_t flags;
+  uint32_t last_id = 0u;
+
   while (state.KeepRunning()) {
-    auto value = assetmanager.GetResource(resid);
-    assetmanager.ResolveReference(*value);
+    ApkAssetsCookie cookie = assetmanager.GetResource(
+        resid, false /* may_be_bag */, 0u /* density_override */, &value, &selected_config, &flags);
+    assetmanager.ResolveReference(cookie, &value, &selected_config, &flags, &last_id);
   }
 }
 
diff --git a/libs/androidfw/tests/CommonHelpers.cpp b/libs/androidfw/tests/CommonHelpers.cpp
index 3396729..faa5350 100644
--- a/libs/androidfw/tests/CommonHelpers.cpp
+++ b/libs/androidfw/tests/CommonHelpers.cpp
@@ -58,9 +58,8 @@
 }
 
 std::string GetStringFromPool(const ResStringPool* pool, uint32_t idx) {
-  auto str = pool->string8ObjectAt(idx);
-  CHECK(str.has_value()) << "failed to find string entry";
-  return std::string(str->string(), str->length());
+  String8 str = pool->string8ObjectAt(idx);
+  return std::string(str.string(), str.length());
 }
 
 }  // namespace android
diff --git a/libs/androidfw/tests/Idmap_test.cpp b/libs/androidfw/tests/Idmap_test.cpp
index 3f0c7cb..7aa0dbb 100644
--- a/libs/androidfw/tests/Idmap_test.cpp
+++ b/libs/androidfw/tests/Idmap_test.cpp
@@ -62,10 +62,10 @@
   std::unique_ptr<const ApkAssets> overlayable_assets_;
 };
 
-std::string GetStringFromApkAssets(const AssetManager2& asset_manager,
-                                   const AssetManager2::SelectedValue& value) {
+std::string GetStringFromApkAssets(const AssetManager2& asset_manager, const Res_value& value,
+                                   ApkAssetsCookie cookie) {
   auto assets = asset_manager.GetApkAssets();
-  const ResStringPool* string_pool = assets[value.cookie]->GetLoadedArsc()->GetStringPool();
+  const ResStringPool* string_pool = assets[cookie]->GetLoadedArsc()->GetStringPool();
   return GetStringFromPool(string_pool, value.data);
 }
 
@@ -75,88 +75,117 @@
   AssetManager2 asset_manager;
   asset_manager.SetApkAssets({system_assets_.get(), overlayable_assets_.get(),
                               overlay_assets_.get()});
-
-  auto value = asset_manager.GetResource(overlayable::R::string::overlayable5);
-  ASSERT_TRUE(value.has_value());
-  ASSERT_EQ(value->cookie, 2U);
-  ASSERT_EQ(value->type, Res_value::TYPE_STRING);
-  ASSERT_EQ("Overlay One", GetStringFromApkAssets(asset_manager, *value));
+  Res_value val;
+  ResTable_config config;
+  uint32_t flags;
+  ApkAssetsCookie cookie = asset_manager.GetResource(overlayable::R::string::overlayable5,
+                                                    false /* may_be_bag */,
+                                                    0 /* density_override */, &val, &config,
+                                                    &flags);
+  ASSERT_EQ(cookie, 2U);
+  ASSERT_EQ(val.dataType, Res_value::TYPE_STRING);
+  ASSERT_EQ(GetStringFromApkAssets(asset_manager, val, cookie), "Overlay One");
 }
 
 TEST_F(IdmapTest, OverlayOverridesResourceValueUsingDifferentPackage) {
   AssetManager2 asset_manager;
   asset_manager.SetApkAssets({system_assets_.get(), overlayable_assets_.get(),
                               overlay_assets_.get()});
-
-  auto value = asset_manager.GetResource(overlayable::R::string::overlayable10);
-  ASSERT_TRUE(value.has_value());
-  ASSERT_EQ(value->cookie, 0U);
-  ASSERT_EQ(value->type, Res_value::TYPE_STRING);
-  ASSERT_EQ("yes", GetStringFromApkAssets(asset_manager, *value));
+  Res_value val;
+  ResTable_config config;
+  uint32_t flags;
+  ApkAssetsCookie cookie = asset_manager.GetResource(overlayable::R::string::overlayable10,
+                                                    false /* may_be_bag */,
+                                                    0 /* density_override */, &val, &config,
+                                                    &flags);
+  ASSERT_EQ(cookie, 0U);
+  ASSERT_EQ(val.dataType, Res_value::TYPE_STRING);
+  ASSERT_EQ(GetStringFromApkAssets(asset_manager, val, cookie), "yes");
 }
 
 TEST_F(IdmapTest, OverlayOverridesResourceValueUsingInternalResource) {
   AssetManager2 asset_manager;
   asset_manager.SetApkAssets({system_assets_.get(), overlayable_assets_.get(),
                               overlay_assets_.get()});
-
-  auto value = asset_manager.GetResource(overlayable::R::string::overlayable8);
-  ASSERT_TRUE(value.has_value());
-  ASSERT_EQ(value->cookie, 2U);
-  ASSERT_EQ(value->type, Res_value::TYPE_REFERENCE);
-  ASSERT_EQ(value->data, (overlay::R::string::internal & 0x00ffffffU) | (0x02U << 24));
+  Res_value val;
+  ResTable_config config;
+  uint32_t flags;
+  ApkAssetsCookie cookie = asset_manager.GetResource(overlayable::R::string::overlayable8,
+                                                    false /* may_be_bag */,
+                                                    0 /* density_override */, &val, &config,
+                                                    &flags);
+  ASSERT_EQ(cookie, 2U);
+  ASSERT_EQ(val.dataType, Res_value::TYPE_REFERENCE);
+  ASSERT_EQ(val.data, (overlay::R::string::internal & 0x00ffffff) | (0x02 << 24));
 }
 
 TEST_F(IdmapTest, OverlayOverridesResourceValueUsingInlineInteger) {
   AssetManager2 asset_manager;
   asset_manager.SetApkAssets({system_assets_.get(), overlayable_assets_.get(),
                               overlay_assets_.get()});
-
-  auto value = asset_manager.GetResource(overlayable::R::integer::config_integer);
-  ASSERT_TRUE(value.has_value());
-  ASSERT_EQ(value->cookie, 2U);
-  ASSERT_EQ(value->type, Res_value::TYPE_INT_DEC);
-  ASSERT_EQ(value->data, 42);
+  Res_value val;
+  ResTable_config config;
+  uint32_t flags;
+  ApkAssetsCookie cookie = asset_manager.GetResource(overlayable::R::integer::config_integer,
+                                                  false /* may_be_bag */,
+                                                  0 /* density_override */, &val, &config,
+                                                  &flags);
+  ASSERT_EQ(cookie, 2U);
+  ASSERT_EQ(val.dataType, Res_value::TYPE_INT_DEC);
+  ASSERT_EQ(val.data, 42);
 }
 
 TEST_F(IdmapTest, OverlayOverridesResourceValueUsingInlineString) {
   AssetManager2 asset_manager;
   asset_manager.SetApkAssets({system_assets_.get(), overlayable_assets_.get(),
                               overlay_assets_.get()});
+  Res_value val;
+  ResTable_config config;
+  uint32_t flags;
 
-  auto value = asset_manager.GetResource(overlayable::R::string::overlayable11);
-  ASSERT_TRUE(value.has_value());
-  ASSERT_EQ(value->cookie, 2U);
-  ASSERT_EQ(value->type, Res_value::TYPE_STRING);
-  ASSERT_EQ("Hardcoded string", GetStringFromApkAssets(asset_manager, *value));
+  ApkAssetsCookie cookie = asset_manager.GetResource(overlayable::R::string::overlayable11,
+                                                  false /* may_be_bag */,
+                                                  0 /* density_override */, &val, &config,
+                                                  &flags);
+  ASSERT_EQ(cookie, 2U);
+  ASSERT_EQ(val.dataType, Res_value::TYPE_STRING);
+  ASSERT_EQ(GetStringFromApkAssets(asset_manager, val, cookie), "Hardcoded string");
 }
 
 TEST_F(IdmapTest, OverlayOverridesResourceValueUsingOverlayingResource) {
   AssetManager2 asset_manager;
   asset_manager.SetApkAssets({system_assets_.get(), overlayable_assets_.get(),
                               overlay_assets_.get()});
-
-  auto value = asset_manager.GetResource(overlayable::R::string::overlayable9);
-  ASSERT_TRUE(value.has_value());
-  ASSERT_EQ(value->cookie, 2U);
-  ASSERT_EQ(value->type, Res_value::TYPE_REFERENCE);
-  ASSERT_EQ(value->data, overlayable::R::string::overlayable7);
+  Res_value val;
+  ResTable_config config;
+  uint32_t flags;
+  ApkAssetsCookie cookie = asset_manager.GetResource(overlayable::R::string::overlayable9,
+                                                    false /* may_be_bag */,
+                                                    0 /* density_override */, &val, &config,
+                                                    &flags);
+  ASSERT_EQ(cookie, 2U);
+  ASSERT_EQ(val.dataType, Res_value::TYPE_REFERENCE);
+  ASSERT_EQ(val.data, overlayable::R::string::overlayable7);
 }
 
 TEST_F(IdmapTest, OverlayOverridesXmlParser) {
   AssetManager2 asset_manager;
   asset_manager.SetApkAssets({system_assets_.get(), overlayable_assets_.get(),
                               overlay_assets_.get()});
+  Res_value val;
+  ResTable_config config;
+  uint32_t flags;
+  ApkAssetsCookie cookie = asset_manager.GetResource(overlayable::R::layout::hello_view,
+                                                    false /* may_be_bag */,
+                                                    0 /* density_override */, &val, &config,
+                                                    &flags);
+  ASSERT_EQ(cookie, 2U);
+  ASSERT_EQ(val.dataType, Res_value::TYPE_STRING);
+  ASSERT_EQ(GetStringFromApkAssets(asset_manager, val, cookie), "res/layout/hello_view.xml");
 
-  auto value = asset_manager.GetResource(overlayable::R::layout::hello_view);
-  ASSERT_TRUE(value.has_value());
-  ASSERT_EQ(value->cookie, 2U);
-  ASSERT_EQ(value->type, Res_value::TYPE_STRING);
-  ASSERT_EQ("res/layout/hello_view.xml", GetStringFromApkAssets(asset_manager, *value));
-
-  auto asset = asset_manager.OpenNonAsset("res/layout/hello_view.xml", value->cookie,
+  auto asset = asset_manager.OpenNonAsset("res/layout/hello_view.xml", cookie,
                                           Asset::ACCESS_RANDOM);
-  auto dynamic_ref_table = asset_manager.GetDynamicRefTableForCookie(value->cookie);
+  auto dynamic_ref_table = asset_manager.GetDynamicRefTableForCookie(cookie);
   auto xml_tree = util::make_unique<ResXMLTree>(std::move(dynamic_ref_table));
   status_t err = xml_tree->setTo(asset->getBuffer(true), asset->getLength(), false);
   ASSERT_EQ(err, NO_ERROR);
@@ -187,24 +216,32 @@
   asset_manager.SetApkAssets({system_assets_.get(), overlayable_assets_.get(),
                               overlay_assets_.get()});
 
-  auto name = asset_manager.GetResourceName(overlayable::R::string::overlayable9);
-  ASSERT_TRUE(name.has_value());
-  ASSERT_EQ("com.android.overlayable", std::string(name->package));
-  ASSERT_EQ(std::u16string(u"string"), std::u16string(name->type16));
-  ASSERT_EQ("overlayable9", std::string(name->entry));
+  AssetManager2::ResourceName name;
+  ASSERT_TRUE(asset_manager.GetResourceName(overlayable::R::string::overlayable9, &name));
+  ASSERT_EQ(std::string(name.package), "com.android.overlayable");
+  ASSERT_EQ(String16(name.type16), u"string");
+  ASSERT_EQ(std::string(name.entry), "overlayable9");
 }
 
 TEST_F(IdmapTest, OverlayLoaderInterop) {
+  std::string contents;
   auto loader_assets = ApkAssets::LoadTable("loader/resources.arsc", PROPERTY_LOADER);
+
   AssetManager2 asset_manager;
   asset_manager.SetApkAssets({overlayable_assets_.get(), loader_assets.get(),
                               overlay_assets_.get()});
 
-  auto value = asset_manager.GetResource(overlayable::R::string::overlayable11);
-  ASSERT_TRUE(value.has_value());
-  ASSERT_EQ(1U, value->cookie);
-  ASSERT_EQ(Res_value::TYPE_STRING, value->type);
-  ASSERT_EQ("loader", GetStringFromApkAssets(asset_manager, *value));
+  Res_value val;
+  ResTable_config config;
+  uint32_t flags;
+  ApkAssetsCookie cookie = asset_manager.GetResource(overlayable::R::string::overlayable11,
+                                                    false /* may_be_bag */,
+                                                    0 /* density_override */, &val, &config,
+                                                    &flags);
+  std::cout << asset_manager.GetLastResourceResolution();
+  ASSERT_EQ(cookie, 1U);
+  ASSERT_EQ(val.dataType, Res_value::TYPE_STRING);
+  ASSERT_EQ(GetStringFromApkAssets(asset_manager, val, cookie), "loader");
 }
 
 TEST_F(IdmapTest, OverlayAssetsIsUpToDate) {
diff --git a/libs/androidfw/tests/LoadedArsc_test.cpp b/libs/androidfw/tests/LoadedArsc_test.cpp
index 6357411..2d69dfe 100644
--- a/libs/androidfw/tests/LoadedArsc_test.cpp
+++ b/libs/androidfw/tests/LoadedArsc_test.cpp
@@ -50,8 +50,7 @@
   ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/styles/styles.apk", "resources.arsc",
                                       &contents));
 
-  auto loaded_arsc = LoadedArsc::Load(reinterpret_cast<const void*>(contents.data()),
-                                                                    contents.length());
+  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(StringPiece(contents));
   ASSERT_THAT(loaded_arsc, NotNull());
 
   const LoadedPackage* package =
@@ -67,8 +66,9 @@
   ASSERT_THAT(type_spec, NotNull());
   ASSERT_THAT(type_spec->type_count, Ge(1u));
 
-  auto type = type_spec->types[0];
-  ASSERT_TRUE(LoadedPackage::GetEntry(type, entry_index).has_value());
+  const ResTable_type* type = type_spec->types[0];
+  ASSERT_THAT(type, NotNull());
+  ASSERT_THAT(LoadedPackage::GetEntry(type, entry_index), NotNull());
 }
 
 TEST(LoadedArscTest, LoadSparseEntryApp) {
@@ -76,8 +76,7 @@
   ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/sparse/sparse.apk", "resources.arsc",
                                       &contents));
 
-  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(contents.data(),
-                                                                   contents.length());
+  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(StringPiece(contents));
   ASSERT_THAT(loaded_arsc, NotNull());
 
   const LoadedPackage* package =
@@ -91,8 +90,9 @@
   ASSERT_THAT(type_spec, NotNull());
   ASSERT_THAT(type_spec->type_count, Ge(1u));
 
-  auto type = type_spec->types[0];
-  ASSERT_TRUE(LoadedPackage::GetEntry(type, entry_index).has_value());
+  const ResTable_type* type = type_spec->types[0];
+  ASSERT_THAT(type, NotNull());
+  ASSERT_THAT(LoadedPackage::GetEntry(type, entry_index), NotNull());
 }
 
 TEST(LoadedArscTest, LoadSharedLibrary) {
@@ -100,8 +100,7 @@
   ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/lib_one/lib_one.apk", "resources.arsc",
                                       &contents));
 
-  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(contents.data(),
-                                                                   contents.length());
+  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(StringPiece(contents));
   ASSERT_THAT(loaded_arsc, NotNull());
 
   const auto& packages = loaded_arsc->GetPackages();
@@ -121,8 +120,7 @@
   ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/libclient/libclient.apk",
                                       "resources.arsc", &contents));
 
-  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(contents.data(),
-                                                                   contents.length());
+  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(StringPiece(contents));
   ASSERT_THAT(loaded_arsc, NotNull());
 
   const auto& packages = loaded_arsc->GetPackages();
@@ -147,10 +145,8 @@
   ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/appaslib/appaslib.apk",
                                       "resources.arsc", &contents));
 
-  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(contents.data(),
-                                                                   contents.length(),
-                                                                   nullptr /* loaded_idmap */,
-                                                                   PROPERTY_DYNAMIC);
+  std::unique_ptr<const LoadedArsc> loaded_arsc =
+      LoadedArsc::Load(StringPiece(contents), nullptr /* loaded_idmap */, PROPERTY_DYNAMIC);
   ASSERT_THAT(loaded_arsc, NotNull());
 
   const auto& packages = loaded_arsc->GetPackages();
@@ -163,8 +159,7 @@
   std::string contents;
   ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/feature/feature.apk", "resources.arsc",
                                       &contents));
-  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(contents.data(),
-                                                                   contents.length());
+  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(StringPiece(contents));
   ASSERT_THAT(loaded_arsc, NotNull());
 
   const LoadedPackage* package =
@@ -177,12 +172,15 @@
   const TypeSpec* type_spec = package->GetTypeSpecByTypeIndex(type_index);
   ASSERT_THAT(type_spec, NotNull());
   ASSERT_THAT(type_spec->type_count, Ge(1u));
+  ASSERT_THAT(type_spec->types[0], NotNull());
 
-  auto type_name16 = package->GetTypeStringPool()->stringAt(type_spec->type_spec->id - 1);
-  ASSERT_TRUE(type_name16.has_value());
-  EXPECT_THAT(util::Utf16ToUtf8(*type_name16), StrEq("string"));
+  size_t len;
+  const char16_t* type_name16 =
+      package->GetTypeStringPool()->stringAt(type_spec->type_spec->id - 1, &len);
+  ASSERT_THAT(type_name16, NotNull());
+  EXPECT_THAT(util::Utf16ToUtf8(StringPiece16(type_name16, len)), StrEq("string"));
 
-  ASSERT_TRUE(LoadedPackage::GetEntry(type_spec->types[0], entry_index).has_value());
+  ASSERT_THAT(LoadedPackage::GetEntry(type_spec->types[0], entry_index), NotNull());
 }
 
 // AAPT(2) generates resource tables with chunks in a certain order. The rule is that
@@ -207,8 +205,7 @@
       ReadFileFromZipToString(GetTestDataPath() + "/out_of_order_types/out_of_order_types.apk",
                               "resources.arsc", &contents));
 
-  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(contents.data(),
-                                                                   contents.length());
+  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(StringPiece(contents));
   ASSERT_THAT(loaded_arsc, NotNull());
 
   ASSERT_THAT(loaded_arsc->GetPackages(), SizeIs(1u));
@@ -218,10 +215,12 @@
   const TypeSpec* type_spec = package->GetTypeSpecByTypeIndex(0);
   ASSERT_THAT(type_spec, NotNull());
   ASSERT_THAT(type_spec->type_count, Ge(1u));
+  ASSERT_THAT(type_spec->types[0], NotNull());
 
   type_spec = package->GetTypeSpecByTypeIndex(1);
   ASSERT_THAT(type_spec, NotNull());
   ASSERT_THAT(type_spec->type_count, Ge(1u));
+  ASSERT_THAT(type_spec->types[0], NotNull());
 }
 
 TEST(LoadedArscTest, LoadOverlayable) {
@@ -229,8 +228,7 @@
   ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/overlayable/overlayable.apk",
                                       "resources.arsc", &contents));
 
-  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(contents.data(),
-                                                                   contents.length());
+  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(StringPiece(contents));
 
   ASSERT_THAT(loaded_arsc, NotNull());
   const LoadedPackage* package = loaded_arsc->GetPackageById(
@@ -274,8 +272,7 @@
   ASSERT_TRUE(
       ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk", "resources.arsc", &contents));
 
-  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(contents.data(),
-                                                                   contents.length());
+  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(StringPiece(contents));
   ASSERT_NE(nullptr, loaded_arsc);
 
   const std::vector<std::unique_ptr<const LoadedPackage>>& packages = loaded_arsc->GetPackages();
@@ -323,8 +320,7 @@
   ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/overlayable/overlayable.apk",
                                       "resources.arsc", &contents));
 
-  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(contents.data(),
-                                                                   contents.length());
+  std::unique_ptr<const LoadedArsc> loaded_arsc = LoadedArsc::Load(StringPiece(contents));
   ASSERT_NE(nullptr, loaded_arsc);
 
   const std::vector<std::unique_ptr<const LoadedPackage>>& packages = loaded_arsc->GetPackages();
@@ -349,7 +345,7 @@
       asset->getLength());
 
   std::unique_ptr<const LoadedArsc> loaded_arsc =
-      LoadedArsc::Load(data.data(), data.length(), nullptr, PROPERTY_LOADER);
+      LoadedArsc::Load(data, nullptr, PROPERTY_LOADER);
   ASSERT_THAT(loaded_arsc, NotNull());
 
   const LoadedPackage* package =
@@ -365,8 +361,9 @@
   ASSERT_THAT(type_spec, NotNull());
   ASSERT_THAT(type_spec->type_count, Ge(1u));
 
-  auto type = type_spec->types[0];
-  ASSERT_TRUE(LoadedPackage::GetEntry(type, entry_index).has_value());
+  const ResTable_type* type = type_spec->types[0];
+  ASSERT_THAT(type, NotNull());
+  ASSERT_THAT(LoadedPackage::GetEntry(type, entry_index), NotNull());
 }
 
 // structs with size fields (like Res_value, ResTable_entry) should be
diff --git a/libs/androidfw/tests/ResTable_test.cpp b/libs/androidfw/tests/ResTable_test.cpp
index 9aeb00c..326474e 100644
--- a/libs/androidfw/tests/ResTable_test.cpp
+++ b/libs/androidfw/tests/ResTable_test.cpp
@@ -442,22 +442,22 @@
   ASSERT_LT(val.data, pool->size());
 
   // Make sure a string with a truncated length is read to its correct length
-  auto target_str8 = pool->string8At(val.data);
-  ASSERT_TRUE(target_str8.has_value());
-  ASSERT_EQ(size_t(40076), String8(target_str8->data(), target_str8->size()).size());
-  ASSERT_EQ(target_str8->data()[40075], ']');
+  size_t str_len;
+  const char* target_str8 = pool->string8At(val.data, &str_len);
+  ASSERT_TRUE(target_str8 != NULL);
+  ASSERT_EQ(size_t(40076), String8(target_str8, str_len).size());
+  ASSERT_EQ(target_str8[40075], ']');
 
-  auto target_str16 = pool->stringAt(val.data);
-  ASSERT_TRUE(target_str16.has_value());
-  ASSERT_EQ(size_t(40076), String16(target_str16->data(), target_str16->size()).size());
-  ASSERT_EQ(target_str8->data()[40075], (char16_t) ']');
+  const char16_t* target_str16 = pool->stringAt(val.data, &str_len);
+  ASSERT_TRUE(target_str16 != NULL);
+  ASSERT_EQ(size_t(40076), String16(target_str16, str_len).size());
+  ASSERT_EQ(target_str8[40075], (char16_t) ']');
 
   // Load an edited apk with the null terminator removed from the end of the
   // string
   std::string invalid_contents;
-  ASSERT_TRUE(ReadFileFromZipToString(
-      GetTestDataPath() + "/length_decode/length_decode_invalid.apk", "resources.arsc",
-      &invalid_contents));
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/length_decode/length_decode_invalid.apk",
+                                      "resources.arsc", &invalid_contents));
   ResTable invalid_table;
   ASSERT_EQ(NO_ERROR, invalid_table.add(invalid_contents.data(), invalid_contents.size()));
 
@@ -472,8 +472,8 @@
 
   // Make sure a string with a truncated length that is not null terminated errors
   // and does not return the string
-  ASSERT_FALSE(invalid_pool->string8At(invalid_val.data).has_value());
-  ASSERT_FALSE(invalid_pool->stringAt(invalid_val.data).has_value());
+  ASSERT_TRUE(invalid_pool->string8At(invalid_val.data, &str_len) == NULL);
+  ASSERT_TRUE(invalid_pool->stringAt(invalid_val.data, &str_len) == NULL);
 }
 
 }  // namespace android
diff --git a/libs/androidfw/tests/TestHelpers.cpp b/libs/androidfw/tests/TestHelpers.cpp
index 10c0a4f..a81bb6f 100644
--- a/libs/androidfw/tests/TestHelpers.cpp
+++ b/libs/androidfw/tests/TestHelpers.cpp
@@ -73,15 +73,11 @@
     return AssertionFailure() << "table has no string pool for block " << block;
   }
 
-  auto actual_str = pool->string8ObjectAt(val.data);
-  if (!actual_str.has_value()) {
-    return AssertionFailure() << "could not find string entry";
+  const String8 actual_str = pool->string8ObjectAt(val.data);
+  if (String8(expected_str) != actual_str) {
+    return AssertionFailure() << actual_str.string();
   }
-
-  if (String8(expected_str) != *actual_str) {
-    return AssertionFailure() << actual_str->string();
-  }
-  return AssertionSuccess() << actual_str->string();
+  return AssertionSuccess() << actual_str.string();
 }
 
 }  // namespace android
diff --git a/libs/androidfw/tests/Theme_bench.cpp b/libs/androidfw/tests/Theme_bench.cpp
index f3d60bb..594c39e 100644
--- a/libs/androidfw/tests/Theme_bench.cpp
+++ b/libs/androidfw/tests/Theme_bench.cpp
@@ -70,8 +70,11 @@
   auto theme = assets.NewTheme();
   theme->ApplyStyle(kStyleId, false /* force */);
 
+  Res_value value;
+  uint32_t flags;
+
   while (state.KeepRunning()) {
-    theme->GetAttribute(kAttrId);
+    theme->GetAttribute(kAttrId, &value, &flags);
   }
 }
 BENCHMARK(BM_ThemeGetAttribute);
diff --git a/libs/androidfw/tests/Theme_test.cpp b/libs/androidfw/tests/Theme_test.cpp
index f658735..16b9c75 100644
--- a/libs/androidfw/tests/Theme_test.cpp
+++ b/libs/androidfw/tests/Theme_test.cpp
@@ -67,7 +67,10 @@
   std::unique_ptr<Theme> theme = assetmanager.NewTheme();
   EXPECT_EQ(0u, theme->GetChangingConfigurations());
   EXPECT_EQ(&assetmanager, theme->GetAssetManager());
-  EXPECT_FALSE(theme->GetAttribute(app::R::attr::attr_one).has_value());
+
+  Res_value value;
+  uint32_t flags;
+  EXPECT_EQ(kInvalidCookie, theme->GetAttribute(app::R::attr::attr_one, &value, &flags));
 }
 
 TEST_F(ThemeTest, SingleThemeNoParent) {
@@ -75,19 +78,23 @@
   assetmanager.SetApkAssets({style_assets_.get()});
 
   std::unique_ptr<Theme> theme = assetmanager.NewTheme();
-  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleOne).has_value());
+  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleOne));
 
-  auto value = theme->GetAttribute(app::R::attr::attr_one);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(1u, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  Res_value value;
+  uint32_t flags;
+  ApkAssetsCookie cookie;
 
-  value = theme->GetAttribute(app::R::attr::attr_two);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(2u, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  cookie = theme->GetAttribute(app::R::attr::attr_one, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(1u, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
+
+  cookie = theme->GetAttribute(app::R::attr::attr_two, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(2u, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
 }
 
 TEST_F(ThemeTest, SingleThemeWithParent) {
@@ -95,28 +102,32 @@
   assetmanager.SetApkAssets({style_assets_.get()});
 
   std::unique_ptr<Theme> theme = assetmanager.NewTheme();
-  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleTwo).has_value());
+  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleTwo));
 
-  auto value = theme->GetAttribute(app::R::attr::attr_one);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(1u, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  Res_value value;
+  uint32_t flags;
+  ApkAssetsCookie cookie;
 
-  value = theme->GetAttribute(app::R::attr::attr_two);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_STRING, value->type);
-  EXPECT_EQ(0, value->cookie);
+  cookie = theme->GetAttribute(app::R::attr::attr_one, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(1u, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
+
+  cookie = theme->GetAttribute(app::R::attr::attr_two, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_STRING, value.dataType);
+  EXPECT_EQ(0, cookie);
   EXPECT_EQ(std::string("string"),
-            GetStringFromPool(assetmanager.GetStringPoolForCookie(0), value->data));
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+            GetStringFromPool(assetmanager.GetStringPoolForCookie(0), value.data));
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
 
   // This attribute should point to an attr_indirect, so the result should be 3.
-  value = theme->GetAttribute(app::R::attr::attr_three);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(3u, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  cookie = theme->GetAttribute(app::R::attr::attr_three, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(3u, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
 }
 
 TEST_F(ThemeTest, TryToUseBadResourceId) {
@@ -124,8 +135,11 @@
   assetmanager.SetApkAssets({style_assets_.get()});
 
   std::unique_ptr<Theme> theme = assetmanager.NewTheme();
-  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleTwo).has_value());
-  ASSERT_FALSE(theme->GetAttribute(0x7f000001));
+  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleTwo));
+
+  Res_value value;
+  uint32_t flags;
+  ASSERT_EQ(kInvalidCookie, theme->GetAttribute(0x7f000001, &value, &flags));
 }
 
 TEST_F(ThemeTest, MultipleThemesOverlaidNotForce) {
@@ -133,29 +147,33 @@
   assetmanager.SetApkAssets({style_assets_.get()});
 
   std::unique_ptr<Theme> theme = assetmanager.NewTheme();
-  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleTwo).has_value());
-  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleThree).has_value());
+  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleTwo));
+  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleThree));
+
+  Res_value value;
+  uint32_t flags;
+  ApkAssetsCookie cookie;
 
   // attr_one is still here from the base.
-  auto value = theme->GetAttribute(app::R::attr::attr_one);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(1u, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  cookie = theme->GetAttribute(app::R::attr::attr_one, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(1u, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
 
   // check for the new attr_six
-  value = theme->GetAttribute(app::R::attr::attr_six);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(6u, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  cookie = theme->GetAttribute(app::R::attr::attr_six, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(6u, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
 
   // check for the old attr_five (force=true was not used).
-  value = theme->GetAttribute(app::R::attr::attr_five);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_REFERENCE, value->type);
-  EXPECT_EQ(app::R::string::string_one, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  cookie = theme->GetAttribute(app::R::attr::attr_five, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_REFERENCE, value.dataType);
+  EXPECT_EQ(app::R::string::string_one, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
 }
 
 TEST_F(ThemeTest, MultipleThemesOverlaidForced) {
@@ -163,29 +181,33 @@
   assetmanager.SetApkAssets({style_assets_.get()});
 
   std::unique_ptr<Theme> theme = assetmanager.NewTheme();
-  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleTwo).has_value());
-  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleThree, true /* force */).has_value());
+  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleTwo));
+  ASSERT_TRUE(theme->ApplyStyle(app::R::style::StyleThree, true /* force */));
+
+  Res_value value;
+  uint32_t flags;
+  ApkAssetsCookie cookie;
 
   // attr_one is still here from the base.
-  auto value = theme->GetAttribute(app::R::attr::attr_one);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(1u, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  cookie = theme->GetAttribute(app::R::attr::attr_one, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(1u, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
 
   // check for the new attr_six
-  value = theme->GetAttribute(app::R::attr::attr_six);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(6u, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  cookie = theme->GetAttribute(app::R::attr::attr_six, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(6u, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
 
   // check for the new attr_five (force=true was used).
-  value = theme->GetAttribute(app::R::attr::attr_five);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(5u, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  cookie = theme->GetAttribute(app::R::attr::attr_five, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(5u, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
 }
 
 TEST_F(ThemeTest, ResolveDynamicAttributesAndReferencesToSharedLibrary) {
@@ -194,24 +216,28 @@
       {lib_two_assets_.get(), lib_one_assets_.get(), libclient_assets_.get()});
 
   std::unique_ptr<Theme> theme = assetmanager.NewTheme();
-  ASSERT_TRUE(theme->ApplyStyle(libclient::R::style::Theme, false /*force*/).has_value());
+  ASSERT_TRUE(theme->ApplyStyle(libclient::R::style::Theme, false /*force*/));
+
+  Res_value value;
+  uint32_t flags;
+  ApkAssetsCookie cookie;
 
   // The attribute should be resolved to the final value.
-  auto value = theme->GetAttribute(libclient::R::attr::foo);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(700u, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  cookie = theme->GetAttribute(libclient::R::attr::foo, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(700u, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
 
   // The reference should be resolved to a TYPE_REFERENCE.
-  value = theme->GetAttribute(libclient::R::attr::bar);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_REFERENCE, value->type);
+  cookie = theme->GetAttribute(libclient::R::attr::bar, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_REFERENCE, value.dataType);
 
   // lib_one is assigned package ID 0x03.
-  EXPECT_EQ(3u, get_package_id(value->data));
-  EXPECT_EQ(get_type_id(lib_one::R::string::foo), get_type_id(value->data));
-  EXPECT_EQ(get_entry_id(lib_one::R::string::foo), get_entry_id(value->data));
+  EXPECT_EQ(3u, get_package_id(value.data));
+  EXPECT_EQ(get_type_id(lib_one::R::string::foo), get_type_id(value.data));
+  EXPECT_EQ(get_entry_id(lib_one::R::string::foo), get_entry_id(value.data));
 }
 
 TEST_F(ThemeTest, CopyThemeSameAssetManager) {
@@ -219,20 +245,24 @@
   assetmanager.SetApkAssets({style_assets_.get()});
 
   std::unique_ptr<Theme> theme_one = assetmanager.NewTheme();
-  ASSERT_TRUE(theme_one->ApplyStyle(app::R::style::StyleOne).has_value());
+  ASSERT_TRUE(theme_one->ApplyStyle(app::R::style::StyleOne));
+
+  Res_value value;
+  uint32_t flags;
+  ApkAssetsCookie cookie;
 
   // attr_one is still here from the base.
-  auto value = theme_one->GetAttribute(app::R::attr::attr_one);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(1u, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  cookie = theme_one->GetAttribute(app::R::attr::attr_one, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(1u, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
 
   // attr_six is not here.
-  ASSERT_FALSE(theme_one->GetAttribute(app::R::attr::attr_six).has_value());
+  EXPECT_EQ(kInvalidCookie, theme_one->GetAttribute(app::R::attr::attr_six, &value, &flags));
 
   std::unique_ptr<Theme> theme_two = assetmanager.NewTheme();
-  ASSERT_TRUE(theme_two->ApplyStyle(app::R::style::StyleThree).has_value());
+  ASSERT_TRUE(theme_two->ApplyStyle(app::R::style::StyleThree));
 
   // Copy the theme to theme_one.
   theme_one->SetTo(*theme_two);
@@ -241,14 +271,14 @@
   theme_two->Clear();
 
   // attr_one is now not here.
-  ASSERT_FALSE(theme_one->GetAttribute(app::R::attr::attr_one).has_value());
+  EXPECT_EQ(kInvalidCookie, theme_one->GetAttribute(app::R::attr::attr_one, &value, &flags));
 
   // attr_six is now here because it was copied.
-  value = theme_one->GetAttribute(app::R::attr::attr_six);
-  ASSERT_TRUE(value);
-  EXPECT_EQ(Res_value::TYPE_INT_DEC, value->type);
-  EXPECT_EQ(6u, value->data);
-  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), value->flags);
+  cookie = theme_one->GetAttribute(app::R::attr::attr_six, &value, &flags);
+  ASSERT_NE(kInvalidCookie, cookie);
+  EXPECT_EQ(Res_value::TYPE_INT_DEC, value.dataType);
+  EXPECT_EQ(6u, value.data);
+  EXPECT_EQ(static_cast<uint32_t>(ResTable_typeSpec::SPEC_PUBLIC), flags);
 }
 
 TEST_F(ThemeTest, OnlyCopySameAssetsThemeWhenAssetManagersDiffer) {
@@ -261,43 +291,39 @@
                                  style_assets_.get()});
 
   auto theme_dst = assetmanager_dst.NewTheme();
-  ASSERT_TRUE(theme_dst->ApplyStyle(app::R::style::StyleOne).has_value());
+  ASSERT_TRUE(theme_dst->ApplyStyle(app::R::style::StyleOne));
 
   auto theme_src = assetmanager_src.NewTheme();
-  ASSERT_TRUE(theme_src->ApplyStyle(R::style::Theme_One).has_value());
-  ASSERT_TRUE(theme_src->ApplyStyle(app::R::style::StyleTwo).has_value());
+  ASSERT_TRUE(theme_src->ApplyStyle(R::style::Theme_One));
+  ASSERT_TRUE(theme_src->ApplyStyle(app::R::style::StyleTwo));
   ASSERT_TRUE(theme_src->ApplyStyle(fix_package_id(lib_one::R::style::Theme, 0x03),
-                                    false /*force*/).has_value());
+                                    false /*force*/));
   ASSERT_TRUE(theme_src->ApplyStyle(fix_package_id(lib_two::R::style::Theme, 0x02),
-                                    false /*force*/).has_value());
+                                    false /*force*/));
 
   theme_dst->SetTo(*theme_src);
 
+  Res_value value;
+  uint32_t flags;
+
   // System resources (present in destination asset manager).
-  auto value = theme_dst->GetAttribute(R::attr::foreground);
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(0, value->cookie);
+  EXPECT_EQ(0, theme_dst->GetAttribute(R::attr::foreground, &value, &flags));
 
   // The cookie of the style asset is 3 in the source and 2 in the destination.
   // Check that the cookie has been rewritten to the destination values.
-  value = theme_dst->GetAttribute(app::R::attr::attr_one);
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(2, value->cookie);
+  EXPECT_EQ(2, theme_dst->GetAttribute(app::R::attr::attr_one, &value, &flags));
 
   // The cookie of the lib_one asset is 2 in the source and 1 in the destination.
   // The package id of the lib_one package is 0x03 in the source and 0x02 in the destination
   // Check that the cookie and packages have been rewritten to the destination values.
-  value = theme_dst->GetAttribute(fix_package_id(lib_one::R::attr::attr1, 0x02));
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(1, value->cookie);
-
-  value = theme_dst->GetAttribute(fix_package_id(lib_one::R::attr::attr2, 0x02));
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(1, value->cookie);
+  EXPECT_EQ(1, theme_dst->GetAttribute(fix_package_id(lib_one::R::attr::attr1, 0x02), &value,
+                                       &flags));
+  EXPECT_EQ(1, theme_dst->GetAttribute(fix_package_id(lib_one::R::attr::attr2, 0x02), &value,
+                                       &flags));
 
   // attr2 references an attribute in lib_one. Check that the resolution of the attribute value is
   // correct after the value of attr2 had its package id rewritten to the destination package id.
-  EXPECT_EQ(700, value->data);
+  EXPECT_EQ(700, value.data);
 }
 
 TEST_F(ThemeTest, CopyNonReferencesWhenPackagesDiffer) {
@@ -309,32 +335,28 @@
 
   auto theme_dst = assetmanager_dst.NewTheme();
   auto theme_src = assetmanager_src.NewTheme();
-  ASSERT_TRUE(theme_src->ApplyStyle(app::R::style::StyleSeven).has_value());
+  ASSERT_TRUE(theme_src->ApplyStyle(app::R::style::StyleSeven));
   theme_dst->SetTo(*theme_src);
 
+  Res_value value;
+  uint32_t flags;
+
   // Allow inline resource values to be copied even if the source apk asset is not present in the
   // destination.
-  auto value = theme_dst->GetAttribute(0x0101021b /* android:versionCode */);
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(0, value->cookie);
+  EXPECT_EQ(0, theme_dst->GetAttribute(0x0101021b /* android:versionCode */, &value, &flags));
 
   // Do not copy strings since the data is an index into the values string pool of the source apk
   // asset.
-  EXPECT_FALSE(theme_dst->GetAttribute(0x01010001 /* android:label */).has_value());
+  EXPECT_EQ(-1, theme_dst->GetAttribute(0x01010001 /* android:label */, &value, &flags));
 
   // Do not copy values that reference another resource if the resource is not present in the
   // destination.
-  EXPECT_FALSE(theme_dst->GetAttribute(0x01010002 /* android:icon */).has_value());
-  EXPECT_FALSE(theme_dst->GetAttribute(0x010100d1 /* android:tag */).has_value());
+  EXPECT_EQ(-1, theme_dst->GetAttribute(0x01010002 /* android:icon */, &value, &flags));
+  EXPECT_EQ(-1, theme_dst->GetAttribute(0x010100d1 /* android:tag */, &value, &flags));
 
   // Allow @empty to and @null to be copied.
-  value = theme_dst->GetAttribute(0x010100d0 /* android:id */);
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(0, value->cookie);
-
-  value = theme_dst->GetAttribute(0x01010000 /* android:theme */);
-  ASSERT_TRUE(value.has_value());
-  EXPECT_EQ(0, value->cookie);
+  EXPECT_EQ(0, theme_dst->GetAttribute(0x010100d0 /* android:id */, &value, &flags));
+  EXPECT_EQ(0, theme_dst->GetAttribute(0x01010000 /* android:theme */, &value, &flags));
 }
 
 }  // namespace android
