apex: Deprecate legacy_android10_support prop am: 5417f775e5
am: 14b360507a
Change-Id: I52872ae44fd2dfc9ef4a299aaf1412ec43e9fd8a
This commit is contained in:
@@ -21,13 +21,14 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
SdkVersion_Android10 = 29
|
||||||
|
)
|
||||||
|
|
||||||
type ApexInfo struct {
|
type ApexInfo struct {
|
||||||
// Name of the apex variant that this module is mutated into
|
// Name of the apex variant that this module is mutated into
|
||||||
ApexName string
|
ApexName string
|
||||||
|
|
||||||
// Whether this apex variant needs to target Android 10
|
|
||||||
LegacyAndroid10Support bool
|
|
||||||
|
|
||||||
MinSdkVersion int
|
MinSdkVersion int
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +208,7 @@ func (m *ApexModuleBase) ChooseSdkVersion(versionList []string, useLatest bool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *ApexModuleBase) ShouldSupportAndroid10() bool {
|
func (m *ApexModuleBase) ShouldSupportAndroid10() bool {
|
||||||
return !m.IsForPlatform() && (m.ApexProperties.Info.MinSdkVersion <= 29 || m.ApexProperties.Info.LegacyAndroid10Support)
|
return !m.IsForPlatform() && (m.ApexProperties.Info.MinSdkVersion <= SdkVersion_Android10)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ApexModuleBase) checkApexAvailableProperty(mctx BaseModuleContext) {
|
func (m *ApexModuleBase) checkApexAvailableProperty(mctx BaseModuleContext) {
|
||||||
|
@@ -1064,11 +1064,9 @@ func apexDepsMutator(mctx android.TopDownMutatorContext) {
|
|||||||
var apexBundles []android.ApexInfo
|
var apexBundles []android.ApexInfo
|
||||||
var directDep bool
|
var directDep bool
|
||||||
if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex {
|
if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex {
|
||||||
minSdkVersion := a.minSdkVersion(mctx)
|
|
||||||
apexBundles = []android.ApexInfo{android.ApexInfo{
|
apexBundles = []android.ApexInfo{android.ApexInfo{
|
||||||
ApexName: mctx.ModuleName(),
|
ApexName: mctx.ModuleName(),
|
||||||
LegacyAndroid10Support: proptools.Bool(a.properties.Legacy_android10_support),
|
MinSdkVersion: a.minSdkVersion(mctx),
|
||||||
MinSdkVersion: minSdkVersion,
|
|
||||||
}}
|
}}
|
||||||
directDep = true
|
directDep = true
|
||||||
} else if am, ok := mctx.Module().(android.ApexModule); ok {
|
} else if am, ok := mctx.Module().(android.ApexModule); ok {
|
||||||
@@ -1312,10 +1310,6 @@ type apexBundleProperties struct {
|
|||||||
// Should be only used in tests#.
|
// Should be only used in tests#.
|
||||||
Test_only_no_hashtree *bool
|
Test_only_no_hashtree *bool
|
||||||
|
|
||||||
// Whether this APEX should support Android10. Default is false. If this is set true, then apex_manifest.json is bundled as well
|
|
||||||
// because Android10 requires legacy apex_manifest.json instead of apex_manifest.pb
|
|
||||||
Legacy_android10_support *bool
|
|
||||||
|
|
||||||
IsCoverageVariant bool `blueprint:"mutated"`
|
IsCoverageVariant bool `blueprint:"mutated"`
|
||||||
|
|
||||||
// Whether this APEX is considered updatable or not. When set to true, this will enforce additional
|
// Whether this APEX is considered updatable or not. When set to true, this will enforce additional
|
||||||
|
@@ -3737,7 +3737,7 @@ func TestLegacyAndroid10Support(t *testing.T) {
|
|||||||
name: "myapex",
|
name: "myapex",
|
||||||
key: "myapex.key",
|
key: "myapex.key",
|
||||||
native_shared_libs: ["mylib"],
|
native_shared_libs: ["mylib"],
|
||||||
legacy_android10_support: true,
|
min_sdk_version: "29",
|
||||||
}
|
}
|
||||||
|
|
||||||
apex_key {
|
apex_key {
|
||||||
|
@@ -20,6 +20,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
@@ -206,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
|
// 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
|
// prepare stripped-down version so that APEX modules built from R+ can be installed to Q
|
||||||
a.manifestJsonOut = android.PathForModuleOut(ctx, "apex_manifest.json")
|
a.manifestJsonOut = android.PathForModuleOut(ctx, "apex_manifest.json")
|
||||||
@@ -355,7 +356,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
|||||||
var emitCommands []string
|
var emitCommands []string
|
||||||
imageContentFile := android.PathForModuleOut(ctx, "content.txt")
|
imageContentFile := android.PathForModuleOut(ctx, "content.txt")
|
||||||
emitCommands = append(emitCommands, "echo ./apex_manifest.pb >> "+imageContentFile.String())
|
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())
|
emitCommands = append(emitCommands, "echo ./apex_manifest.json >> "+imageContentFile.String())
|
||||||
}
|
}
|
||||||
for _, fi := range a.filesInfo {
|
for _, fi := range a.filesInfo {
|
||||||
@@ -454,10 +455,9 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
|||||||
targetSdkVersion := ctx.Config().DefaultAppTargetSdk()
|
targetSdkVersion := ctx.Config().DefaultAppTargetSdk()
|
||||||
minSdkVersion := ctx.Config().DefaultAppTargetSdk()
|
minSdkVersion := ctx.Config().DefaultAppTargetSdk()
|
||||||
|
|
||||||
// TODO: this should be based on min_sdk_version property of an APEX.
|
if a.minSdkVersion(ctx) == android.SdkVersion_Android10 {
|
||||||
if proptools.Bool(a.properties.Legacy_android10_support) {
|
minSdkVersion = strconv.Itoa(a.minSdkVersion(ctx))
|
||||||
targetSdkVersion = "29"
|
targetSdkVersion = strconv.Itoa(a.minSdkVersion(ctx))
|
||||||
minSdkVersion = "29"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if java.UseApiFingerprint(ctx) {
|
if java.UseApiFingerprint(ctx) {
|
||||||
@@ -486,7 +486,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
|||||||
ctx.PropertyErrorf("test_only_no_hashtree", "not available")
|
ctx.PropertyErrorf("test_only_no_hashtree", "not available")
|
||||||
return
|
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)
|
// Apexes which are supposed to be installed in builtin dirs(/system, etc)
|
||||||
// don't need hashtree for activation. Therefore, by removing hashtree from
|
// don't need hashtree for activation. Therefore, by removing hashtree from
|
||||||
// apex bundle (filesystem image in it, to be specific), we can save storage.
|
// apex bundle (filesystem image in it, to be specific), we can save storage.
|
||||||
@@ -499,7 +499,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
|||||||
optFlags = append(optFlags, "--do_not_check_keyname")
|
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)
|
implicitInputs = append(implicitInputs, a.manifestJsonOut)
|
||||||
optFlags = append(optFlags, "--manifest_json "+a.manifestJsonOut.String())
|
optFlags = append(optFlags, "--manifest_json "+a.manifestJsonOut.String())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user