Merge pull request #10479 from jcogs33/android-service-sources

Java: add Android service sources
This commit is contained in:
Jami
2022-09-27 12:40:18 -04:00
committed by GitHub
9 changed files with 215 additions and 51 deletions

View File

@@ -250,6 +250,12 @@ class AndroidIntentInput extends DataFlow::Node {
this.asParameter() = m.getParameter(1) and
receiverType = m.getDeclaringType()
)
or
exists(Method m, AndroidServiceIntentMethod sI |
m.overrides*(sI) and
this.asParameter() = m.getParameter(0) and
receiverType = m.getDeclaringType()
)
}
}

View File

@@ -22,6 +22,13 @@ class TypeActivity extends Class {
TypeActivity() { this.hasQualifiedName("android.app", "Activity") }
}
/**
* The class `android.app.Service`.
*/
class TypeService extends Class {
TypeService() { this.hasQualifiedName("android.app", "Service") }
}
/**
* The class `android.content.Context`.
*/
@@ -57,6 +64,17 @@ class AndroidReceiveIntentMethod extends Method {
}
}
/**
* The method `Service.onStart`, `onStartCommand`,
* `onBind`, `onRebind`, `onUnbind`, or `onTaskRemoved`.
*/
class AndroidServiceIntentMethod extends Method {
AndroidServiceIntentMethod() {
this.hasName(["onStart", "onStartCommand", "onBind", "onRebind", "onUnbind", "onTaskRemoved"]) and
this.getDeclaringType() instanceof TypeService
}
}
/**
* The method `Context.startActivity` or `startActivities`.
*/