summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/android/button-android.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2012-03-22 20:35:57 +0100
committerThomas Martitz <kugel@rockbox.org>2012-03-22 20:44:52 +0100
commit58e097d4a6c64bf762a8c30e24f16cc62c574519 (patch)
tree16f8135f9ced2e8cd815ff68024b6ef3f237e388 /firmware/target/hosted/android/button-android.c
parentb0df3233917c51049a380f04b909f061de828972 (diff)
downloadrockbox-58e097d4a6c64bf762a8c30e24f16cc62c574519.zip
rockbox-58e097d4a6c64bf762a8c30e24f16cc62c574519.tar.gz
rockbox-58e097d4a6c64bf762a8c30e24f16cc62c574519.tar.bz2
rockbox-58e097d4a6c64bf762a8c30e24f16cc62c574519.tar.xz
android: Add facility for java code to wait native code to be ready.
Especially when unzipping rockbox.zip, the native code can be initialized a lot later than the java code. The java code needs to be prevented from accessing rockbox structures (e.g. current_tick, event queues) before they're ready. This commit adds wait_rockbox_ready() and fixes dodgy behavior of starting rockbox via widget play button, headset remote buttons or multimedia keys. Also fixes wrong small list items before first redraw. Change-Id: I1caf925e829a9c1c6bb6e0016d5c80574574c91e
Diffstat (limited to 'firmware/target/hosted/android/button-android.c')
-rw-r--r--firmware/target/hosted/android/button-android.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/firmware/target/hosted/android/button-android.c b/firmware/target/hosted/android/button-android.c
index 406d37d..ee8b32d 100644
--- a/firmware/target/hosted/android/button-android.c
+++ b/firmware/target/hosted/android/button-android.c
@@ -81,6 +81,8 @@ Java_org_rockbox_RockboxFramebuffer_buttonHandler(JNIEnv*env, jclass class,
button = dpad_to_button((int)keycode);
if (button)
{
+ /* ensure button_queue can be safely posted to */
+ wait_rockbox_ready();
reset_poweroff_timer();
queue_post(&button_queue, button, 0);
return true;
@@ -121,6 +123,10 @@ void button_init_device(void)
e->NewObject(env_ptr, class,
constructor,
RockboxService_instance);
+ /* when reaching this point, rockbox can be considered ready because the
+ * input system (button.c) is initialized. This implies the kernel and threading
+ * is up and running */
+ set_rockbox_ready();
}
int button_read_device(int *data)