diff --git a/infer/src/harness/androidFramework.ml b/infer/src/harness/androidFramework.ml index 47266fae6..f6669679d 100644 --- a/infer/src/harness/androidFramework.ml +++ b/infer/src/harness/androidFramework.ml @@ -267,6 +267,13 @@ let get_all_supertypes typ tenv = let is_subtype (typ0 : Sil.typ) (typ1 : Sil.typ) tenv = TypSet.mem typ1 (get_all_supertypes typ0 tenv) +(** return true if [typ] <: android.app.Activity *) +let is_activity typ tenv = + let activity_mangled = Mangled.from_package_class "android.app" "Activity" in + match Sil.get_typ activity_mangled (Some Sil.Class) tenv with + | Some activity_typ -> is_subtype typ activity_typ tenv + | None -> false + (** return true if [class_name] is a known callback class name *) let is_callback_class_name class_name = Mangled.MangledSet.mem class_name android_callbacks diff --git a/infer/src/harness/androidFramework.mli b/infer/src/harness/androidFramework.mli index 48f060b3b..99bece57b 100644 --- a/infer/src/harness/androidFramework.mli +++ b/infer/src/harness/androidFramework.mli @@ -20,6 +20,9 @@ val typ_is_lifecycle_typ : Sil.typ -> Sil.typ -> Sil.tenv -> bool (** return true if [typ] is a known callback class, false otherwise *) val is_callback_class : Sil.typ -> Sil.tenv -> bool +(** return true if [typ] <: android.app.Activity *) +val is_activity : Sil.typ -> Sil.tenv -> bool + (** return true if [procname] is a special lifecycle cleanup method *) val is_destroy_method : Procname.t -> bool