如何控制 Android Studio 中的 "call requires permission..." 错误?

How to control "call requires permission..." errors in Android Studio?

我已将权限检查封装到实用程序方法中,现在我正在接收

Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential SecurityException

错误。

像这样:

是否可以智能控制这个错误,例如,通过添加一些注释(不仅仅是完全禁用检查)?

Is it possible to smart control this error

这本身不是错误,而是静态代码分析生成的警告,很可能是捆绑的 Lint. If that is so, you can suppress it by using @SuppressWarnings() annotation. See official docs on that: Suppressing Lint Warnings