Revert "Use reference counted pointers for ApkAssets"
This reverts commit c357f719ed3734aee05418808699a48dd150a1a5.
Reason for revert: b/279154343 - performance regression
Change-Id: If2e212d8fc5b9ed8638032a33f450440cbaeceb0
diff --git a/libs/androidfw/tests/BenchmarkHelpers.cpp b/libs/androidfw/tests/BenchmarkHelpers.cpp
index b97dd96..0fa0573 100644
--- a/libs/androidfw/tests/BenchmarkHelpers.cpp
+++ b/libs/androidfw/tests/BenchmarkHelpers.cpp
@@ -53,18 +53,20 @@
void GetResourceBenchmark(const std::vector<std::string>& paths, const ResTable_config* config,
uint32_t resid, benchmark::State& state) {
- std::vector<AssetManager2::ApkAssetsPtr> apk_assets;
+ std::vector<std::unique_ptr<const ApkAssets>> apk_assets;
+ std::vector<const ApkAssets*> apk_assets_ptrs;
for (const std::string& path : paths) {
- auto apk = ApkAssets::Load(path);
+ std::unique_ptr<const ApkAssets> apk = ApkAssets::Load(path);
if (apk == nullptr) {
state.SkipWithError(base::StringPrintf("Failed to load assets %s", path.c_str()).c_str());
return;
}
+ apk_assets_ptrs.push_back(apk.get());
apk_assets.push_back(std::move(apk));
}
AssetManager2 assetmanager;
- assetmanager.SetApkAssets(apk_assets);
+ assetmanager.SetApkAssets(apk_assets_ptrs);
if (config != nullptr) {
assetmanager.SetConfiguration(*config);
}