diff options
author | 2023-10-06 13:10:52 -0700 | |
---|---|---|
committer | 2023-10-06 13:24:38 -0700 | |
commit | c00fa152f764f26fa90afd95bbfffbe8143867ad (patch) | |
tree | 08f795506771eed6ab5c487b583050c7d2ac3d27 | |
parent | f7fe400fbcdd696e9e4649649c97acaf3cb22440 (diff) |
Fix manifest_check.py for generated manifests that have no application tag
Make generates manifests for modules that are missing AndroidManifest.xml
files in order to paper over differences between aapt and aapt2. These
manifests don't have an <application> tag. which was tripping up an
unexercised error path in manifest_check.py.
Change manifest_check,py's extract_uses_libs_xml to consider manifests
with no application tag as having empty uses_library and
optional_uses_library lists. Also fix up a few nearby pylint warnings.
Fixes: 303554426
Test: m ConnectivityMonitorRobotests
Change-Id: I3815a1c86e24d7b3dea7f4ea26c34d3af182ded1
-rwxr-xr-x | scripts/manifest_check.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/scripts/manifest_check.py b/scripts/manifest_check.py index c8d4f76c8..c33b104bd 100755 --- a/scripts/manifest_check.py +++ b/scripts/manifest_check.py @@ -187,18 +187,17 @@ def extract_uses_libs_apk(badging): return required, optional, tags -def extract_uses_libs_xml(xml): #pylint: disable=inconsistent-return-statements +def extract_uses_libs_xml(xml): """Extract <uses-library> tags from the manifest.""" manifest = parse_manifest(xml) elems = get_children_with_tag(manifest, 'application') - application = elems[0] if len(elems) == 1 else None - if len(elems) > 1: #pylint: disable=no-else-raise + if len(elems) > 1: raise RuntimeError('found multiple <application> tags') - elif not elems: - if uses_libraries or optional_uses_libraries: #pylint: disable=undefined-variable - raise ManifestMismatchError('no <application> tag found') - return + if not elems: + return [], [], [] + + application = elems[0] libs = get_children_with_tag(application, 'uses-library') |