public class ServiceCastDetector
extends com.android.tools.lint.detector.api.Detector
implements com.android.tools.lint.detector.api.SourceCodeScanner
TODO: As of O we can start looking for the @SystemService annotation on the target interface class, and the value attribute will map back to the expected constant. This should let us get rid of the hardcoded lookup table below.
com.android.tools.lint.detector.api.Detector.BinaryResourceScanner, com.android.tools.lint.detector.api.Detector.ClassScanner, com.android.tools.lint.detector.api.Detector.GradleScanner, com.android.tools.lint.detector.api.Detector.OtherFileScanner, com.android.tools.lint.detector.api.Detector.ResourceFolderScanner, com.android.tools.lint.detector.api.Detector.UastScanner, com.android.tools.lint.detector.api.Detector.XmlScanner| Modifier and Type | Field and Description |
|---|---|
static com.android.tools.lint.detector.api.Implementation |
IMPLEMENTATION |
static com.android.tools.lint.detector.api.Issue |
ISSUE
Invalid cast to a type from the service constant
|
static com.android.tools.lint.detector.api.Issue |
WIFI_MANAGER
Using wifi manager from the wrong context
|
static com.android.tools.lint.detector.api.Issue |
WIFI_MANAGER_UNCERTAIN
Using wifi manager from the wrong context: unknown Context origin
|
| Constructor and Description |
|---|
ServiceCastDetector()
Constructs a new
ServiceCastDetector check |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<java.lang.String> |
getApplicableMethodNames() |
void |
visitMethod(com.android.tools.lint.detector.api.JavaContext context,
org.jetbrains.uast.UCallExpression call,
com.intellij.psi.PsiMethod method) |
afterCheckFile, afterCheckLibraryProject, afterCheckProject, analyzeCallGraph, applicableAnnotations, applicableSuperClasses, appliesTo, appliesTo, appliesToResourceRefs, beforeCheckFile, beforeCheckLibraryProject, beforeCheckProject, checkBinaryResource, checkCall, checkClass, checkClass, checkFolder, checkInstruction, createPsiVisitor, createUastHandler, fix, getApplicableAsmNodeTypes, getApplicableAttributes, getApplicableCallNames, getApplicableCallOwners, getApplicableConstructorTypes, getApplicableElements, getApplicableFiles, getApplicablePsiTypes, getApplicableReferenceNames, getApplicableUastTypes, getSpeed, isApplicableAnnotationUsage, isCallGraphRequired, run, visitAnnotationUsage, visitAttribute, visitBuildScript, visitClass, visitClass, visitConstructor, visitConstructor, visitDocument, visitElement, visitElementAfter, visitMethod, visitReference, visitReference, visitResourceReference, visitResourceReferenceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitanalyzeCallGraph, applicableAnnotations, applicableSuperClasses, appliesToResourceRefs, createUastHandler, getApplicableConstructorTypes, getApplicableReferenceNames, getApplicableUastTypes, isApplicableAnnotationUsage, isCallGraphRequired, visitAnnotationUsage, visitClass, visitClass, visitConstructor, visitReference, visitResourceReferencepublic static final com.android.tools.lint.detector.api.Implementation IMPLEMENTATION
public static final com.android.tools.lint.detector.api.Issue ISSUE
public static final com.android.tools.lint.detector.api.Issue WIFI_MANAGER
public static final com.android.tools.lint.detector.api.Issue WIFI_MANAGER_UNCERTAIN
public ServiceCastDetector()
ServiceCastDetector checkpublic java.util.List<java.lang.String> getApplicableMethodNames()
getApplicableMethodNames in interface com.android.tools.lint.detector.api.SourceCodeScannergetApplicableMethodNames in class com.android.tools.lint.detector.api.Detectorpublic void visitMethod(@NonNull
com.android.tools.lint.detector.api.JavaContext context,
@NonNull
org.jetbrains.uast.UCallExpression call,
@NonNull
com.intellij.psi.PsiMethod method)
visitMethod in interface com.android.tools.lint.detector.api.SourceCodeScannervisitMethod in class com.android.tools.lint.detector.api.Detector