summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2022-11-17 04:29:59 +0000
committer Spandan Das <spandandas@google.com> 2022-11-21 22:59:38 +0000
commit757b666c7f7c65e678d93994955d7792a265ba14 (patch)
tree941eb292f568b71cb9c8b1bc7eb01bc4372a8f68 /java/java_test.go
parent877336cc3a7b66f8a1cfa6bedc426c7429ea78c9 (diff)
Add min_sdk_version to aidlCmd for droidstubs
JavaDoc's implementation of `aidlFlags` omits `min_sdk_version`, and therefore aidl compiler would default it to a default version. To fix this, pass the min_sdk_version explicitly Bug: 253122520 Test: TH Test: go test ./java Change-Id: Ia8f639174f8361136596d0e7b3286606f84705cd
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index f06b520d5..ee83ee2f4 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -1370,6 +1370,39 @@ func TestAidlFlagsWithMinSdkVersion(t *testing.T) {
}
}
+func TestAidlFlagsMinSdkVersionDroidstubs(t *testing.T) {
+ bpTemplate := `
+ droidstubs {
+ name: "foo-stubs",
+ srcs: ["foo.aidl"],
+ %s
+ system_modules: "none",
+ }
+ `
+ testCases := []struct {
+ desc string
+ sdkVersionBp string
+ minSdkVersionExpected string
+ }{
+ {
+ desc: "sdk_version not set, module compiles against private platform APIs",
+ sdkVersionBp: ``,
+ minSdkVersionExpected: "10000",
+ },
+ {
+ desc: "sdk_version set to none, module does not build against an SDK",
+ sdkVersionBp: `sdk_version: "none",`,
+ minSdkVersionExpected: "10000",
+ },
+ }
+ for _, tc := range testCases {
+ ctx := prepareForJavaTest.RunTestWithBp(t, fmt.Sprintf(bpTemplate, tc.sdkVersionBp))
+ aidlCmd := ctx.ModuleForTests("foo-stubs", "android_common").Rule("aidl").RuleParams.Command
+ expected := "--min_sdk_version=" + tc.minSdkVersionExpected
+ android.AssertStringDoesContain(t, "aidl command conatins incorrect min_sdk_version for testCse: "+tc.desc, aidlCmd, expected)
+ }
+}
+
func TestAidlEnforcePermissions(t *testing.T) {
ctx, _ := testJava(t, `
java_library {