diff --git a/android/config.go b/android/config.go index b4b0be877..1d8cdba40 100644 --- a/android/config.go +++ b/android/config.go @@ -477,12 +477,22 @@ func (c *deviceConfig) NativeCoverageEnabled() bool { } func (c *deviceConfig) CoverageEnabledForPath(path string) bool { + coverage := false if c.config.ProductVariables.CoveragePaths != nil { for _, prefix := range *c.config.ProductVariables.CoveragePaths { if strings.HasPrefix(path, prefix) { - return true + coverage = true + break } } } - return false + if coverage && c.config.ProductVariables.CoverageExcludePaths != nil { + for _, prefix := range *c.config.ProductVariables.CoverageExcludePaths { + if strings.HasPrefix(path, prefix) { + coverage = false + break + } + } + } + return coverage } diff --git a/android/variable.go b/android/variable.go index 68fa7cd02..c5b957be5 100644 --- a/android/variable.go +++ b/android/variable.go @@ -121,8 +121,9 @@ type productVariables struct { ClangTidy *bool `json:",omitempty"` TidyChecks *string `json:",omitempty"` - NativeCoverage *bool `json:",omitempty"` - CoveragePaths *[]string `json:",omitempty"` + NativeCoverage *bool `json:",omitempty"` + CoveragePaths *[]string `json:",omitempty"` + CoverageExcludePaths *[]string `json:",omitempty"` DevicePrefer32BitExecutables *bool `json:",omitempty"` HostPrefer32BitExecutables *bool `json:",omitempty"`