Loading java/app.go +8 −1 Original line number Original line Diff line number Diff line Loading @@ -1286,6 +1286,9 @@ type AndroidAppImportProperties struct { // be set for presigned modules. // be set for presigned modules. Presigned *bool Presigned *bool // Name of the signing certificate lineage file. Lineage *string // Sign with the default system dev certificate. Must be used judiciously. Most imported apps // Sign with the default system dev certificate. Must be used judiciously. Most imported apps // need to either specify a specific certificate or be presigned. // need to either specify a specific certificate or be presigned. Default_dev_cert *bool Default_dev_cert *bool Loading Loading @@ -1484,7 +1487,11 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext } } a.certificate = certificates[0] a.certificate = certificates[0] signed := android.PathForModuleOut(ctx, "signed", apkFilename) signed := android.PathForModuleOut(ctx, "signed", apkFilename) SignAppPackage(ctx, signed, dexOutput, certificates, nil, nil) var lineageFile android.Path if lineage := String(a.properties.Lineage); lineage != "" { lineageFile = android.PathForModuleSrc(ctx, lineage) } SignAppPackage(ctx, signed, dexOutput, certificates, nil, lineageFile) a.outputFile = signed a.outputFile = signed } else { } else { alignedApk := android.PathForModuleOut(ctx, "zip-aligned", apkFilename) alignedApk := android.PathForModuleOut(ctx, "zip-aligned", apkFilename) Loading java/app_test.go +21 −0 Original line number Original line Diff line number Diff line Loading @@ -2131,6 +2131,27 @@ func TestAndroidAppImport_Presigned(t *testing.T) { } } } } func TestAndroidAppImport_SigningLineage(t *testing.T) { ctx, _ := testJava(t, ` android_app_import { name: "foo", apk: "prebuilts/apk/app.apk", certificate: "platform", lineage: "lineage.bin", } `) variant := ctx.ModuleForTests("foo", "android_common") // Check cert signing lineage flag. signedApk := variant.Output("signed/foo.apk") signingFlag := signedApk.Args["flags"] expected := "--lineage lineage.bin" if expected != signingFlag { t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag) } } func TestAndroidAppImport_DefaultDevCert(t *testing.T) { func TestAndroidAppImport_DefaultDevCert(t *testing.T) { ctx, _ := testJava(t, ` ctx, _ := testJava(t, ` android_app_import { android_app_import { Loading Loading
java/app.go +8 −1 Original line number Original line Diff line number Diff line Loading @@ -1286,6 +1286,9 @@ type AndroidAppImportProperties struct { // be set for presigned modules. // be set for presigned modules. Presigned *bool Presigned *bool // Name of the signing certificate lineage file. Lineage *string // Sign with the default system dev certificate. Must be used judiciously. Most imported apps // Sign with the default system dev certificate. Must be used judiciously. Most imported apps // need to either specify a specific certificate or be presigned. // need to either specify a specific certificate or be presigned. Default_dev_cert *bool Default_dev_cert *bool Loading Loading @@ -1484,7 +1487,11 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext } } a.certificate = certificates[0] a.certificate = certificates[0] signed := android.PathForModuleOut(ctx, "signed", apkFilename) signed := android.PathForModuleOut(ctx, "signed", apkFilename) SignAppPackage(ctx, signed, dexOutput, certificates, nil, nil) var lineageFile android.Path if lineage := String(a.properties.Lineage); lineage != "" { lineageFile = android.PathForModuleSrc(ctx, lineage) } SignAppPackage(ctx, signed, dexOutput, certificates, nil, lineageFile) a.outputFile = signed a.outputFile = signed } else { } else { alignedApk := android.PathForModuleOut(ctx, "zip-aligned", apkFilename) alignedApk := android.PathForModuleOut(ctx, "zip-aligned", apkFilename) Loading
java/app_test.go +21 −0 Original line number Original line Diff line number Diff line Loading @@ -2131,6 +2131,27 @@ func TestAndroidAppImport_Presigned(t *testing.T) { } } } } func TestAndroidAppImport_SigningLineage(t *testing.T) { ctx, _ := testJava(t, ` android_app_import { name: "foo", apk: "prebuilts/apk/app.apk", certificate: "platform", lineage: "lineage.bin", } `) variant := ctx.ModuleForTests("foo", "android_common") // Check cert signing lineage flag. signedApk := variant.Output("signed/foo.apk") signingFlag := signedApk.Args["flags"] expected := "--lineage lineage.bin" if expected != signingFlag { t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag) } } func TestAndroidAppImport_DefaultDevCert(t *testing.T) { func TestAndroidAppImport_DefaultDevCert(t *testing.T) { ctx, _ := testJava(t, ` ctx, _ := testJava(t, ` android_app_import { android_app_import { Loading