If max_sdk_version is included in Android.bp that value will now be
propagated to manifest_fixer.py. This value will then be used to
override any maxSdkVersion attribute set on permission or
uses-permission tags in the android manifest if maxSdkVersion="-1".
Bug: 223902327
Test: add max_sdk_version to Android.bp for test app
Test: create permission in test app manifest with maxSdkVersion="-1"
Test: run test to check maxSdkVersion=max_sdk_version
Change-Id: Ic533ef2a41b9ecc9ee68c69399026df47ee945b7
If the build file contains the apex_test module, add the
testOnly attribute to the application element of the
corresponding AndroidManifest file and set its value to true.
If the testOnly attribute is already present and has value
false, then do nothing.
Tests added in manifest_fixer_test.py to check if the updated
AndroidManifest file has the testOnly attribute set to true or not.
Bug: 213310150
Test: atest --host manifest_fixer_test
Test: m nothing
Test: manually checked the AndroidManifest file generated
Change-Id: I36247dbe0261c342d451a4422c314fd8fe0c2369
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
Unit test: go test ./... -test.v -run TestOverrideAndroidApp
Unit test: python manifest_fixer_test.py
BUG: 148198056
Change-Id: Ib5ff235d2a93e88b86aec1c0b16327ea938a094d
The new package manager behavior requires packages without source code
to have an application element with hasCode attribute set to false in
their manifest. With this change, Soong can now automatically insert one
for codeless apps.
Test: app_test.go, manifest_fixer_test.py
Fixes: 124375490
Change-Id: Ied89a8d07c63805ab910859a4f7c45fc1c60bb73
Add a tool that can check that the <uses-library> tags in an
AndroidManifest.xml file match a list provided by the build.
Bug: 132357300
Test: manifest_check_test
Change-Id: If15abf792282bef677469595e80f19923b87ab62
Only put uncompressed native libs in an APK if the min_sdk_version
supports it (>= 23, Marshmallow), and set
android:extractNativeLibs="false" in the AndroidManifest.xml so
that the platform won't extract them anyways.
Bug: 117618214
Test: m checkbuild
Change-Id: I760017e48bf3c6b618aabde0982df45995765d48
The last change should have changed this from taking a boolean to a
simple switch.
Test: build a package with LOCAL_PREFER_INTEGRITY=true
Bug: 112037137
Change-Id: I5ce3b1455404b5c8e781496d26c0431db52a170f
If provided (--prefer-integrity=true/false), the script will set the
value in the the manifest. The script will fail if the value mismatches
the original in the manifest, if any.
Test: scripts/manifest_fixer_test.py
Test: aapt dumps the attribute and observe
Bug: 112037137
Change-Id: I2b333a7c0747dbcbed4d419f1c9ed46d4a4c98e9
The two java shared libraries do not exist in the pre-P devices.
Therefore, marking the dependencies to the libraries as optional so that
an app is still installable to the old devices.
This is safe because the classes in the java shared libs exist in other
shared libraries (bootclasspath or android.test.runner).
Bug: 113800422
Test: run aapt dump badging on the built GtsBackupHostTestCases
uses-library tags for android.test.base|mock are with
android:required=false, while the same tag for other libs are without
the attribute.
Change-Id: I266c8efb9686e8975be37f31aea0dc22f82370c3
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
targetSdkVersion should stay as "current" when min_sdk_version
is set but sdk_version is not.
Bug: 112438448
Test: atest CtsTelecomTestCases
Change-Id: I11dc27eccd31200d1ce27c7e332106bb825651b4
Add new command line flag to manifest_fixer.py which will add
'android:usesNonSdkApi="true"' attribute to the <application> tag.
Bug: 113315999
Test: build/soong/scripts/manifest_fixer.py
Change-Id: If030c90a4ced3f5c5176727c579a87d0ecab6cf8
If targetSdkVersion is not set in the manifest, set it to the
value it was implicitly using before changing minSdkVersion.
Requires passing --library to manifest_fixer.py to distinguish
between apps, where the implicit value was set by aapt2 to
current, or libraries where the implicit value was 1.
Fixes cases where the manifest does not specify targetSdkVersion
and was inheriting the minSdkVersion value until manifest merger
started merging a lower targetSdkVersion value from a library.
Bug: 111347801
Test: manifest_fixer_test.py
Change-Id: I8fcf0c5f452707565ba1808f6fe552ffed055c47
`--uses-library foo` adds <uses-library android:name="foo"
android:required="true"/> element to the manifest.
When there is already a uses-library element with the same
name, then the hand-written element is respected.
Test: m -j
Test: build/soong/scripts/manifest_fixer_test.py
Change-Id: Ia5e989d3c3c3fba7cc9015a6d16dac70464282a8
Add a script that can inject a <uses-sdk minSdkVersion=""> into
AndroidManifest.xml files. This will help with merging
LOCAL_STATIC_ANDROID_LIBRARIES, because ManifestMerger treats
a missing minSdkVersion as minSdkVersion=1 and throws errors
if libraries use a larger minSdkVersion. It will also help
with cases where an app has a manifest that specifies an old
minSdkVersion, but the build system is compiling the app in
a way that is not compatibile with old devices, for example
using a newer dex format.
Bug: 110167203
Test: m java
Test: build/soong/scripts/manifest_fixer_test.py
Change-Id: I528d71a225feb86464c530e11b223babb0ea9edf