Support auto gen module type matching in neverallow
By removing the optional suffixes added for the auto-generated modules.
Test: m nothing
Bug: 381888358
Change-Id: Ic6f4c945b17dda6baf26d0d4096e6fc2b133618a
diff --git a/android/neverallow.go b/android/neverallow.go
index 5575879..d590d8e 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -706,6 +706,9 @@
}
func (r *rule) appliesToModuleType(moduleType string) bool {
+ // Remove prefix for auto-generated modules
+ moduleType = strings.TrimSuffix(moduleType, "__loadHookModule")
+ moduleType = strings.TrimSuffix(moduleType, "__bottomUpMutatorModule")
return (len(r.moduleTypes) == 0 || InList(moduleType, r.moduleTypes)) && !InList(moduleType, r.unlessModuleTypes)
}