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/Theme_bench.cpp b/libs/androidfw/tests/Theme_bench.cpp
index dfbb5a7..f3d60bb 100644
--- a/libs/androidfw/tests/Theme_bench.cpp
+++ b/libs/androidfw/tests/Theme_bench.cpp
@@ -28,14 +28,14 @@
constexpr const static uint32_t kAttrId = 0x01010030u; // android:attr/colorForeground
static void BM_ThemeApplyStyleFramework(benchmark::State& state) {
- auto apk = ApkAssets::Load(kFrameworkPath);
+ std::unique_ptr<const ApkAssets> apk = ApkAssets::Load(kFrameworkPath);
if (apk == nullptr) {
state.SkipWithError("Failed to load assets");
return;
}
AssetManager2 assets;
- assets.SetApkAssets({apk});
+ assets.SetApkAssets({apk.get()});
while (state.KeepRunning()) {
auto theme = assets.NewTheme();
@@ -62,10 +62,10 @@
BENCHMARK(BM_ThemeApplyStyleFrameworkOld);
static void BM_ThemeGetAttribute(benchmark::State& state) {
- auto apk = ApkAssets::Load(kFrameworkPath);
+ std::unique_ptr<const ApkAssets> apk = ApkAssets::Load(kFrameworkPath);
AssetManager2 assets;
- assets.SetApkAssets({apk});
+ assets.SetApkAssets({apk.get()});
auto theme = assets.NewTheme();
theme->ApplyStyle(kStyleId, false /* force */);