Skip to content

Commit 4b30295

Browse files
atorralbasmowton
andcommitted
Apply suggestions from code review
Co-authored-by: Chris Smowton <[email protected]>
1 parent c675028 commit 4b30295

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

java/ql/lib/semmle/code/java/frameworks/android/Fragment.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java
44

5-
/** An Android Fragment. */
5+
/** The class `android.app.Fragment`. */
66
class AndroidFragment extends Class {
77
AndroidFragment() { this.getASupertype*().hasQualifiedName("android.app", "Fragment") }
88
}

java/ql/lib/semmle/code/java/frameworks/android/OnActivityResultSource.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ class OnActivityResultIncomingIntent extends DataFlow::Node {
2828
* Intent to `onActivityResult`.
2929
*/
3030
predicate isRemoteSource() {
31-
exists(ImplicitStartActivityForResultConf conf, RefType startingType, DataFlow::Node sink |
32-
conf.hasFlowTo(sink) and
33-
startingType = sink.asExpr().(Argument).getCall().getEnclosingCallable().getDeclaringType()
31+
exists(ImplicitStartActivityForResultConf conf, RefType startingType, Expr startActivityForResultArg |
32+
conf.hasFlowToExpr(startActivityForResultArg) and
33+
// startingType is the class enclosing the method that calls `startActivityForResult`.
34+
startingType = startActivityForResultArg.getEnclosingCallable().getDeclaringType()
3435
|
36+
// startingType itself defines an `onActivityResult` method:
3537
startingType = this.getEnclosingCallable().getDeclaringType()
3638
or
3739
// A fragment calls `startActivityForResult`

0 commit comments

Comments
 (0)