summaryrefslogtreecommitdiff
path: root/libs/androidfw/AssetManager2.cpp
diff options
context:
space:
mode:
author Aurimas Liutikas <aurimas@google.com> 2019-02-07 19:05:20 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-02-07 19:05:20 +0000
commit86ef44bcc7331b91ff9d03960a662ef2c71880f0 (patch)
tree38e55e29a2bf8ba1c3f75dec622014bf9c685853 /libs/androidfw/AssetManager2.cpp
parentf5ce5eddaea62cfdf36d5502ba2b87bc961780eb (diff)
parent8f004c85a0859b6fad16f26ac0fce7b2dc3db3b1 (diff)
Merge "Add helper methods for View attribute debugging"
Diffstat (limited to 'libs/androidfw/AssetManager2.cpp')
-rw-r--r--libs/androidfw/AssetManager2.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp
index 20303eba6667..81afd937d85e 100644
--- a/libs/androidfw/AssetManager2.cpp
+++ b/libs/androidfw/AssetManager2.cpp
@@ -704,9 +704,29 @@ ApkAssetsCookie AssetManager2::ResolveReference(ApkAssetsCookie cookie, Res_valu
return cookie;
}
+const std::vector<uint32_t> AssetManager2::GetBagResIdStack(uint32_t resid) {
+ auto cached_iter = cached_bag_resid_stacks_.find(resid);
+ if (cached_iter != cached_bag_resid_stacks_.end()) {
+ return cached_iter->second;
+ } else {
+ auto found_resids = std::vector<uint32_t>();
+ GetBag(resid, found_resids);
+ // Cache style stacks if they are not already cached.
+ cached_bag_resid_stacks_[resid] = found_resids;
+ return found_resids;
+ }
+}
+
const ResolvedBag* AssetManager2::GetBag(uint32_t resid) {
auto found_resids = std::vector<uint32_t>();
- return GetBag(resid, found_resids);
+ auto bag = GetBag(resid, found_resids);
+
+ // Cache style stacks if they are not already cached.
+ auto cached_iter = cached_bag_resid_stacks_.find(resid);
+ if (cached_iter == cached_bag_resid_stacks_.end()) {
+ cached_bag_resid_stacks_[resid] = found_resids;
+ }
+ return bag;
}
const ResolvedBag* AssetManager2::GetBag(uint32_t resid, std::vector<uint32_t>& child_resids) {