public static void makeAccessible(Field field) {
        if ((!Modifier.isPublic(field.getModifiers()) ||
                !Modifier.isPublic(field.getDeclaringClass().getModifiers()) ||
                Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) {
            field.setAccessible(true);
        }
    }
Make the given field accessible, explicitly setting it accessible if
necessary. The {@code setAccessible(true)} method is only called
when actually necessary, to avoid unnecessary conflicts global a JVM
SecurityManager (if active).

@param field the field to make accessible
@see Field#setAccessible
android/android_framework/base/src/main/java/util/ReflectionUtils.java