From 4b176069c3efbb6e8a9793fc7c689e4e1f89075e Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 1 Oct 2018 15:15:51 -0700 Subject: Don't set targetSdkVersion to '1' for libraries Setting targetSdkVersion to '1' causes ManifestMerger to add implicit permissions when merging to a higher targetSdkVersion. It should really be unset, but ManifestMerger treats unset targetSdkVersion as 'Q' if minSdkVersion is 'Q' (but not if minSdkVersion is '28'). Set it to something low so that it will be overriden by the main manifest, but high enough that it doesn't cause implicit permissions grants. Bug: 115415671 Bug: 117122200 Test: m checkbuild Change-Id: I1d2d031a21314f6b55d8ea1cc7c4c8e3ecae7f06 --- scripts/manifest_fixer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts/manifest_fixer.py') diff --git a/scripts/manifest_fixer.py b/scripts/manifest_fixer.py index b6fe34e6e..80a398b51 100755 --- a/scripts/manifest_fixer.py +++ b/scripts/manifest_fixer.py @@ -179,7 +179,12 @@ def raise_min_sdk_version(doc, min_sdk_version, target_sdk_version, library): if target_attr is None: target_attr = doc.createAttributeNS(android_ns, 'android:targetSdkVersion') if library: - target_attr.value = '1' + # TODO(b/117122200): libraries shouldn't set targetSdkVersion at all, but + # ManifestMerger treats minSdkVersion="Q" as targetSdkVersion="Q" if it + # is empty. Set it to something low so that it will be overriden by the + # main manifest, but high enough that it doesn't cause implicit + # permissions grants. + target_attr.value = '15' else: target_attr.value = target_sdk_version element.setAttributeNode(target_attr) -- cgit v1.2.3-59-g8ed1b