Propagate max_sdk_version to manifest_fixer

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
This commit is contained in:
William Loh
2022-05-17 20:21:50 +00:00
parent 78ce8c23de
commit 5a082f9a33
9 changed files with 136 additions and 0 deletions

View File

@@ -204,6 +204,10 @@ type DeviceProperties struct {
// Defaults to empty string "". See sdk_version for possible values.
Max_sdk_version *string
// if not blank, set the maxSdkVersion properties of permission and uses-permission tags.
// Defaults to empty string "". See sdk_version for possible values.
Replace_max_sdk_version_placeholder *string
// if not blank, set the targetSdkVersion in the AndroidManifest.xml.
// Defaults to sdk_version if not set. See sdk_version for possible values.
Target_sdk_version *string
@@ -649,6 +653,11 @@ func (j *Module) MaxSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
return android.SdkSpecFrom(ctx, maxSdkVersion)
}
func (j *Module) ReplaceMaxSdkVersionPlaceholder(ctx android.EarlyModuleContext) android.SdkSpec {
replaceMaxSdkVersionPlaceholder := proptools.StringDefault(j.deviceProperties.Replace_max_sdk_version_placeholder, "")
return android.SdkSpecFrom(ctx, replaceMaxSdkVersionPlaceholder)
}
func (j *Module) MinSdkVersionString() string {
return j.minSdkVersion.Raw
}