summaryrefslogtreecommitdiff
path: root/scripts/manifest_fixer_test.py
AgeCommit message (Collapse)Author
2024-09-13Support multiple <application> or <uses-sdk> elements in manifest_*.py Colin Cross
Manifests may now have multiple copies of elements if they are disambiguated with android:featureFlag attributes. Remove the restrictions on duplicate elements from manifest_check.py and manifest_fixer.py, and instead iterate over all matching elements. Test: manifest_check_test.py, manifest_fixer_test.py Bug: 365170653 Flag: EXEMPT bugfix Change-Id: Ib577439d03a808a20a5fcc3e15a3117e0970d729
2024-09-11Fix manifest_fixer.py warnings Colin Cross
Fix a few warnings showing up in manifest_*.py Test: manifest_fixer_test.py Test: manifest_check_test.py Flag: EXEMPT refactor Change-Id: I144100d6d4aa7f5dff7eec79b4bd2d9d5da52153
2024-05-15Revert "Revert^2 "Always embed jni libs and store uncompressed"" Jiyong Park
This reverts commit 20df11ef2b7a9bd5fd1c62eee5f7dffb9d560df4. Change-Id: I5645ddb9e0d2c0873916a9192aa3cfbc967fc2cc
2024-05-10Revert^2 "Always embed jni libs and store uncompressed" Jiyong Park
a71b90cf810cfdd2bc74e7fcf7a2741fce14ff4f Change-Id: I1c071c5449fa04adb14d17774f882e6adbff196b
2024-05-08Revert "Always embed jni libs and store uncompressed" Sam Chiu
Revert submission 3075263 Reason for revert: verifying the test failure b/339332424 Reverted changes: /q/submissionid:3075263 Change-Id: I0e1a526893ee6c591eaefadcee4bbbf321dfc1df
2024-05-04Always embed jni libs and store uncompressed Jiyong Park
Previously, unlike unbundled apps, if a platform app depends on a native library, it is not embedded in the app, but installed to <partition>/lib and the app is instead provided with a symlink to the lib. This actualy is a legacy from the original Android where native libraries couldn't be executed while embedded in the apk. To be executed, the native libs had to be extracted to a mutable storage, but that had a risk of breaking the verified boot, so libs couldn't be embedded. Since API level 23, execute-in-place of native libs has become possible. But platform apps had to opt-in (use_embedded_native_libs: true) for the feature for a reason that is unclear today. Perhaps, it was to save disk space in case when multiple apps share the same native library, but such cases are found to be very rare, or non-existing. With this CL, two changes are introduced: 1. jni libs are always embededd for all apps (bundled or unbundled) 2. use_embedded_native_libs is deprecated unless the module type is android_test or android_test_helper_app. It is now a no-op property. It's left just to not break existing bp files. This will make unbundled apps bigger, but given that unbundled apps built using android platform build system are tests, the size increase should be acceptible. Bug: 330276359 Test: m Change-Id: I7df993ea85bce1c0a7222000c403a974818c3362
2022-08-03Overriding placeholder version in updatable apks Alexei Nicoara
Test: presubmit, checked the app version after build locally Bug: 231691162 Change-Id: Icd242432540ea424235b226a45aac839dbc995be
2022-06-28Propagate max_sdk_version to manifest_fixer William Loh
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
2022-02-01Add testOnly attribute to AndroidManifest file of apex_test Gurpreet Singh
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
2021-11-10Convert soong scripts to python 3 Cole Faust
Except manifest_utils, which is used by apexer. Tests run: m construct_context_test manifest_check_test manifest_fixer_test test_config_fixer_test out/host/linux-x86/testcases/construct_context_test/x86_64/construct_context_test out/host/linux-x86/testcases/manifest_check_test/x86_64/manifest_check_test out/host/linux-x86/testcases/manifest_fixer_test/x86_64/manifest_fixer_test out/host/linux-x86/testcases/test_config_fixer_test/x86_64/test_config_fixer_test Bug: 203436762 Test: Tests listed above + presubmits Change-Id: Ife75b3af1efc871a2d8521d26153a262573bb706
2021-01-14manifest_fixer: Set targetSdkVersion to '16' for libraries Andrew Wheeler
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
2020-02-18Allow for setting a logging_parent for an Android App. Baligh Uddin
Unit test: go test ./... -test.v -run TestOverrideAndroidApp Unit test: python manifest_fixer_test.py BUG: 148198056 Change-Id: Ib5ff235d2a93e88b86aec1c0b16327ea938a094d
2019-06-03Touch up manifest if there's no source code. Jaewoong Jung
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
2019-05-24Add manifest_check tool Colin Cross
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
2019-05-24Move manifest_fixer to a python_binary_host module Colin Cross
In preparation for making it use multiple files so that some implementation can be shared with a new tool. Also make manifest_fixer_test a python_test_host, and add it to TEST_MAPPING. Test: m checkbuild Change-Id: Iaae177efcb978187b126d90359b82cdfd3176857
2019-05-14Fix manifest_fixer_test.py Jaewoong Jung
Test: manifest_fixer_test.py Change-Id: I18067070154578e2effad8c70bb07a414cbc6dc0
2019-02-08Make manifest and APK agree on uncompressed native libs Colin Cross
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
2019-01-29Rename preferCodeIntegrity to useEmbeddedDex Victor Hsieh
Test: build and run testing app Bug: 112037137 Change-Id: Ia82c2c3ba7eb32117a4be078ac31ee2ba510f9eb
2019-01-03manifest_fixer: rename to --prefer-code-integrity Victor Hsieh
During code review, the name change was suggested. Test: local CTS passed Bug: 112037137 Change-Id: I7eb25210afb45c7477b0d606574048a15c9c721d
2018-10-24Add --prefer-integrity option to manifest_fixer.py Victor Hsieh
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
2018-10-02Don't set targetSdkVersion to '1' for libraries Colin Cross
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
2018-09-10Make manifest_fixer.py keep targetSdkVersion high with min_sdk_version Colin Cross
targetSdkVersion should stay as "current" when min_sdk_version is set but sdk_version is not. Bug: 112438448 Test: atest CtsTelecomTestCases Change-Id: I11dc27eccd31200d1ce27c7e332106bb825651b4
2018-09-10Fix manifest_fixer_test.py Colin Cross
Fix tests after I8fcf0c5f452707565ba1808f6fe552ffed055c47. Test: manifest_fixer_test.py Change-Id: Ie55e28b537b960a5e0f4785eda2c0f619b89275c
2018-08-28Support setting android:usesNonSdkApi in manifest_fixer.py David Brazdil
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
2018-07-26Set targetSdkVersion in manifest_fixer Colin Cross
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
2018-06-20add --uses-library option to manifest_fixer.py Jiyong Park
`--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
2018-06-14Add a script to inject values into manifests Colin Cross
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