From 1a572bd9558225a8e8458e5e31f06f020cc441f6 Mon Sep 17 00:00:00 2001 From: shagr4th Date: Tue, 27 Dec 2016 09:52:00 +0100 Subject: [PATCH] Simpler thread management using the alarm thread to refresh the surface --- .gitignore | 2 ++ app/src/main/AndroidManifest.xml | 2 +- app/src/main/java/org/ab/x48/HPView.java | 32 ++++++++-------------- app/src/main/java/org/ab/x48/X48.java | 7 +++-- app/src/main/jni/x48.c | 34 +++++++++++++++++++++--- 5 files changed, 49 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index 1365dc5..b1de7ee 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,5 @@ app/app.iml ehthumbs.db Thumbs.db + +app/app-all-release.apk diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 48e0e4a..295d707 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="org.ab.x48" android:installLocation="auto" android:versionCode="73" android:versionName="1.73"> CallIntMethod(android_env, android_callback, waitEvent); return wake; */ - int code = (*android_env)->CallIntMethod(android_env, android_callback, waitEvent); + if (release_pending) + { + key_event(release_pending_code, 0); + wake = 1; + release_pending = 0; + return wake; + } + + unsigned int code = 0; + while ((code=(*android_env)->CallIntMethod(android_env, android_callback, waitEvent)) > 0) { + //LOGI("code %u", code); + if (code < 100) + { + key_event(code - 1, 1); + wake = 1; + break; + } else { + //key_event(code - 100, 0); + release_pending = 1; + release_pending_code = code - 100; + break; + } + } + + return wake; //LOGI("code: %d", code); //FIX for Zenfone 2 @@ -636,7 +662,7 @@ GetEvent() req.tv_nsec = 100L; nanosleep(&req , &rem);*/ - if (code < 0) + /*if (code < 0) { code = -code; wake = 0; @@ -655,7 +681,7 @@ GetEvent() // LOGI("wake: %d", wake); - return wake; + return wake;*/ } int