Apply suggestions from code review

Co-authored-by: Chris Smowton <smowton@github.com>
This commit is contained in:
Tony Torralba
2022-01-17 09:27:16 +01:00
parent c675028537
commit 4b3029564c
2 changed files with 6 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
import java
/** An Android Fragment. */
/** The class `android.app.Fragment`. */
class AndroidFragment extends Class {
AndroidFragment() { this.getASupertype*().hasQualifiedName("android.app", "Fragment") }
}

View File

@@ -28,10 +28,12 @@ class OnActivityResultIncomingIntent extends DataFlow::Node {
* Intent to `onActivityResult`.
*/
predicate isRemoteSource() {
exists(ImplicitStartActivityForResultConf conf, RefType startingType, DataFlow::Node sink |
conf.hasFlowTo(sink) and
startingType = sink.asExpr().(Argument).getCall().getEnclosingCallable().getDeclaringType()
exists(ImplicitStartActivityForResultConf conf, RefType startingType, Expr startActivityForResultArg |
conf.hasFlowToExpr(startActivityForResultArg) and
// startingType is the class enclosing the method that calls `startActivityForResult`.
startingType = startActivityForResultArg.getEnclosingCallable().getDeclaringType()
|
// startingType itself defines an `onActivityResult` method:
startingType = this.getEnclosingCallable().getDeclaringType()
or
// A fragment calls `startActivityForResult`