diff options
Diffstat (limited to 'android/paths.go')
-rw-r--r-- | android/paths.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/android/paths.go b/android/paths.go index 99db22f6e..9c9914e33 100644 --- a/android/paths.go +++ b/android/paths.go @@ -20,6 +20,7 @@ import ( "os" "path/filepath" "reflect" + "regexp" "sort" "strings" @@ -2094,3 +2095,25 @@ func PathsIfNonNil(paths ...Path) Paths { } return ret } + +var thirdPartyDirPrefixExceptions = []*regexp.Regexp{ + regexp.MustCompile("^vendor/[^/]*google[^/]*/"), + regexp.MustCompile("^hardware/google/"), + regexp.MustCompile("^hardware/interfaces/"), + regexp.MustCompile("^hardware/libhardware[^/]*/"), + regexp.MustCompile("^hardware/ril/"), +} + +func IsThirdPartyPath(path string) bool { + thirdPartyDirPrefixes := []string{"external/", "vendor/", "hardware/"} + + if HasAnyPrefix(path, thirdPartyDirPrefixes) { + for _, prefix := range thirdPartyDirPrefixExceptions { + if prefix.MatchString(path) { + return false + } + } + return true + } + return false +} |