Disable verify_overlaps test instead of hiddenapi check.

Disabling hiddenapi check entirely can be dangerous and it might change the
accessibility of @hide Api too. We should only disable verify_overlaps
test which is required for module_sdk and apexes mismatch.

Test: atest CtsInlineMockingTestCases
Bug: 308187068
Bug: 307480026
Change-Id: I44f48e85d802b3a8f2711bc2047bdab721369f08
diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go
index 81be33d..fbc0197 100644
--- a/java/hiddenapi_modular.go
+++ b/java/hiddenapi_modular.go
@@ -358,7 +358,7 @@
 
 	// If there are stub flag files that have been generated by fragments on which this depends then
 	// use them to validate the stub flag file generated by the rules created by this method.
-	if len(stubFlagSubsets) > 0 {
+	if !ctx.Config().DisableVerifyOverlaps() && len(stubFlagSubsets) > 0 {
 		validFile := buildRuleValidateOverlappingCsvFiles(ctx, name, desc, outputPath, stubFlagSubsets,
 			HIDDENAPI_STUB_FLAGS_IMPL_FLAGS)
 
@@ -1006,7 +1006,7 @@
 
 	// If there are flag files that have been generated by fragments on which this depends then use
 	// them to validate the flag file generated by the rules created by this method.
-	if len(flagSubsets) > 0 {
+	if !ctx.Config().DisableVerifyOverlaps() && len(flagSubsets) > 0 {
 		validFile := buildRuleValidateOverlappingCsvFiles(ctx, name, desc, outputPath, flagSubsets,
 			HIDDENAPI_FLAGS_CSV_IMPL_FLAGS)