summaryrefslogtreecommitdiffstats
path: root/services/jni/com_android_server_InputApplicationHandle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/jni/com_android_server_InputApplicationHandle.cpp')
-rw-r--r--services/jni/com_android_server_InputApplicationHandle.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/services/jni/com_android_server_InputApplicationHandle.cpp b/services/jni/com_android_server_InputApplicationHandle.cpp
index 7de67d9..c76ab53 100644
--- a/services/jni/com_android_server_InputApplicationHandle.cpp
+++ b/services/jni/com_android_server_InputApplicationHandle.cpp
@@ -49,25 +49,30 @@ jobject NativeInputApplicationHandle::getInputApplicationHandleObjLocalRef(JNIEn
return env->NewLocalRef(mObjWeak);
}
-bool NativeInputApplicationHandle::update() {
+bool NativeInputApplicationHandle::updateInfo() {
JNIEnv* env = AndroidRuntime::getJNIEnv();
jobject obj = env->NewLocalRef(mObjWeak);
if (!obj) {
+ releaseInfo();
return false;
}
+ if (!mInfo) {
+ mInfo = new InputApplicationInfo();
+ }
+
jstring nameObj = jstring(env->GetObjectField(obj,
gInputApplicationHandleClassInfo.name));
if (nameObj) {
const char* nameStr = env->GetStringUTFChars(nameObj, NULL);
- name.setTo(nameStr);
+ mInfo->name.setTo(nameStr);
env->ReleaseStringUTFChars(nameObj, nameStr);
env->DeleteLocalRef(nameObj);
} else {
- name.setTo("<null>");
+ mInfo->name.setTo("<null>");
}
- dispatchingTimeout = env->GetLongField(obj,
+ mInfo->dispatchingTimeout = env->GetLongField(obj,
gInputApplicationHandleClassInfo.dispatchingTimeoutNanos);
env->DeleteLocalRef(obj);