Loading core/java/android/animation/PropertyValuesHolder.java +44 −44 Original line number Diff line number Diff line Loading @@ -1046,9 +1046,9 @@ public class PropertyValuesHolder implements Cloneable { static class IntPropertyValuesHolder extends PropertyValuesHolder { // Cache JNI functions to avoid looking them up twice private static final HashMap<Class, HashMap<String, Integer>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Integer>>(); int mJniSetter; private static final HashMap<Class, HashMap<String, Long>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Long>>(); long mJniSetter; private IntProperty mIntProperty; IntKeyframeSet mIntKeyframeSet; Loading Loading @@ -1148,11 +1148,11 @@ public class PropertyValuesHolder implements Cloneable { // Check new static hashmap<propName, int> for setter method try { mPropertyMapLock.writeLock().lock(); HashMap<String, Integer> propertyMap = sJNISetterPropertyMap.get(targetClass); HashMap<String, Long> propertyMap = sJNISetterPropertyMap.get(targetClass); if (propertyMap != null) { Integer mJniSetterInteger = propertyMap.get(mPropertyName); if (mJniSetterInteger != null) { mJniSetter = mJniSetterInteger; Long jniSetter = propertyMap.get(mPropertyName); if (jniSetter != null) { mJniSetter = jniSetter; } } if (mJniSetter == 0) { Loading @@ -1160,7 +1160,7 @@ public class PropertyValuesHolder implements Cloneable { mJniSetter = nGetIntMethod(targetClass, methodName); if (mJniSetter != 0) { if (propertyMap == null) { propertyMap = new HashMap<String, Integer>(); propertyMap = new HashMap<String, Long>(); sJNISetterPropertyMap.put(targetClass, propertyMap); } propertyMap.put(mPropertyName, mJniSetter); Loading @@ -1183,9 +1183,9 @@ public class PropertyValuesHolder implements Cloneable { static class FloatPropertyValuesHolder extends PropertyValuesHolder { // Cache JNI functions to avoid looking them up twice private static final HashMap<Class, HashMap<String, Integer>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Integer>>(); int mJniSetter; private static final HashMap<Class, HashMap<String, Long>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Long>>(); long mJniSetter; private FloatProperty mFloatProperty; FloatKeyframeSet mFloatKeyframeSet; Loading Loading @@ -1285,11 +1285,11 @@ public class PropertyValuesHolder implements Cloneable { // Check new static hashmap<propName, int> for setter method try { mPropertyMapLock.writeLock().lock(); HashMap<String, Integer> propertyMap = sJNISetterPropertyMap.get(targetClass); HashMap<String, Long> propertyMap = sJNISetterPropertyMap.get(targetClass); if (propertyMap != null) { Integer mJniSetterInteger = propertyMap.get(mPropertyName); if (mJniSetterInteger != null) { mJniSetter = mJniSetterInteger; Long jniSetter = propertyMap.get(mPropertyName); if (jniSetter != null) { mJniSetter = jniSetter; } } if (mJniSetter == 0) { Loading @@ -1297,7 +1297,7 @@ public class PropertyValuesHolder implements Cloneable { mJniSetter = nGetFloatMethod(targetClass, methodName); if (mJniSetter != 0) { if (propertyMap == null) { propertyMap = new HashMap<String, Integer>(); propertyMap = new HashMap<String, Long>(); sJNISetterPropertyMap.put(targetClass, propertyMap); } propertyMap.put(mPropertyName, mJniSetter); Loading @@ -1319,9 +1319,9 @@ public class PropertyValuesHolder implements Cloneable { } static class MultiFloatValuesHolder extends PropertyValuesHolder { private int mJniSetter; private static final HashMap<Class, HashMap<String, Integer>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Integer>>(); private long mJniSetter; private static final HashMap<Class, HashMap<String, Long>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Long>>(); public MultiFloatValuesHolder(String propertyName, TypeConverter converter, TypeEvaluator evaluator, Object... values) { Loading Loading @@ -1389,11 +1389,11 @@ public class PropertyValuesHolder implements Cloneable { } try { mPropertyMapLock.writeLock().lock(); HashMap<String, Integer> propertyMap = sJNISetterPropertyMap.get(targetClass); HashMap<String, Long> propertyMap = sJNISetterPropertyMap.get(targetClass); if (propertyMap != null) { Integer jniSetterInteger = propertyMap.get(mPropertyName); if (jniSetterInteger != null) { mJniSetter = jniSetterInteger; Long jniSetterLong = propertyMap.get(mPropertyName); if (jniSetterLong != null) { mJniSetter = jniSetterLong; } } if (mJniSetter == 0) { Loading @@ -1409,7 +1409,7 @@ public class PropertyValuesHolder implements Cloneable { } if (mJniSetter != 0) { if (propertyMap == null) { propertyMap = new HashMap<String, Integer>(); propertyMap = new HashMap<String, Long>(); sJNISetterPropertyMap.put(targetClass, propertyMap); } propertyMap.put(mPropertyName, mJniSetter); Loading @@ -1422,9 +1422,9 @@ public class PropertyValuesHolder implements Cloneable { } static class MultiIntValuesHolder extends PropertyValuesHolder { private int mJniSetter; private static final HashMap<Class, HashMap<String, Integer>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Integer>>(); private long mJniSetter; private static final HashMap<Class, HashMap<String, Long>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Long>>(); public MultiIntValuesHolder(String propertyName, TypeConverter converter, TypeEvaluator evaluator, Object... values) { Loading Loading @@ -1492,11 +1492,11 @@ public class PropertyValuesHolder implements Cloneable { } try { mPropertyMapLock.writeLock().lock(); HashMap<String, Integer> propertyMap = sJNISetterPropertyMap.get(targetClass); HashMap<String, Long> propertyMap = sJNISetterPropertyMap.get(targetClass); if (propertyMap != null) { Integer jniSetterInteger = propertyMap.get(mPropertyName); if (jniSetterInteger != null) { mJniSetter = jniSetterInteger; Long jniSetterLong = propertyMap.get(mPropertyName); if (jniSetterLong != null) { mJniSetter = jniSetterLong; } } if (mJniSetter == 0) { Loading @@ -1512,7 +1512,7 @@ public class PropertyValuesHolder implements Cloneable { } if (mJniSetter != 0) { if (propertyMap == null) { propertyMap = new HashMap<String, Integer>(); propertyMap = new HashMap<String, Long>(); sJNISetterPropertyMap.put(targetClass, propertyMap); } propertyMap.put(mPropertyName, mJniSetter); Loading Loading @@ -1631,21 +1631,21 @@ public class PropertyValuesHolder implements Cloneable { } }; native static private int nGetIntMethod(Class targetClass, String methodName); native static private int nGetFloatMethod(Class targetClass, String methodName); native static private int nGetMultipleIntMethod(Class targetClass, String methodName, native static private long nGetIntMethod(Class targetClass, String methodName); native static private long nGetFloatMethod(Class targetClass, String methodName); native static private long nGetMultipleIntMethod(Class targetClass, String methodName, int numParams); native static private int nGetMultipleFloatMethod(Class targetClass, String methodName, native static private long nGetMultipleFloatMethod(Class targetClass, String methodName, int numParams); native static private void nCallIntMethod(Object target, int methodID, int arg); native static private void nCallFloatMethod(Object target, int methodID, float arg); native static private void nCallTwoIntMethod(Object target, int methodID, int arg1, int arg2); native static private void nCallFourIntMethod(Object target, int methodID, int arg1, int arg2, native static private void nCallIntMethod(Object target, long methodID, int arg); native static private void nCallFloatMethod(Object target, long methodID, float arg); native static private void nCallTwoIntMethod(Object target, long methodID, int arg1, int arg2); native static private void nCallFourIntMethod(Object target, long methodID, int arg1, int arg2, int arg3, int arg4); native static private void nCallMultipleIntMethod(Object target, int methodID, int[] args); native static private void nCallTwoFloatMethod(Object target, int methodID, float arg1, native static private void nCallMultipleIntMethod(Object target, long methodID, int[] args); native static private void nCallTwoFloatMethod(Object target, long methodID, float arg1, float arg2); native static private void nCallFourFloatMethod(Object target, int methodID, float arg1, native static private void nCallFourFloatMethod(Object target, long methodID, float arg1, float arg2, float arg3, float arg4); native static private void nCallMultipleFloatMethod(Object target, int methodID, float[] args); native static private void nCallMultipleFloatMethod(Object target, long methodID, float[] args); } core/jni/android_animation_PropertyValuesHolder.cpp +36 −36 Original line number Diff line number Diff line Loading @@ -29,25 +29,25 @@ namespace android { const char* const kClassPathName = "android/animation/PropertyValuesHolder"; static jmethodID android_animation_PropertyValuesHolder_getIntMethod( static jlong android_animation_PropertyValuesHolder_getIntMethod( JNIEnv* env, jclass pvhClass, jclass targetClass, jstring methodName) { const char *nativeString = env->GetStringUTFChars(methodName, 0); jmethodID mid = env->GetMethodID(targetClass, nativeString, "(I)V"); env->ReleaseStringUTFChars(methodName, nativeString); return mid; return reinterpret_cast<jlong>(mid); } static jmethodID android_animation_PropertyValuesHolder_getFloatMethod( static jlong android_animation_PropertyValuesHolder_getFloatMethod( JNIEnv* env, jclass pvhClass, jclass targetClass, jstring methodName) { const char *nativeString = env->GetStringUTFChars(methodName, 0); jmethodID mid = env->GetMethodID(targetClass, nativeString, "(F)V"); env->ReleaseStringUTFChars(methodName, nativeString); return mid; return reinterpret_cast<jlong>(mid); } static jmethodID getMultiparameterMethod(JNIEnv* env, jclass targetClass, jstring methodName, static jlong getMultiparameterMethod(JNIEnv* env, jclass targetClass, jstring methodName, jint parameterCount, char parameterType) { const char *nativeString = env->GetStringUTFChars(methodName, 0); Loading @@ -58,48 +58,48 @@ static jmethodID getMultiparameterMethod(JNIEnv* env, jclass targetClass, jstrin jmethodID mid = env->GetMethodID(targetClass, nativeString, signature); delete[] signature; env->ReleaseStringUTFChars(methodName, nativeString); return mid; return reinterpret_cast<jlong>(mid); } static jmethodID android_animation_PropertyValuesHolder_getMultipleFloatMethod( static jlong android_animation_PropertyValuesHolder_getMultipleFloatMethod( JNIEnv* env, jclass pvhClass, jclass targetClass, jstring methodName, jint parameterCount) { return getMultiparameterMethod(env, targetClass, methodName, parameterCount, 'F'); } static jmethodID android_animation_PropertyValuesHolder_getMultipleIntMethod( static jlong android_animation_PropertyValuesHolder_getMultipleIntMethod( JNIEnv* env, jclass pvhClass, jclass targetClass, jstring methodName, jint parameterCount) { return getMultiparameterMethod(env, targetClass, methodName, parameterCount, 'I'); } static void android_animation_PropertyValuesHolder_callIntMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, int arg) JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, jint arg) { env->CallVoidMethod(target, methodID, arg); env->CallVoidMethod(target, reinterpret_cast<jmethodID>(methodID), arg); } static void android_animation_PropertyValuesHolder_callFloatMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, float arg) JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, jfloat arg) { env->CallVoidMethod(target, methodID, arg); env->CallVoidMethod(target, reinterpret_cast<jmethodID>(methodID), arg); } static void android_animation_PropertyValuesHolder_callTwoFloatMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, float arg1, float arg2) JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, float arg1, float arg2) { env->CallVoidMethod(target, methodID, arg1, arg2); env->CallVoidMethod(target, reinterpret_cast<jmethodID>(methodID), arg1, arg2); } static void android_animation_PropertyValuesHolder_callFourFloatMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, float arg1, float arg2, JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, float arg1, float arg2, float arg3, float arg4) { env->CallVoidMethod(target, methodID, arg1, arg2, arg3, arg4); env->CallVoidMethod(target, reinterpret_cast<jmethodID>(methodID), arg1, arg2, arg3, arg4); } static void android_animation_PropertyValuesHolder_callMultipleFloatMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, jfloatArray arg) JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, jfloatArray arg) { jsize parameterCount = env->GetArrayLength(arg); jfloat *floatValues = env->GetFloatArrayElements(arg, NULL); Loading @@ -107,26 +107,26 @@ static void android_animation_PropertyValuesHolder_callMultipleFloatMethod( for (int i = 0; i < parameterCount; i++) { values[i].f = floatValues[i]; } env->CallVoidMethodA(target, methodID, values); env->CallVoidMethodA(target, reinterpret_cast<jmethodID>(methodID), values); delete[] values; env->ReleaseFloatArrayElements(arg, floatValues, JNI_ABORT); } static void android_animation_PropertyValuesHolder_callTwoIntMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, int arg1, int arg2) JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, int arg1, int arg2) { env->CallVoidMethod(target, methodID, arg1, arg2); env->CallVoidMethod(target, reinterpret_cast<jmethodID>(methodID), arg1, arg2); } static void android_animation_PropertyValuesHolder_callFourIntMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, int arg1, int arg2, JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, int arg1, int arg2, int arg3, int arg4) { env->CallVoidMethod(target, methodID, arg1, arg2, arg3, arg4); env->CallVoidMethod(target, reinterpret_cast<jmethodID>(methodID), arg1, arg2, arg3, arg4); } static void android_animation_PropertyValuesHolder_callMultipleIntMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, jintArray arg) JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, jintArray arg) { jsize parameterCount = env->GetArrayLength(arg); jint *intValues = env->GetIntArrayElements(arg, NULL); Loading @@ -134,35 +134,35 @@ static void android_animation_PropertyValuesHolder_callMultipleIntMethod( for (int i = 0; i < parameterCount; i++) { values[i].i = intValues[i]; } env->CallVoidMethodA(target, methodID, values); env->CallVoidMethodA(target, reinterpret_cast<jmethodID>(methodID), values); delete[] values; env->ReleaseIntArrayElements(arg, intValues, JNI_ABORT); } static JNINativeMethod gMethods[] = { { "nGetIntMethod", "(Ljava/lang/Class;Ljava/lang/String;)I", { "nGetIntMethod", "(Ljava/lang/Class;Ljava/lang/String;)J", (void*)android_animation_PropertyValuesHolder_getIntMethod }, { "nGetFloatMethod", "(Ljava/lang/Class;Ljava/lang/String;)I", { "nGetFloatMethod", "(Ljava/lang/Class;Ljava/lang/String;)J", (void*)android_animation_PropertyValuesHolder_getFloatMethod }, { "nGetMultipleFloatMethod", "(Ljava/lang/Class;Ljava/lang/String;I)I", { "nGetMultipleFloatMethod", "(Ljava/lang/Class;Ljava/lang/String;I)J", (void*)android_animation_PropertyValuesHolder_getMultipleFloatMethod }, { "nGetMultipleIntMethod", "(Ljava/lang/Class;Ljava/lang/String;I)I", { "nGetMultipleIntMethod", "(Ljava/lang/Class;Ljava/lang/String;I)J", (void*)android_animation_PropertyValuesHolder_getMultipleIntMethod }, { "nCallIntMethod", "(Ljava/lang/Object;II)V", { "nCallIntMethod", "(Ljava/lang/Object;JI)V", (void*)android_animation_PropertyValuesHolder_callIntMethod }, { "nCallFloatMethod", "(Ljava/lang/Object;IF)V", { "nCallFloatMethod", "(Ljava/lang/Object;JF)V", (void*)android_animation_PropertyValuesHolder_callFloatMethod }, { "nCallTwoFloatMethod", "(Ljava/lang/Object;IFF)V", { "nCallTwoFloatMethod", "(Ljava/lang/Object;JFF)V", (void*)android_animation_PropertyValuesHolder_callTwoFloatMethod }, { "nCallFourFloatMethod", "(Ljava/lang/Object;IFFFF)V", { "nCallFourFloatMethod", "(Ljava/lang/Object;JFFFF)V", (void*)android_animation_PropertyValuesHolder_callFourFloatMethod }, { "nCallMultipleFloatMethod", "(Ljava/lang/Object;I[F)V", { "nCallMultipleFloatMethod", "(Ljava/lang/Object;J[F)V", (void*)android_animation_PropertyValuesHolder_callMultipleFloatMethod }, { "nCallTwoIntMethod", "(Ljava/lang/Object;III)V", { "nCallTwoIntMethod", "(Ljava/lang/Object;JII)V", (void*)android_animation_PropertyValuesHolder_callTwoIntMethod }, { "nCallFourIntMethod", "(Ljava/lang/Object;IIIII)V", { "nCallFourIntMethod", "(Ljava/lang/Object;JIIII)V", (void*)android_animation_PropertyValuesHolder_callFourIntMethod }, { "nCallMultipleIntMethod", "(Ljava/lang/Object;I[I)V", { "nCallMultipleIntMethod", "(Ljava/lang/Object;J[I)V", (void*)android_animation_PropertyValuesHolder_callMultipleIntMethod }, }; Loading tools/layoutlib/bridge/src/android/animation/PropertyValuesHolder_Delegate.java +4 −4 Original line number Diff line number Diff line Loading @@ -36,24 +36,24 @@ import com.android.tools.layoutlib.annotations.LayoutlibDelegate; /*package*/ class PropertyValuesHolder_Delegate { @LayoutlibDelegate /*package*/ static int nGetIntMethod(Class<?> targetClass, String methodName) { /*package*/ static long nGetIntMethod(Class<?> targetClass, String methodName) { // return 0 to force PropertyValuesHolder to use Java reflection. return 0; } @LayoutlibDelegate /*package*/ static int nGetFloatMethod(Class<?> targetClass, String methodName) { /*package*/ static long nGetFloatMethod(Class<?> targetClass, String methodName) { // return 0 to force PropertyValuesHolder to use Java reflection. return 0; } @LayoutlibDelegate /*package*/ static void nCallIntMethod(Object target, int methodID, int arg) { /*package*/ static void nCallIntMethod(Object target, long methodID, int arg) { // do nothing } @LayoutlibDelegate /*package*/ static void nCallFloatMethod(Object target, int methodID, float arg) { /*package*/ static void nCallFloatMethod(Object target, long methodID, float arg) { // do nothing } } Loading
core/java/android/animation/PropertyValuesHolder.java +44 −44 Original line number Diff line number Diff line Loading @@ -1046,9 +1046,9 @@ public class PropertyValuesHolder implements Cloneable { static class IntPropertyValuesHolder extends PropertyValuesHolder { // Cache JNI functions to avoid looking them up twice private static final HashMap<Class, HashMap<String, Integer>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Integer>>(); int mJniSetter; private static final HashMap<Class, HashMap<String, Long>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Long>>(); long mJniSetter; private IntProperty mIntProperty; IntKeyframeSet mIntKeyframeSet; Loading Loading @@ -1148,11 +1148,11 @@ public class PropertyValuesHolder implements Cloneable { // Check new static hashmap<propName, int> for setter method try { mPropertyMapLock.writeLock().lock(); HashMap<String, Integer> propertyMap = sJNISetterPropertyMap.get(targetClass); HashMap<String, Long> propertyMap = sJNISetterPropertyMap.get(targetClass); if (propertyMap != null) { Integer mJniSetterInteger = propertyMap.get(mPropertyName); if (mJniSetterInteger != null) { mJniSetter = mJniSetterInteger; Long jniSetter = propertyMap.get(mPropertyName); if (jniSetter != null) { mJniSetter = jniSetter; } } if (mJniSetter == 0) { Loading @@ -1160,7 +1160,7 @@ public class PropertyValuesHolder implements Cloneable { mJniSetter = nGetIntMethod(targetClass, methodName); if (mJniSetter != 0) { if (propertyMap == null) { propertyMap = new HashMap<String, Integer>(); propertyMap = new HashMap<String, Long>(); sJNISetterPropertyMap.put(targetClass, propertyMap); } propertyMap.put(mPropertyName, mJniSetter); Loading @@ -1183,9 +1183,9 @@ public class PropertyValuesHolder implements Cloneable { static class FloatPropertyValuesHolder extends PropertyValuesHolder { // Cache JNI functions to avoid looking them up twice private static final HashMap<Class, HashMap<String, Integer>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Integer>>(); int mJniSetter; private static final HashMap<Class, HashMap<String, Long>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Long>>(); long mJniSetter; private FloatProperty mFloatProperty; FloatKeyframeSet mFloatKeyframeSet; Loading Loading @@ -1285,11 +1285,11 @@ public class PropertyValuesHolder implements Cloneable { // Check new static hashmap<propName, int> for setter method try { mPropertyMapLock.writeLock().lock(); HashMap<String, Integer> propertyMap = sJNISetterPropertyMap.get(targetClass); HashMap<String, Long> propertyMap = sJNISetterPropertyMap.get(targetClass); if (propertyMap != null) { Integer mJniSetterInteger = propertyMap.get(mPropertyName); if (mJniSetterInteger != null) { mJniSetter = mJniSetterInteger; Long jniSetter = propertyMap.get(mPropertyName); if (jniSetter != null) { mJniSetter = jniSetter; } } if (mJniSetter == 0) { Loading @@ -1297,7 +1297,7 @@ public class PropertyValuesHolder implements Cloneable { mJniSetter = nGetFloatMethod(targetClass, methodName); if (mJniSetter != 0) { if (propertyMap == null) { propertyMap = new HashMap<String, Integer>(); propertyMap = new HashMap<String, Long>(); sJNISetterPropertyMap.put(targetClass, propertyMap); } propertyMap.put(mPropertyName, mJniSetter); Loading @@ -1319,9 +1319,9 @@ public class PropertyValuesHolder implements Cloneable { } static class MultiFloatValuesHolder extends PropertyValuesHolder { private int mJniSetter; private static final HashMap<Class, HashMap<String, Integer>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Integer>>(); private long mJniSetter; private static final HashMap<Class, HashMap<String, Long>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Long>>(); public MultiFloatValuesHolder(String propertyName, TypeConverter converter, TypeEvaluator evaluator, Object... values) { Loading Loading @@ -1389,11 +1389,11 @@ public class PropertyValuesHolder implements Cloneable { } try { mPropertyMapLock.writeLock().lock(); HashMap<String, Integer> propertyMap = sJNISetterPropertyMap.get(targetClass); HashMap<String, Long> propertyMap = sJNISetterPropertyMap.get(targetClass); if (propertyMap != null) { Integer jniSetterInteger = propertyMap.get(mPropertyName); if (jniSetterInteger != null) { mJniSetter = jniSetterInteger; Long jniSetterLong = propertyMap.get(mPropertyName); if (jniSetterLong != null) { mJniSetter = jniSetterLong; } } if (mJniSetter == 0) { Loading @@ -1409,7 +1409,7 @@ public class PropertyValuesHolder implements Cloneable { } if (mJniSetter != 0) { if (propertyMap == null) { propertyMap = new HashMap<String, Integer>(); propertyMap = new HashMap<String, Long>(); sJNISetterPropertyMap.put(targetClass, propertyMap); } propertyMap.put(mPropertyName, mJniSetter); Loading @@ -1422,9 +1422,9 @@ public class PropertyValuesHolder implements Cloneable { } static class MultiIntValuesHolder extends PropertyValuesHolder { private int mJniSetter; private static final HashMap<Class, HashMap<String, Integer>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Integer>>(); private long mJniSetter; private static final HashMap<Class, HashMap<String, Long>> sJNISetterPropertyMap = new HashMap<Class, HashMap<String, Long>>(); public MultiIntValuesHolder(String propertyName, TypeConverter converter, TypeEvaluator evaluator, Object... values) { Loading Loading @@ -1492,11 +1492,11 @@ public class PropertyValuesHolder implements Cloneable { } try { mPropertyMapLock.writeLock().lock(); HashMap<String, Integer> propertyMap = sJNISetterPropertyMap.get(targetClass); HashMap<String, Long> propertyMap = sJNISetterPropertyMap.get(targetClass); if (propertyMap != null) { Integer jniSetterInteger = propertyMap.get(mPropertyName); if (jniSetterInteger != null) { mJniSetter = jniSetterInteger; Long jniSetterLong = propertyMap.get(mPropertyName); if (jniSetterLong != null) { mJniSetter = jniSetterLong; } } if (mJniSetter == 0) { Loading @@ -1512,7 +1512,7 @@ public class PropertyValuesHolder implements Cloneable { } if (mJniSetter != 0) { if (propertyMap == null) { propertyMap = new HashMap<String, Integer>(); propertyMap = new HashMap<String, Long>(); sJNISetterPropertyMap.put(targetClass, propertyMap); } propertyMap.put(mPropertyName, mJniSetter); Loading Loading @@ -1631,21 +1631,21 @@ public class PropertyValuesHolder implements Cloneable { } }; native static private int nGetIntMethod(Class targetClass, String methodName); native static private int nGetFloatMethod(Class targetClass, String methodName); native static private int nGetMultipleIntMethod(Class targetClass, String methodName, native static private long nGetIntMethod(Class targetClass, String methodName); native static private long nGetFloatMethod(Class targetClass, String methodName); native static private long nGetMultipleIntMethod(Class targetClass, String methodName, int numParams); native static private int nGetMultipleFloatMethod(Class targetClass, String methodName, native static private long nGetMultipleFloatMethod(Class targetClass, String methodName, int numParams); native static private void nCallIntMethod(Object target, int methodID, int arg); native static private void nCallFloatMethod(Object target, int methodID, float arg); native static private void nCallTwoIntMethod(Object target, int methodID, int arg1, int arg2); native static private void nCallFourIntMethod(Object target, int methodID, int arg1, int arg2, native static private void nCallIntMethod(Object target, long methodID, int arg); native static private void nCallFloatMethod(Object target, long methodID, float arg); native static private void nCallTwoIntMethod(Object target, long methodID, int arg1, int arg2); native static private void nCallFourIntMethod(Object target, long methodID, int arg1, int arg2, int arg3, int arg4); native static private void nCallMultipleIntMethod(Object target, int methodID, int[] args); native static private void nCallTwoFloatMethod(Object target, int methodID, float arg1, native static private void nCallMultipleIntMethod(Object target, long methodID, int[] args); native static private void nCallTwoFloatMethod(Object target, long methodID, float arg1, float arg2); native static private void nCallFourFloatMethod(Object target, int methodID, float arg1, native static private void nCallFourFloatMethod(Object target, long methodID, float arg1, float arg2, float arg3, float arg4); native static private void nCallMultipleFloatMethod(Object target, int methodID, float[] args); native static private void nCallMultipleFloatMethod(Object target, long methodID, float[] args); }
core/jni/android_animation_PropertyValuesHolder.cpp +36 −36 Original line number Diff line number Diff line Loading @@ -29,25 +29,25 @@ namespace android { const char* const kClassPathName = "android/animation/PropertyValuesHolder"; static jmethodID android_animation_PropertyValuesHolder_getIntMethod( static jlong android_animation_PropertyValuesHolder_getIntMethod( JNIEnv* env, jclass pvhClass, jclass targetClass, jstring methodName) { const char *nativeString = env->GetStringUTFChars(methodName, 0); jmethodID mid = env->GetMethodID(targetClass, nativeString, "(I)V"); env->ReleaseStringUTFChars(methodName, nativeString); return mid; return reinterpret_cast<jlong>(mid); } static jmethodID android_animation_PropertyValuesHolder_getFloatMethod( static jlong android_animation_PropertyValuesHolder_getFloatMethod( JNIEnv* env, jclass pvhClass, jclass targetClass, jstring methodName) { const char *nativeString = env->GetStringUTFChars(methodName, 0); jmethodID mid = env->GetMethodID(targetClass, nativeString, "(F)V"); env->ReleaseStringUTFChars(methodName, nativeString); return mid; return reinterpret_cast<jlong>(mid); } static jmethodID getMultiparameterMethod(JNIEnv* env, jclass targetClass, jstring methodName, static jlong getMultiparameterMethod(JNIEnv* env, jclass targetClass, jstring methodName, jint parameterCount, char parameterType) { const char *nativeString = env->GetStringUTFChars(methodName, 0); Loading @@ -58,48 +58,48 @@ static jmethodID getMultiparameterMethod(JNIEnv* env, jclass targetClass, jstrin jmethodID mid = env->GetMethodID(targetClass, nativeString, signature); delete[] signature; env->ReleaseStringUTFChars(methodName, nativeString); return mid; return reinterpret_cast<jlong>(mid); } static jmethodID android_animation_PropertyValuesHolder_getMultipleFloatMethod( static jlong android_animation_PropertyValuesHolder_getMultipleFloatMethod( JNIEnv* env, jclass pvhClass, jclass targetClass, jstring methodName, jint parameterCount) { return getMultiparameterMethod(env, targetClass, methodName, parameterCount, 'F'); } static jmethodID android_animation_PropertyValuesHolder_getMultipleIntMethod( static jlong android_animation_PropertyValuesHolder_getMultipleIntMethod( JNIEnv* env, jclass pvhClass, jclass targetClass, jstring methodName, jint parameterCount) { return getMultiparameterMethod(env, targetClass, methodName, parameterCount, 'I'); } static void android_animation_PropertyValuesHolder_callIntMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, int arg) JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, jint arg) { env->CallVoidMethod(target, methodID, arg); env->CallVoidMethod(target, reinterpret_cast<jmethodID>(methodID), arg); } static void android_animation_PropertyValuesHolder_callFloatMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, float arg) JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, jfloat arg) { env->CallVoidMethod(target, methodID, arg); env->CallVoidMethod(target, reinterpret_cast<jmethodID>(methodID), arg); } static void android_animation_PropertyValuesHolder_callTwoFloatMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, float arg1, float arg2) JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, float arg1, float arg2) { env->CallVoidMethod(target, methodID, arg1, arg2); env->CallVoidMethod(target, reinterpret_cast<jmethodID>(methodID), arg1, arg2); } static void android_animation_PropertyValuesHolder_callFourFloatMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, float arg1, float arg2, JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, float arg1, float arg2, float arg3, float arg4) { env->CallVoidMethod(target, methodID, arg1, arg2, arg3, arg4); env->CallVoidMethod(target, reinterpret_cast<jmethodID>(methodID), arg1, arg2, arg3, arg4); } static void android_animation_PropertyValuesHolder_callMultipleFloatMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, jfloatArray arg) JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, jfloatArray arg) { jsize parameterCount = env->GetArrayLength(arg); jfloat *floatValues = env->GetFloatArrayElements(arg, NULL); Loading @@ -107,26 +107,26 @@ static void android_animation_PropertyValuesHolder_callMultipleFloatMethod( for (int i = 0; i < parameterCount; i++) { values[i].f = floatValues[i]; } env->CallVoidMethodA(target, methodID, values); env->CallVoidMethodA(target, reinterpret_cast<jmethodID>(methodID), values); delete[] values; env->ReleaseFloatArrayElements(arg, floatValues, JNI_ABORT); } static void android_animation_PropertyValuesHolder_callTwoIntMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, int arg1, int arg2) JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, int arg1, int arg2) { env->CallVoidMethod(target, methodID, arg1, arg2); env->CallVoidMethod(target, reinterpret_cast<jmethodID>(methodID), arg1, arg2); } static void android_animation_PropertyValuesHolder_callFourIntMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, int arg1, int arg2, JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, int arg1, int arg2, int arg3, int arg4) { env->CallVoidMethod(target, methodID, arg1, arg2, arg3, arg4); env->CallVoidMethod(target, reinterpret_cast<jmethodID>(methodID), arg1, arg2, arg3, arg4); } static void android_animation_PropertyValuesHolder_callMultipleIntMethod( JNIEnv* env, jclass pvhObject, jobject target, jmethodID methodID, jintArray arg) JNIEnv* env, jclass pvhObject, jobject target, jlong methodID, jintArray arg) { jsize parameterCount = env->GetArrayLength(arg); jint *intValues = env->GetIntArrayElements(arg, NULL); Loading @@ -134,35 +134,35 @@ static void android_animation_PropertyValuesHolder_callMultipleIntMethod( for (int i = 0; i < parameterCount; i++) { values[i].i = intValues[i]; } env->CallVoidMethodA(target, methodID, values); env->CallVoidMethodA(target, reinterpret_cast<jmethodID>(methodID), values); delete[] values; env->ReleaseIntArrayElements(arg, intValues, JNI_ABORT); } static JNINativeMethod gMethods[] = { { "nGetIntMethod", "(Ljava/lang/Class;Ljava/lang/String;)I", { "nGetIntMethod", "(Ljava/lang/Class;Ljava/lang/String;)J", (void*)android_animation_PropertyValuesHolder_getIntMethod }, { "nGetFloatMethod", "(Ljava/lang/Class;Ljava/lang/String;)I", { "nGetFloatMethod", "(Ljava/lang/Class;Ljava/lang/String;)J", (void*)android_animation_PropertyValuesHolder_getFloatMethod }, { "nGetMultipleFloatMethod", "(Ljava/lang/Class;Ljava/lang/String;I)I", { "nGetMultipleFloatMethod", "(Ljava/lang/Class;Ljava/lang/String;I)J", (void*)android_animation_PropertyValuesHolder_getMultipleFloatMethod }, { "nGetMultipleIntMethod", "(Ljava/lang/Class;Ljava/lang/String;I)I", { "nGetMultipleIntMethod", "(Ljava/lang/Class;Ljava/lang/String;I)J", (void*)android_animation_PropertyValuesHolder_getMultipleIntMethod }, { "nCallIntMethod", "(Ljava/lang/Object;II)V", { "nCallIntMethod", "(Ljava/lang/Object;JI)V", (void*)android_animation_PropertyValuesHolder_callIntMethod }, { "nCallFloatMethod", "(Ljava/lang/Object;IF)V", { "nCallFloatMethod", "(Ljava/lang/Object;JF)V", (void*)android_animation_PropertyValuesHolder_callFloatMethod }, { "nCallTwoFloatMethod", "(Ljava/lang/Object;IFF)V", { "nCallTwoFloatMethod", "(Ljava/lang/Object;JFF)V", (void*)android_animation_PropertyValuesHolder_callTwoFloatMethod }, { "nCallFourFloatMethod", "(Ljava/lang/Object;IFFFF)V", { "nCallFourFloatMethod", "(Ljava/lang/Object;JFFFF)V", (void*)android_animation_PropertyValuesHolder_callFourFloatMethod }, { "nCallMultipleFloatMethod", "(Ljava/lang/Object;I[F)V", { "nCallMultipleFloatMethod", "(Ljava/lang/Object;J[F)V", (void*)android_animation_PropertyValuesHolder_callMultipleFloatMethod }, { "nCallTwoIntMethod", "(Ljava/lang/Object;III)V", { "nCallTwoIntMethod", "(Ljava/lang/Object;JII)V", (void*)android_animation_PropertyValuesHolder_callTwoIntMethod }, { "nCallFourIntMethod", "(Ljava/lang/Object;IIIII)V", { "nCallFourIntMethod", "(Ljava/lang/Object;JIIII)V", (void*)android_animation_PropertyValuesHolder_callFourIntMethod }, { "nCallMultipleIntMethod", "(Ljava/lang/Object;I[I)V", { "nCallMultipleIntMethod", "(Ljava/lang/Object;J[I)V", (void*)android_animation_PropertyValuesHolder_callMultipleIntMethod }, }; Loading
tools/layoutlib/bridge/src/android/animation/PropertyValuesHolder_Delegate.java +4 −4 Original line number Diff line number Diff line Loading @@ -36,24 +36,24 @@ import com.android.tools.layoutlib.annotations.LayoutlibDelegate; /*package*/ class PropertyValuesHolder_Delegate { @LayoutlibDelegate /*package*/ static int nGetIntMethod(Class<?> targetClass, String methodName) { /*package*/ static long nGetIntMethod(Class<?> targetClass, String methodName) { // return 0 to force PropertyValuesHolder to use Java reflection. return 0; } @LayoutlibDelegate /*package*/ static int nGetFloatMethod(Class<?> targetClass, String methodName) { /*package*/ static long nGetFloatMethod(Class<?> targetClass, String methodName) { // return 0 to force PropertyValuesHolder to use Java reflection. return 0; } @LayoutlibDelegate /*package*/ static void nCallIntMethod(Object target, int methodID, int arg) { /*package*/ static void nCallIntMethod(Object target, long methodID, int arg) { // do nothing } @LayoutlibDelegate /*package*/ static void nCallFloatMethod(Object target, int methodID, float arg) { /*package*/ static void nCallFloatMethod(Object target, long methodID, float arg) { // do nothing } }