private @Nullable ActivityListener getListenerOrCleanUp(Activity activity) {
      ActivityListener activityVisibilityListener = mActivityListenerRef.get();
      if (activityVisibilityListener == null) {
        Preconditions.checkArgument(activity instanceof ListenableActivity);
        ListenableActivity listenableActivity = (ListenableActivity) activity;
        listenableActivity.removeActivityListener(this);
      }
      return activityVisibilityListener;
    }
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