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/AttributeResolution_bench.cpp b/libs/androidfw/tests/AttributeResolution_bench.cpp
index 384f4a7..1c89c61 100644
--- a/libs/androidfw/tests/AttributeResolution_bench.cpp
+++ b/libs/androidfw/tests/AttributeResolution_bench.cpp
@@ -36,14 +36,15 @@
constexpr const static uint32_t Theme_Material_Light = 0x01030237u;
static void BM_ApplyStyle(benchmark::State& state) {
- auto styles_apk = ApkAssets::Load(GetTestDataPath() + "/styles/styles.apk");
+ std::unique_ptr<const ApkAssets> styles_apk =
+ ApkAssets::Load(GetTestDataPath() + "/styles/styles.apk");
if (styles_apk == nullptr) {
state.SkipWithError("failed to load assets");
return;
}
AssetManager2 assetmanager;
- assetmanager.SetApkAssets({styles_apk});
+ assetmanager.SetApkAssets({styles_apk.get()});
std::unique_ptr<Asset> asset =
assetmanager.OpenNonAsset("res/layout/layout.xml", Asset::ACCESS_BUFFER);
@@ -79,20 +80,21 @@
BENCHMARK(BM_ApplyStyle);
static void BM_ApplyStyleFramework(benchmark::State& state) {
- auto framework_apk = ApkAssets::Load(kFrameworkPath);
+ std::unique_ptr<const ApkAssets> framework_apk = ApkAssets::Load(kFrameworkPath);
if (framework_apk == nullptr) {
state.SkipWithError("failed to load framework assets");
return;
}
- auto basic_apk = ApkAssets::Load(GetTestDataPath() + "/basic/basic.apk");
+ std::unique_ptr<const ApkAssets> basic_apk =
+ ApkAssets::Load(GetTestDataPath() + "/basic/basic.apk");
if (basic_apk == nullptr) {
state.SkipWithError("failed to load assets");
return;
}
AssetManager2 assetmanager;
- assetmanager.SetApkAssets({framework_apk, basic_apk});
+ assetmanager.SetApkAssets({framework_apk.get(), basic_apk.get()});
ResTable_config device_config;
memset(&device_config, 0, sizeof(device_config));