public static @Nullable ListenableActivity getListenableActivity(Context context) {
    if (!(context instanceof ListenableActivity) && context instanceof ContextWrapper) {
      context = ((ContextWrapper) context).getBaseContext();
    }
    if (context instanceof ListenableActivity) {
      return (ListenableActivity) context;
    }
    return null;
  }
If given context is an instance of ListenableActivity then creates new instance of
WeakReferenceActivityListenerAdapter and adds it to activity's listeners
fbcore/src/main/java/com/facebook/common/activitylistener/ActivityListenerManager.java