Revert "enforce sdk_version for JNI libs for updatable APKs"

This reverts commit 98c4750f39.

Reason for revert: broken builds

Change-Id: Icd3a9e226ff8ff288b682757cded9f43069ebc5e
This commit is contained in:
Jooyung Han
2020-05-13 01:22:56 +00:00
parent 98c4750f39
commit cc928d9059
2 changed files with 1 additions and 150 deletions

View File

@@ -270,47 +270,19 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
func (a *AndroidApp) checkAppSdkVersions(ctx android.ModuleContext) {
if Bool(a.appProperties.Updatable) || a.ApexModuleBase.Updatable() {
if Bool(a.appProperties.Updatable) {
if !a.sdkVersion().stable() {
ctx.PropertyErrorf("sdk_version", "Updatable apps must use stable SDKs, found %v", a.sdkVersion())
}
if String(a.deviceProperties.Min_sdk_version) == "" {
ctx.PropertyErrorf("updatable", "updatable apps must set min_sdk_version.")
}
if minSdkVersion, err := a.minSdkVersion().effectiveVersion(ctx); err == nil {
a.checkJniLibsSdkVersion(ctx, minSdkVersion)
} else {
ctx.PropertyErrorf("min_sdk_version", "%s", err.Error())
}
}
a.checkPlatformAPI(ctx)
a.checkSdkVersions(ctx)
}
// If an updatable APK sets min_sdk_version, min_sdk_vesion of JNI libs should match with it.
// This check is enforced for "updatable" APKs (including APK-in-APEX).
// b/155209650: until min_sdk_version is properly supported, use sdk_version instead.
// because, sdk_version is overridden by min_sdk_version (if set as smaller)
// and linkType is checked with dependencies so we can be sure that the whole dependency tree
// will meet the requirements.
func (a *AndroidApp) checkJniLibsSdkVersion(ctx android.ModuleContext, minSdkVersion sdkVersion) {
// It's enough to check direct JNI deps' sdk_version because all transitive deps from JNI deps are checked in cc.checkLinkType()
ctx.VisitDirectDeps(func(m android.Module) {
if !IsJniDepTag(ctx.OtherModuleDependencyTag(m)) {
return
}
dep, _ := m.(*cc.Module)
jniSdkVersion, err := android.ApiStrToNum(ctx, dep.SdkVersion())
if err != nil || int(minSdkVersion) < jniSdkVersion {
ctx.OtherModuleErrorf(dep, "sdk_version(%v) is higher than min_sdk_version(%v) of the containing android_app(%v)",
dep.SdkVersion(), a.MinSdkVersion(), ctx.ModuleName())
return
}
})
}
// Returns true if the native libraries should be stored in the APK uncompressed and the
// extractNativeLibs application flag should be set to false in the manifest.
func (a *AndroidApp) useEmbeddedNativeLibs(ctx android.ModuleContext) bool {