am ab71f8b6: Merge "AArch64: Use of long for pointers in PropertyValuesHolder"

* commit 'ab71f8b68fee0f2a4f2049c4345b5334948c9df9':
  AArch64: Use of long for pointers in PropertyValuesHolder
This commit is contained in:
Narayan Kamath
2014-01-30 02:39:21 -08:00
committed by Android Git Automerger
3 changed files with 37 additions and 37 deletions

View File

@ -743,9 +743,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;
@ -845,11 +845,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) {
@ -857,7 +857,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);
@ -880,9 +880,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;
@ -982,11 +982,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) {
@ -994,7 +994,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);
@ -1015,8 +1015,8 @@ 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 void nCallIntMethod(Object target, int methodID, int arg);
native static private void nCallFloatMethod(Object target, int methodID, float arg);
}
native static private long nGetIntMethod(Class targetClass, String methodName);
native static private long nGetFloatMethod(Class targetClass, String methodName);
native static private void nCallIntMethod(Object target, long methodID, int arg);
native static private void nCallFloatMethod(Object target, long methodID, float arg);
}

View File

@ -29,44 +29,44 @@ 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 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 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 },
{ "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 }
};

View File

@ -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
}
}