AArch64: Use long for pointers in view/input classes
For storing pointers, long is used in view/input classes,
as native pointers can be 64-bit.
In addition, some minor changes have been done
to conform with standard JNI practice (e.g. use
of jint instead of int in JNI function prototypes)
Change-Id: Iafda9f4653c023bcba95b873637d935d0b569f5d
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
diff --git a/core/jni/android_view_InputChannel.cpp b/core/jni/android_view_InputChannel.cpp
index ce475e0..d667920 100644
--- a/core/jni/android_view_InputChannel.cpp
+++ b/core/jni/android_view_InputChannel.cpp
@@ -81,14 +81,14 @@
static NativeInputChannel* android_view_InputChannel_getNativeInputChannel(JNIEnv* env,
jobject inputChannelObj) {
- jint intPtr = env->GetIntField(inputChannelObj, gInputChannelClassInfo.mPtr);
- return reinterpret_cast<NativeInputChannel*>(intPtr);
+ jlong longPtr = env->GetLongField(inputChannelObj, gInputChannelClassInfo.mPtr);
+ return reinterpret_cast<NativeInputChannel*>(longPtr);
}
static void android_view_InputChannel_setNativeInputChannel(JNIEnv* env, jobject inputChannelObj,
NativeInputChannel* nativeInputChannel) {
- env->SetIntField(inputChannelObj, gInputChannelClassInfo.mPtr,
- reinterpret_cast<jint>(nativeInputChannel));
+ env->SetLongField(inputChannelObj, gInputChannelClassInfo.mPtr,
+ reinterpret_cast<jlong>(nativeInputChannel));
}
sp<InputChannel> android_view_InputChannel_getInputChannel(JNIEnv* env, jobject inputChannelObj) {
@@ -296,7 +296,7 @@
FIND_CLASS(gInputChannelClassInfo.clazz, "android/view/InputChannel");
GET_FIELD_ID(gInputChannelClassInfo.mPtr, gInputChannelClassInfo.clazz,
- "mPtr", "I");
+ "mPtr", "J");
GET_METHOD_ID(gInputChannelClassInfo.ctor, gInputChannelClassInfo.clazz,
"<init>", "()V");