You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.4 KiB
43 lines
1.4 KiB
(*
|
|
* Copyright (c) 2013 - present Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*)
|
|
|
|
open! IStd
|
|
module L = Logging
|
|
module F = Format
|
|
|
|
(** Android lifecycle types and their lifecycle methods that are called by the framework *)
|
|
|
|
let on_destroy = "onDestroy"
|
|
|
|
let on_destroy_view = "onDestroyView"
|
|
|
|
let drawable_prefix = "R$drawable"
|
|
|
|
(** return true if [pname] is a special lifecycle cleanup method *)
|
|
let is_destroy_method pname =
|
|
match pname with
|
|
| Typ.Procname.Java pname_java ->
|
|
let method_name = Typ.Procname.Java.get_method pname_java in
|
|
String.equal method_name on_destroy || String.equal method_name on_destroy_view
|
|
| _ ->
|
|
false
|
|
|
|
|
|
let is_subtype_package_class tenv tname package classname =
|
|
PatternMatch.is_subtype tenv tname (Typ.Name.Java.from_package_class package classname)
|
|
|
|
|
|
let is_autocloseable tenv tname = is_subtype_package_class tenv tname "java.lang" "AutoCloseable"
|
|
|
|
let is_view tenv tname = is_subtype_package_class tenv tname "android.view" "View"
|
|
|
|
let is_fragment tenv tname =
|
|
is_subtype_package_class tenv tname "android.app" "Fragment"
|
|
|| is_subtype_package_class tenv tname "android.support.v4.app" "Fragment"
|