Disable Hidden API Checks for ENG Builds

For more discussions/details, please check internal CL ag/24145146

Bug: 289409213
BUg: 285976182
Test: Look for hiddenapi calls in build trace
Change-Id: Ia2780ee419b8da1418ba1c7a7d732712b7c2a322
This commit is contained in:
Pratyush
2023-07-20 11:19:04 +00:00
parent 4c9b3e114b
commit faec4db56f
4 changed files with 19 additions and 6 deletions

View File

@@ -171,6 +171,19 @@ func (c Config) RunningInsideUnitTest() bool {
return c.config.TestProductVariables != nil
}
// DisableHiddenApiChecks returns true if hiddenapi checks have been disabled.
// 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.
// If both ENABLE_HIDDENAPI_FLAGS=true and UNSAFE_DISABLE_HIDDENAPI_FLAGS=true, then
// ENABLE_HIDDENAPI_FLAGS=true will be triggered and hiddenapi checks will be considered enabled.
func (c Config) DisableHiddenApiChecks() bool {
return !c.IsEnvTrue("ENABLE_HIDDENAPI_FLAGS") &&
(c.IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") ||
Bool(c.productVariables.Eng))
}
// MaxPageSizeSupported returns the max page size supported by the device. This
// value will define the ELF segment alignment for binaries (executables and
// shared libraries).