From: Diego Perez Date: Fri, 15 Jul 2016 10:37:34 +0000 (+0100) Subject: Restore getAccessibleMethod in the preferences inflater X-Git-Tag: android-x86-8.1-r1~13119^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=34e012196275cf936d64d3333405acdf77a9d852;p=android-x86%2Fframeworks-base.git Restore getAccessibleMethod in the preferences inflater It turns out that although the method was public, the class is package protected and hence the "Accessible" call Change-Id: Iec69ad15db4c22d472a941dd335b6cf7789eea09 (cherry picked from commit ff78c344e63c8665ab7b0773b91e473b4fe650ff) --- diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/support/SupportPreferencesUtil.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/support/SupportPreferencesUtil.java index 0124e83d79e8..6ad9efc81afa 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/support/SupportPreferencesUtil.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/support/SupportPreferencesUtil.java @@ -41,6 +41,7 @@ import java.io.IOException; import java.lang.reflect.Method; import java.util.ArrayList; +import static com.android.layoutlib.bridge.util.ReflectionUtils.getAccessibleMethod; import static com.android.layoutlib.bridge.util.ReflectionUtils.getClassInstance; import static com.android.layoutlib.bridge.util.ReflectionUtils.getMethod; import static com.android.layoutlib.bridge.util.ReflectionUtils.invoke; @@ -93,9 +94,10 @@ public class SupportPreferencesUtil { Object preferenceInflater = instantiateClass(callback, PREFERENCE_INFLATER, new Class[]{Context.class, preferenceManager.getClass()}, new Object[]{context, preferenceManager}); - Object inflatedPreference = invoke( - getMethod(preferenceInflater.getClass(), "inflate", XmlPullParser.class, - preferenceGroupClass), preferenceInflater, parser, null); + Object inflatedPreference = + invoke(getAccessibleMethod(preferenceInflater.getClass(), "inflate", + XmlPullParser.class, preferenceGroupClass), preferenceInflater, parser, + null); if (inflatedPreference == null) { throw new ReflectionException("inflate method returned null");