Enforce min_sdk_version of apex(use_vendor:true)

Even though use_vendor:true is prohibited, there is media.swcodec apex
which is still use_vendor: true and also needs to support Android10.
(min_sdk_version: 29)

Because LLNDK stubs were provided only for the current VNDK version,
media.swcodec couldn't be built against min_sdk_version: 29.

This change introduces additional versions for LLNDK stubs which are
enforced when an apex with use_vendor: true sets min_sdk_version.

To make things easier, the versions of LLNDK stubs are borrowed from its
implementation libraries.

Bug: 147450930
Bug: 149591522
Test: TARGET_BUILD_APPS=com.android.media.swcodec m
      (with min_sdk_version: 29 set)
      check if liblog/libc/libm/libdl stubs are 29
      check if 29 stubs don't have new symbols.

Change-Id: I79946cbb4da6617138a96d2b254349d3a298e77b
This commit is contained in:
Jooyung Han
2020-03-13 15:23:36 +09:00
parent b04a4997b8
commit 380fc3615c
6 changed files with 189 additions and 63 deletions

View File

@@ -19,8 +19,14 @@ import (
"strings"
"android/soong/android"
"github.com/google/blueprint"
)
var llndkImplDep = struct {
blueprint.DependencyTag
}{}
var (
llndkLibrarySuffix = ".llndk"
llndkHeadersSuffix = ".llndk"
@@ -81,6 +87,9 @@ func (stub *llndkStubDecorator) compile(ctx ModuleContext, flags Flags, deps Pat
// For non-enforcing devices, vndkVer is empty. Use "current" in that case, too.
vndkVer = "current"
}
if stub.stubsVersion() != "" {
vndkVer = stub.stubsVersion()
}
objs, versionScript := compileStubLibrary(ctx, flags, String(stub.Properties.Symbol_file), vndkVer, "--llndk")
stub.versionScriptPath = versionScript
return objs
@@ -154,6 +163,10 @@ func (stub *llndkStubDecorator) link(ctx ModuleContext, flags Flags, deps PathDe
stub.libraryDecorator.flagExporter.Properties.Export_include_dirs = []string{}
}
if stub.stubsVersion() != "" {
stub.reexportFlags("-D" + versioningMacroName(ctx.baseModuleName()) + "=" + stub.stubsVersion())
}
return stub.libraryDecorator.link(ctx, flags, deps, objs)
}