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) diff --git a/scripts/manifest_fixer_test.py b/scripts/manifest_fixer_test.py index 66a2317f5..d1d401a77 100755 --- a/scripts/manifest_fixer_test.py +++ b/scripts/manifest_fixer_test.py @@ -173,7 +173,7 @@ class RaiseMinSdkVersionTest(unittest.TestCase): """Tests inserting targetSdkVersion when minSdkVersion exists.""" manifest_input = self.manifest_tmpl % self.uses_sdk(min='27') - expected = self.manifest_tmpl % self.uses_sdk(min='28', target='1') + expected = self.manifest_tmpl % self.uses_sdk(min='28', target='15') output = self.raise_min_sdk_version_test(manifest_input, '28', '29', True) self.assertEqual(output, expected) @@ -189,7 +189,7 @@ class RaiseMinSdkVersionTest(unittest.TestCase): """Tests inserting targetSdkVersion when minSdkVersion does not exist.""" manifest_input = self.manifest_tmpl % '' - expected = self.manifest_tmpl % self.uses_sdk(min='28', target='1') + expected = self.manifest_tmpl % self.uses_sdk(min='28', target='15') output = self.raise_min_sdk_version_test(manifest_input, '28', '29', True) self.assertEqual(output, expected)