runtime_resource_overlay can be included in APEXes
runtime_resource_overlay is put to an APEX via 'apps' property. It is placed under ./overlay directory in it. Bug: 154822536 Test: m Change-Id: I8edf4a26c26368c52fb7b327b2ecc829f21ea148
This commit is contained in:
parent
9105fa385a
commit
69aeba9982
27
apex/apex.go
27
apex/apex.go
|
@ -62,6 +62,7 @@ var (
|
|||
certificateTag = dependencyTag{name: "certificate"}
|
||||
usesTag = dependencyTag{name: "uses"}
|
||||
androidAppTag = dependencyTag{name: "androidApp", payload: true}
|
||||
rroTag = dependencyTag{name: "rro", payload: true}
|
||||
apexAvailWl = makeApexAvailableWhitelist()
|
||||
|
||||
inverseApexAvailWl = invertApexWhiteList(apexAvailWl)
|
||||
|
@ -1057,6 +1058,9 @@ type overridableProperties struct {
|
|||
// List of APKs to package inside APEX
|
||||
Apps []string
|
||||
|
||||
// List of runtime resource overlays (RROs) inside APEX
|
||||
Rros []string
|
||||
|
||||
// Names of modules to be overridden. Listed modules can only be other binaries
|
||||
// (in Make or Soong).
|
||||
// This does not completely prevent installation of the overridden binaries, but if both
|
||||
|
@ -1467,6 +1471,8 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||
func (a *apexBundle) OverridablePropertiesDepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(),
|
||||
androidAppTag, a.overridableProperties.Apps...)
|
||||
ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(),
|
||||
rroTag, a.overridableProperties.Rros...)
|
||||
}
|
||||
|
||||
func (a *apexBundle) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
|
||||
|
@ -1680,6 +1686,21 @@ func apexFileForAndroidApp(ctx android.BaseModuleContext, aapp interface {
|
|||
return af
|
||||
}
|
||||
|
||||
func apexFileForRuntimeResourceOverlay(ctx android.BaseModuleContext, rro java.RuntimeResourceOverlayModule) apexFile {
|
||||
rroDir := "overlay"
|
||||
dirInApex := filepath.Join(rroDir, rro.Theme())
|
||||
fileToCopy := rro.OutputFile()
|
||||
af := newApexFile(ctx, fileToCopy, rro.Name(), dirInApex, app, rro)
|
||||
af.certificate = rro.Certificate()
|
||||
|
||||
if a, ok := rro.(interface {
|
||||
OverriddenManifestPackageName() string
|
||||
}); ok {
|
||||
af.overriddenPackageName = a.OverriddenManifestPackageName()
|
||||
}
|
||||
return af
|
||||
}
|
||||
|
||||
// Context "decorator", overriding the InstallBypassMake method to always reply `true`.
|
||||
type flattenedApexContext struct {
|
||||
android.ModuleContext
|
||||
|
@ -1964,6 +1985,12 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
} else {
|
||||
ctx.PropertyErrorf("apps", "%q is not an android_app module", depName)
|
||||
}
|
||||
case rroTag:
|
||||
if rro, ok := child.(java.RuntimeResourceOverlayModule); ok {
|
||||
filesInfo = append(filesInfo, apexFileForRuntimeResourceOverlay(ctx, rro))
|
||||
} else {
|
||||
ctx.PropertyErrorf("rros", "%q is not an runtime_resource_overlay module", depName)
|
||||
}
|
||||
case prebuiltTag:
|
||||
if prebuilt, ok := child.(android.PrebuiltEtcModule); ok {
|
||||
filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName))
|
||||
|
|
|
@ -521,6 +521,7 @@ func TestDefaults(t *testing.T) {
|
|||
native_shared_libs: ["mylib"],
|
||||
java_libs: ["myjar"],
|
||||
apps: ["AppFoo"],
|
||||
rros: ["rro"],
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
|
@ -561,12 +562,19 @@ func TestDefaults(t *testing.T) {
|
|||
system_modules: "none",
|
||||
apex_available: [ "myapex" ],
|
||||
}
|
||||
|
||||
runtime_resource_overlay {
|
||||
name: "rro",
|
||||
theme: "blue",
|
||||
}
|
||||
|
||||
`)
|
||||
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
|
||||
"etc/myetc",
|
||||
"javalib/myjar.jar",
|
||||
"lib64/mylib.so",
|
||||
"app/AppFoo/AppFoo.apk",
|
||||
"overlay/blue/rro.apk",
|
||||
})
|
||||
}
|
||||
|
||||
|
|
21
java/app.go
21
java/app.go
|
@ -1412,6 +1412,15 @@ type RuntimeResourceOverlayProperties struct {
|
|||
Resource_libs []string
|
||||
}
|
||||
|
||||
// RuntimeResourceOverlayModule interface is used by the apex package to gather information from
|
||||
// a RuntimeResourceOverlay module.
|
||||
type RuntimeResourceOverlayModule interface {
|
||||
android.Module
|
||||
OutputFile() android.Path
|
||||
Certificate() Certificate
|
||||
Theme() string
|
||||
}
|
||||
|
||||
func (r *RuntimeResourceOverlay) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
sdkDep := decodeSdkDep(ctx, sdkContext(r))
|
||||
if sdkDep.hasFrameworkLibs() {
|
||||
|
@ -1464,6 +1473,18 @@ func (r *RuntimeResourceOverlay) targetSdkVersion() sdkSpec {
|
|||
return r.sdkVersion()
|
||||
}
|
||||
|
||||
func (r *RuntimeResourceOverlay) Certificate() Certificate {
|
||||
return r.certificate
|
||||
}
|
||||
|
||||
func (r *RuntimeResourceOverlay) OutputFile() android.Path {
|
||||
return r.outputFile
|
||||
}
|
||||
|
||||
func (r *RuntimeResourceOverlay) Theme() string {
|
||||
return String(r.properties.Theme)
|
||||
}
|
||||
|
||||
// runtime_resource_overlay generates a resource-only apk file that can overlay application and
|
||||
// system resources at run time.
|
||||
func RuntimeResourceOverlayFactory() android.Module {
|
||||
|
|
Loading…
Reference in New Issue