Pass module-lib and system-server extension jars for system-server
While the `system-server` API surface extends the `module-lib` API surface a library can only provide one or the other as they appear in bootclasspath and systemserverclasspath respectively. A library that is on the bootclasspath cannot provide a `system-server` API as it would be usable by non-system server code. A library that is on the systemserverclasspath could provide a `module-lib` API but there is no point as it would only be usable by the system server making it effectively a `system-server` API anyway. As a result the `system-server` extension directories only contain `service-*` jars for libraries that provide system server APIs. e.g. ``` $ ls prebuilts/sdk/extensions/11/system-server | cat api service-adservices.jar service-sdksandbox.jar $ ls prebuilts/sdk/extensions/11/module-lib/ | cat api framework-adservices.jar framework-connectivity.jar framework-connectivity-t.jar framework-sdksandbox.jar framework-tethering.jar ``` So, in order to construct the whole `system-server` API, i.e. the API visible to the system server, it is necessary to add in the `module-lib` extension jars too which this change does. This is necessary to construct an `api-versions.xml` file for the complete `system-server` API. Bug: 336993217 Test: TARGETS=$(for i in public system module-lib module-lib-complete system-server-complete; do U=$(echo $i | sed "s|-|_|g"); echo "out/target/common/obj/PACKAGING/api_versions_${U}_generated-api-versions.xml"; done) m $TARGETS; mkdir -p before; cp $TARGETS before m $TARGETS; mkdir -p after; cp $TARGETS after meld before after # Review differences. Change-Id: Ic9652dd28f05e5f569a7a30a84b87f227314d119
This commit is contained in:
@@ -626,7 +626,8 @@ func (d *Droidstubs) apiLevelsGenerationFlags(ctx android.ModuleContext, cmd *an
|
||||
// privileged apps that are only defined since API level 21 (Lollipop), fallback to public stubs
|
||||
// for older releases. Similarly, module-lib falls back to system API.
|
||||
var sdkDirs []string
|
||||
switch proptools.StringDefault(d.properties.Api_levels_sdk_type, "public") {
|
||||
apiLevelsSdkType := proptools.StringDefault(d.properties.Api_levels_sdk_type, "public")
|
||||
switch apiLevelsSdkType {
|
||||
case "system-server":
|
||||
sdkDirs = []string{"system-server", "module-lib", "system", "public"}
|
||||
case "module-lib":
|
||||
@@ -640,9 +641,22 @@ func (d *Droidstubs) apiLevelsGenerationFlags(ctx android.ModuleContext, cmd *an
|
||||
return
|
||||
}
|
||||
|
||||
// Construct a pattern to match the appropriate extensions that should be included in the
|
||||
// generated api-versions.xml file.
|
||||
//
|
||||
// Use the first item in the sdkDirs array as that is the sdk type for the target API levels
|
||||
// being generated but has the advantage over `Api_levels_sdk_type` as it has been validated.
|
||||
extensionsPattern := fmt.Sprintf(`/extensions/[0-9]+/%s/.*\.jar`, sdkDirs[0])
|
||||
// The exception is for system-server which needs to include module-lib and system-server. That
|
||||
// is because while system-server extends module-lib the system-server extension directory only
|
||||
// contains service-* modules which provide system-server APIs it does not list the modules which
|
||||
// only provide a module-lib, so they have to be included separately.
|
||||
extensionSurfacesPattern := sdkDirs[0]
|
||||
if apiLevelsSdkType == "system-server" {
|
||||
// Take the first two items in sdkDirs, which are system-server and module-lib, and construct
|
||||
// a pattern that will match either.
|
||||
extensionSurfacesPattern = strings.Join(sdkDirs[0:2], "|")
|
||||
}
|
||||
extensionsPattern := fmt.Sprintf(`/extensions/[0-9]+/(%s)/.*\.jar`, extensionSurfacesPattern)
|
||||
|
||||
var dirs []string
|
||||
var extensions_dir string
|
||||
|
Reference in New Issue
Block a user