diff options
Diffstat (limited to 'apex/builder.go')
| -rw-r--r-- | apex/builder.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/apex/builder.go b/apex/builder.go index 464d84377..40adfcab7 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -20,6 +20,7 @@ import ( "path/filepath" "runtime" "sort" + "strconv" "strings" "android/soong/android" @@ -139,6 +140,7 @@ var ( apexBundleRule = pctx.StaticRule("apexBundleRule", blueprint.RuleParams{ Command: `${zip2zip} -i $in -o $out.base ` + `apex_payload.img:apex/${abi}.img ` + + `apex_build_info.pb:apex/${abi}.build_info.pb ` + `apex_manifest.json:root/apex_manifest.json ` + `apex_manifest.pb:root/apex_manifest.pb ` + `AndroidManifest.xml:manifest/AndroidManifest.xml ` + @@ -205,7 +207,7 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs, }, }) - if proptools.Bool(a.properties.Legacy_android10_support) { + if a.minSdkVersion(ctx) == android.SdkVersion_Android10 { // b/143654022 Q apexd can't understand newly added keys in apex_manifest.json // prepare stripped-down version so that APEX modules built from R+ can be installed to Q a.manifestJsonOut = android.PathForModuleOut(ctx, "apex_manifest.json") @@ -354,7 +356,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { var emitCommands []string imageContentFile := android.PathForModuleOut(ctx, "content.txt") emitCommands = append(emitCommands, "echo ./apex_manifest.pb >> "+imageContentFile.String()) - if proptools.Bool(a.properties.Legacy_android10_support) { + if a.minSdkVersion(ctx) == android.SdkVersion_Android10 { emitCommands = append(emitCommands, "echo ./apex_manifest.json >> "+imageContentFile.String()) } for _, fi := range a.filesInfo { @@ -453,10 +455,9 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { targetSdkVersion := ctx.Config().DefaultAppTargetSdk() minSdkVersion := ctx.Config().DefaultAppTargetSdk() - // TODO: this should be based on min_sdk_version property of an APEX. - if proptools.Bool(a.properties.Legacy_android10_support) { - targetSdkVersion = "29" - minSdkVersion = "29" + if a.minSdkVersion(ctx) == android.SdkVersion_Android10 { + minSdkVersion = strconv.Itoa(a.minSdkVersion(ctx)) + targetSdkVersion = strconv.Itoa(a.minSdkVersion(ctx)) } if java.UseApiFingerprint(ctx) { @@ -485,7 +486,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { ctx.PropertyErrorf("test_only_no_hashtree", "not available") return } - if !proptools.Bool(a.properties.Legacy_android10_support) || a.testOnlyShouldSkipHashtreeGeneration() { + if a.minSdkVersion(ctx) > android.SdkVersion_Android10 || a.testOnlyShouldSkipHashtreeGeneration() { // Apexes which are supposed to be installed in builtin dirs(/system, etc) // don't need hashtree for activation. Therefore, by removing hashtree from // apex bundle (filesystem image in it, to be specific), we can save storage. @@ -498,7 +499,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { optFlags = append(optFlags, "--do_not_check_keyname") } - if proptools.Bool(a.properties.Legacy_android10_support) { + if a.minSdkVersion(ctx) == android.SdkVersion_Android10 { implicitInputs = append(implicitInputs, a.manifestJsonOut) optFlags = append(optFlags, "--manifest_json "+a.manifestJsonOut.String()) } @@ -657,6 +658,9 @@ func (a *apexBundle) getOverrideManifestPackageName(ctx android.ModuleContext) s } return "" } + if a.overridableProperties.Package_name != "" { + return a.overridableProperties.Package_name + } manifestPackageName, overridden := ctx.DeviceConfig().OverrideManifestPackageNameFor(ctx.ModuleName()) if overridden { return manifestPackageName |