From 27751ea8c6470df82e2085ddd30987072445172f Mon Sep 17 00:00:00 2001 From: Julia Kawano Date: Wed, 2 Jun 2021 11:57:03 -1000 Subject: Fix generate-overlayable script to include attrs Test: manual Change-Id: Ibb147dafa3f974af1fd8d6afdf40142e4e30beca Bug: 190069278 --- tools/rro/resource_utils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/rro/resource_utils.py b/tools/rro/resource_utils.py index aae73a1..8628abf 100644 --- a/tools/rro/resource_utils.py +++ b/tools/rro/resource_utils.py @@ -93,7 +93,17 @@ def get_resources_from_single_file(filename, ignore_strings=False): root = doc.getroot() result = set() for resource in root: - if resource.tag == 'declare-styleable' or resource.tag is etree.Comment: + if resource.tag is etree.Comment: + continue + if resource.tag == 'declare-styleable': + for attr in resource: + resName = attr.get('name') + # Skip resources beginning with 'android:' as they are part of the framework + # resources. This script finds only the app's resources. + if resName is None or resName.startswith('android:'): + continue + resType = "attr" + add_resource_to_set(result, Resource(resName, resType, ResourceLocation(filename, attr.sourceline))) continue resName = resource.get('name') resType = resource.tag -- cgit v1.2.3