diff --git a/infer/src/absint/PatternMatch.ml b/infer/src/absint/PatternMatch.ml index 4e19794ec..561a8e9ca 100644 --- a/infer/src/absint/PatternMatch.ml +++ b/infer/src/absint/PatternMatch.ml @@ -246,6 +246,7 @@ let initializer_classes = ; "android.app.Fragment" ; "android.app.Service" ; "android.support.v4.app.Fragment" + ; "androidx.fragment.app.Fragment" ; "junit.framework.TestCase" ] diff --git a/infer/src/concurrency/ConcurrencyModels.ml b/infer/src/concurrency/ConcurrencyModels.ml index 4262f5c0a..eb8fc33ac 100644 --- a/infer/src/concurrency/ConcurrencyModels.ml +++ b/infer/src/concurrency/ConcurrencyModels.ml @@ -140,9 +140,9 @@ end = struct QualifiedCppName.Match.of_fuzzy_qual_names class_names - (** C++ guard classes used for scope-based lock management. - NB we pretend all classes below implement the mutex interface even though only - [shared_lock] and [unique_lock] do, for simplicity. The comments summarise which + (** C++ guard classes used for scope-based lock management. + NB we pretend all classes below implement the mutex interface even though only + [shared_lock] and [unique_lock] do, for simplicity. The comments summarise which methods are implemented. *) let guards = (* TODO std::scoped_lock *) @@ -346,6 +346,7 @@ let ui_matcher_records = (* search_superclasses is true by default in how [default] is treated *) [ {default with classname= "android.support.v4.app.Fragment"; methods= fragment_methods} ; {default with classname= "android.app.Fragment"; methods= fragment_methods} + ; {default with classname= "androidx.fragment.app.Fragment"; methods= fragment_methods} ; {default with classname= "android.content.ContentProvider"; methods= ["onCreate"]} ; {default with classname= "android.content.BroadcastReceiver"; methods= ["onReceive"]} ; { default with @@ -375,8 +376,8 @@ let if_pred_evalopt ~pred ~f x = IOption.if_none_evalopt x ~f:(fun () -> if pred () then Some (f ()) else None) -(* assume that methods annotated with @MainThread, @UiThread, - and any string starting with "On" always run on the UI thread. +(* assume that methods annotated with @MainThread, @UiThread, + and any string starting with "On" always run on the UI thread. We do the latter because there are too many to precisely list. *) let is_uithread annots = let f (annot, _) = diff --git a/infer/src/quandary/JavaTrace.ml b/infer/src/quandary/JavaTrace.ml index d5ab50a76..2544b386b 100644 --- a/infer/src/quandary/JavaTrace.ml +++ b/infer/src/quandary/JavaTrace.ml @@ -191,7 +191,10 @@ module SourceKind = struct let method_name = Typ.Procname.Java.get_method java_pname in let taint_matching_supertype typename = match (Typ.Name.name typename, method_name) with - | ( ("android.app.Activity" | "android.app.Fragment" | "android.support.v4.app.Fragment") + | ( ( "android.app.Activity" + | "android.app.Fragment" + | "android.support.v4.app.Fragment" + | "androidx.fragment.app.Fragment" ) , ("onActivityResult" | "onNewIntent") ) -> Some (taint_formals_with_types ["android.content.Intent"] Intent formals) | ( "android.app.Service" @@ -391,19 +394,22 @@ module SinkKind = struct taint_nth 1 [StartComponent] | ( ( "android.app.Activity" | "android.content.Context" - | "android.support.v4.app.Fragment" ) + | "android.support.v4.app.Fragment" + | "androidx.fragment.app.Fragment" ) , "startIntentSenderForResult" ) -> taint_nth 2 [StartComponent] | "android.app.Activity", "startIntentSenderFromChild" -> taint_nth 3 [StartComponent] | ( ( "android.app.Fragment" | "android.content.Context" - | "android.support.v4.app.Fragment" ) + | "android.support.v4.app.Fragment" + | "androidx.fragment.app.Fragment" ) , "startActivity" ) -> taint_nth 0 [StartComponent; StartComponentForInsecureIntentHandling] | ( ( "android.app.Fragment" | "android.content.Context" - | "android.support.v4.app.Fragment" ) + | "android.support.v4.app.Fragment" + | "androidx.fragment.app.Fragment" ) , ( "bindService" | "sendBroadcast" | "sendBroadcastAsUser"