Expand preprocessed flag to work on android_app_imports

Setting the preprocessed flag will now also verify that the apk is
zip-aligned and does not have compressed JNI libs or dex files.

Bug: 185811447
Test: m nothing
Change-Id: I01b7c25f390345b14385f6f9e1640f48a5d9dc93
diff --git a/java/app_import_test.go b/java/app_import_test.go
index 8093024..845a962 100644
--- a/java/app_import_test.go
+++ b/java/app_import_test.go
@@ -657,6 +657,30 @@
 	}
 }
 
+// TODO(b/185811447) Uncomment this after all existing failing apks set skip_preprocessed_apk_checks: true
+//func TestAndroidAppImport_Preprocessed(t *testing.T) {
+//	ctx, _ := testJava(t, `
+//		android_app_import {
+//			name: "foo",
+//			apk: "prebuilts/apk/app.apk",
+//			presigned: true,
+//			preprocessed: true,
+//		}
+//		`)
+//
+//	apkName := "foo.apk"
+//	variant := ctx.ModuleForTests("foo", "android_common")
+//	outputBuildParams := variant.Output("validated-prebuilt/" + apkName).BuildParams
+//	if outputBuildParams.Rule.String() != android.Cp.String() {
+//		t.Errorf("Unexpected prebuilt android_app_import rule: " + outputBuildParams.Rule.String())
+//	}
+//
+//	// Make sure compression and aligning were validated.
+//	if len(outputBuildParams.Validations) != 2 {
+//		t.Errorf("Expected compression/alignment validation rules, found %d validations", len(outputBuildParams.Validations))
+//	}
+//}
+
 func TestAndroidTestImport_UncompressDex(t *testing.T) {
 	testCases := []struct {
 		name string