From ada8c117b197dd61bd472399147dd18ff337a204 Mon Sep 17 00:00:00 2001 From: Diego Perez Date: Tue, 19 Jan 2016 10:42:19 +0000 Subject: [PATCH] Fix bug in PropertyValuesHolder_Delegate method index The method index in PropertyValuesHolder was using only the method name + the number of parameters in the call to index the different properties methods. This worked ok most of the time because, for a given method name (let's say setTrimStartOffset), the class is usually the same. However, if the same method name is used in multiple classes, this will cause collisions and will most likely crash. Change-Id: Ie6fa8872c5c5e69e690f4f1bb79191a31bef2a28 --- .../src/android/animation/PropertyValuesHolder_Delegate.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/layoutlib/bridge/src/android/animation/PropertyValuesHolder_Delegate.java b/tools/layoutlib/bridge/src/android/animation/PropertyValuesHolder_Delegate.java index 54021c9f988d0..28a489ad6ed7a 100644 --- a/tools/layoutlib/bridge/src/android/animation/PropertyValuesHolder_Delegate.java +++ b/tools/layoutlib/bridge/src/android/animation/PropertyValuesHolder_Delegate.java @@ -64,7 +64,8 @@ class PropertyValuesHolder_Delegate { private static long registerMethod(Class targetClass, String methodName, Class[] types, int nArgs) { // Encode the number of arguments in the method name - String methodIndexName = String.format("%1$s#%2$d", methodName, nArgs); + String methodIndexName = String.format("%1$s.%2$s#%3$d", targetClass.getSimpleName(), + methodName, nArgs); synchronized (sMethodIndexLock) { Long methodId = METHOD_NAME_TO_ID.get(methodIndexName);