manifest_fixer: Set targetSdkVersion to '16' for libraries
manifest_fixer.py sets a lib's targetSdkVersion to '15' if it is not explicitly set. But ManifestMerger will add dangerous permissions CALL_LOG_READ/CALL_LOG_WRITE if the following conditions are met: - The app's targetSdkVersion is >16 - A linked lib's targetSdkVersion is <16 - The app has CONTACTS_READ/CONTACTS_WRITE permissions This condition is triggered for some (OEM) app builds (of Settings). Update manifest_fixer.py to use '16' as its default targetSdkVersion so that manifest_merge doesn't add these dangerous permissions. Change-Id: Id5f41f7da98c190c8d145fceba0085cf473f4c7a
This commit is contained in:
parent
2bcb4940bb
commit
18dcd046ad
|
@ -121,7 +121,7 @@ def raise_min_sdk_version(doc, min_sdk_version, target_sdk_version, library):
|
||||||
# is empty. Set it to something low so that it will be overriden by the
|
# 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
|
# main manifest, but high enough that it doesn't cause implicit
|
||||||
# permissions grants.
|
# permissions grants.
|
||||||
target_attr.value = '15'
|
target_attr.value = '16'
|
||||||
else:
|
else:
|
||||||
target_attr.value = target_sdk_version
|
target_attr.value = target_sdk_version
|
||||||
element.setAttributeNode(target_attr)
|
element.setAttributeNode(target_attr)
|
||||||
|
|
|
@ -173,7 +173,7 @@ class RaiseMinSdkVersionTest(unittest.TestCase):
|
||||||
"""Tests inserting targetSdkVersion when minSdkVersion exists."""
|
"""Tests inserting targetSdkVersion when minSdkVersion exists."""
|
||||||
|
|
||||||
manifest_input = self.manifest_tmpl % self.uses_sdk(min='27')
|
manifest_input = self.manifest_tmpl % self.uses_sdk(min='27')
|
||||||
expected = self.manifest_tmpl % self.uses_sdk(min='28', target='15')
|
expected = self.manifest_tmpl % self.uses_sdk(min='28', target='16')
|
||||||
output = self.raise_min_sdk_version_test(manifest_input, '28', '29', True)
|
output = self.raise_min_sdk_version_test(manifest_input, '28', '29', True)
|
||||||
self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class RaiseMinSdkVersionTest(unittest.TestCase):
|
||||||
"""Tests inserting targetSdkVersion when minSdkVersion does not exist."""
|
"""Tests inserting targetSdkVersion when minSdkVersion does not exist."""
|
||||||
|
|
||||||
manifest_input = self.manifest_tmpl % ''
|
manifest_input = self.manifest_tmpl % ''
|
||||||
expected = self.manifest_tmpl % self.uses_sdk(min='28', target='15')
|
expected = self.manifest_tmpl % self.uses_sdk(min='28', target='16')
|
||||||
output = self.raise_min_sdk_version_test(manifest_input, '28', '29', True)
|
output = self.raise_min_sdk_version_test(manifest_input, '28', '29', True)
|
||||||
self.assertEqual(output, expected)
|
self.assertEqual(output, expected)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue