@Nullable
  private Object getContextInstance() {
    if (contextInstance != null) {
      return contextInstance;
    }

    try {
      final Class<?> activityThreadClass = Class.forName("android.app.ActivityThread");
      final Method method = activityThreadClass.getMethod("currentApplication");
      contextInstance = method.invoke(null);
    } catch (ClassNotFoundException
        | NoSuchMethodException
        | InvocationTargetException
        | IllegalAccessException e) {
      e.printStackTrace();
    }
    return contextInstance;
  }
Similar to <a
href="https://developer.android.com/reference/android/content/Context#getPackageManager()">Context#getPackageManager</a>
but performed through reflection.

@return the {@link PackageManager}
src/main/java/com/google/maps/android/Context.java