diff options
| author | Jeff Brown <jeffbrown@google.com> | 2013-01-28 14:25:53 -0800 |
|---|---|---|
| committer | Jeff Brown <jeffbrown@google.com> | 2013-01-28 14:25:53 -0800 |
| commit | 864693461b6223a995038847591b17abe2de647e (patch) | |
| tree | 54fc87eb4d42310fbc28dcfa85e7a4a21d88fa2c /services/jni | |
| parent | f35a55769ad81fb138e23f829b40feabc2ec7fc0 (diff) | |
| download | frameworks_base-864693461b6223a995038847591b17abe2de647e.zip frameworks_base-864693461b6223a995038847591b17abe2de647e.tar.gz frameworks_base-864693461b6223a995038847591b17abe2de647e.tar.bz2 | |
Optimize Looper JNI code.
Use static native methods.
Release the native looper objects as soon as the Looper quits
instead of waiting until the GC finalizer to take care of it.
Change-Id: I02783e48782a8f972ec2138862f700ade33d8e78
Diffstat (limited to 'services/jni')
| -rw-r--r-- | services/jni/com_android_server_input_InputManagerService.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/services/jni/com_android_server_input_InputManagerService.cpp b/services/jni/com_android_server_input_InputManagerService.cpp index a97becf..57803e3 100644 --- a/services/jni/com_android_server_input_InputManagerService.cpp +++ b/services/jni/com_android_server_input_InputManagerService.cpp @@ -975,6 +975,11 @@ void NativeInputManager::loadPointerResources(PointerResources* outResources) { static jint nativeInit(JNIEnv* env, jclass clazz, jobject serviceObj, jobject contextObj, jobject messageQueueObj) { sp<MessageQueue> messageQueue = android_os_MessageQueue_getMessageQueue(env, messageQueueObj); + if (messageQueue == NULL) { + jniThrowRuntimeException(env, "MessageQueue is not initialized."); + return 0; + } + NativeInputManager* im = new NativeInputManager(contextObj, serviceObj, messageQueue->getLooper()); im->incStrong(serviceObj); |
