Keep signatures of presigned prebuilt test apps.

Skip the JNI uncompress step for presigned prebuilt test apps. They
don't need it, and they can invalidate the signature. Also, fix the
install partition of prebuilt test apps.

Fixes: 143472191
Test: app_test.go
Test: Converted CtsShimPrivUpgradePrebuilt to bp and checked the
final output apk signature.

Change-Id: Ied7d3576b5db4de40a9ca9e388336229d07212f5
This commit is contained in:
Jaewoong Jung
2020-01-13 09:55:39 -08:00
parent 5ce6dfbd36
commit 7c5bd835d0
2 changed files with 50 additions and 0 deletions

View File

@@ -1628,6 +1628,40 @@ func TestAndroidTestImport(t *testing.T) {
}
}
func TestAndroidTestImport_NoJinUncompressForPresigned(t *testing.T) {
ctx, _ := testJava(t, `
android_test_import {
name: "foo",
apk: "prebuilts/apk/app.apk",
certificate: "cert/new_cert",
data: [
"testdata/data",
],
}
android_test_import {
name: "foo_presigned",
apk: "prebuilts/apk/app.apk",
presigned: true,
data: [
"testdata/data",
],
}
`)
variant := ctx.ModuleForTests("foo", "android_common")
jniRule := variant.Output("jnis-uncompressed/foo.apk").RuleParams.Command
if !strings.HasPrefix(jniRule, "if (zipinfo") {
t.Errorf("Unexpected JNI uncompress rule command: " + jniRule)
}
variant = ctx.ModuleForTests("foo_presigned", "android_common")
jniRule = variant.Output("jnis-uncompressed/foo_presigned.apk").BuildParams.Rule.String()
if jniRule != android.Cp.String() {
t.Errorf("Unexpected JNI uncompress rule: " + jniRule)
}
}
func TestStl(t *testing.T) {
ctx, _ := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
cc_library {