Make the "will this code run on API n" analysis smarter
When lint finds a method call that is newer than minSdkVersion,
it looks to see if there is a version check conditional around
the call. This CL makes this check smarter in two ways:
(1) If the version check isn't inlined but is delegated to a utility
method, it now peeks inside method calls to see if a surrounding
conditional is performing a version check
(2) If the version check isn't surrounding the call, but is performed
earlier in the method followed by an exit, lint will no longer
flag that code either.
Fixes these bugs:
178686: lint does not recognize `sdk_int' > build.version_codes.lollipop
37728: Android Lint doesn't recognize "if (Build.VERSION.SDK_INT < 11) return;"
Change-Id: Ie327ba8a1de306aed8535ba3cf9b6e23e9daf717
4 files changed