diff --git a/java/app.go b/java/app.go index 5c694b984..e551569bb 100755 --- a/java/app.go +++ b/java/app.go @@ -1633,6 +1633,9 @@ type RuntimeResourceOverlayProperties struct { // module name in the form ":module". Certificate *string + // Name of the signing certificate lineage file. + Lineage *string + // optional theme name. If specified, the overlay package will be applied // only when the ro.boot.vendor.overlay.theme system property is set to the same value. Theme *string @@ -1698,7 +1701,11 @@ func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleC _, certificates := collectAppDeps(ctx, r, false, false) certificates = processMainCert(r.ModuleBase, String(r.properties.Certificate), certificates, ctx) signed := android.PathForModuleOut(ctx, "signed", r.Name()+".apk") - SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates, nil, nil) + var lineageFile android.Path + if lineage := String(r.properties.Lineage); lineage != "" { + lineageFile = android.PathForModuleSrc(ctx, lineage) + } + SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates, nil, lineageFile) r.certificate = certificates[0] r.outputFile = signed diff --git a/java/app_test.go b/java/app_test.go index f1759150d..2ccc074e3 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -2795,6 +2795,7 @@ func TestRuntimeResourceOverlay(t *testing.T) { runtime_resource_overlay { name: "foo", certificate: "platform", + lineage: "lineage.bin", product_specific: true, static_libs: ["bar"], resource_libs: ["baz"], @@ -2849,6 +2850,11 @@ func TestRuntimeResourceOverlay(t *testing.T) { // Check cert signing flag. signedApk := m.Output("signed/foo.apk") + lineageFlag := signedApk.Args["flags"] + expectedLineageFlag := "--lineage lineage.bin" + if expectedLineageFlag != lineageFlag { + t.Errorf("Incorrect signing lineage flags, expected: %q, got: %q", expectedLineageFlag, lineageFlag) + } signingFlag := signedApk.Args["certificates"] expected := "build/make/target/product/security/platform.x509.pem build/make/target/product/security/platform.pk8" if expected != signingFlag {