Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7daf2786 authored by Alyssa Ketpreechasawat's avatar Alyssa Ketpreechasawat
Browse files

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
parent 4ea88503
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -167,8 +167,7 @@ func (c Config) RunningInsideUnitTest() bool {
}

// DisableHiddenApiChecks returns true if hiddenapi checks have been disabled.
// For 'eng' target variant hiddenapi checks are disabled by default for performance optimisation
// Hiddenapi checks are also disabled when RELEASE_DEFAULT_MODULE_BUILD_FROM_SOURCE is set to false
// For 'eng' target variant hiddenapi checks are disabled by default for performance optimisation,
// but can be enabled by setting environment variable ENABLE_HIDDENAPI_FLAGS=true.
// For other target variants hiddenapi check are enabled by default but can be disabled by
// setting environment variable UNSAFE_DISABLE_HIDDENAPI_FLAGS=true.
@@ -177,8 +176,16 @@ func (c Config) RunningInsideUnitTest() bool {
func (c Config) DisableHiddenApiChecks() bool {
	return !c.IsEnvTrue("ENABLE_HIDDENAPI_FLAGS") &&
		(c.IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") ||
			Bool(c.productVariables.Eng) ||
			!c.ReleaseDefaultModuleBuildFromSource())
			Bool(c.productVariables.Eng))
}

// DisableVerifyOverlaps returns true if verify_overlaps is skipped.
// Mismatch in version of apexes and module SDK is required for mainline prebuilts to work in
// trunk stable.
// Thus, verify_overlaps is disabled when RELEASE_DEFAULT_MODULE_BUILD_FROM_SOURCE is set to false.
// TODO(b/308174018): Re-enable verify_overlaps for both builr from source/mainline prebuilts.
func (c Config) DisableVerifyOverlaps() bool {
	return c.IsEnvTrue("DISABLE_VERIFY_OVERLAPS") || !c.ReleaseDefaultModuleBuildFromSource()
}

// MaxPageSizeSupported returns the max page size supported by the device. This
+2 −2
Original line number Diff line number Diff line
@@ -358,7 +358,7 @@ func buildRuleToGenerateHiddenAPIStubFlagsFile(ctx android.BuilderContext, name,

	// 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 @@ func buildRuleToGenerateHiddenApiFlags(ctx android.BuilderContext, name, desc st

	// 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)