diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-07-19 23:44:56 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-07-19 23:44:56 +0000 |
commit | b2f52477dfce620c11e1707e69d3a5f8cab5f6d7 (patch) | |
tree | 094d7a9ce51c684ebec417cdcd954f379b49dfa7 /android | |
parent | b8bfa84d1bf74fcb133d7f5bbf49c39d38d9ed7d (diff) |
Android: Change headphone detection to call into native.
Making a JNI call from tick tasks is not permitted as the underlying thread
is not attached to the Java VM. This is an error and crashes in the emulator
(which has stricter JNI checks enabled by default).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30173 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'android')
-rw-r--r-- | android/src/org/rockbox/monitors/HeadphoneMonitor.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/android/src/org/rockbox/monitors/HeadphoneMonitor.java b/android/src/org/rockbox/monitors/HeadphoneMonitor.java index 99d2f7ab8a..72a2f262f2 100644 --- a/android/src/org/rockbox/monitors/HeadphoneMonitor.java +++ b/android/src/org/rockbox/monitors/HeadphoneMonitor.java @@ -29,7 +29,6 @@ import android.content.IntentFilter; public class HeadphoneMonitor extends BroadcastReceiver { @SuppressWarnings("unused") - private int mHpState; /* read by native code */ public HeadphoneMonitor(Context c) { @@ -45,7 +44,7 @@ public class HeadphoneMonitor extends BroadcastReceiver public void onReceive(Context arg0, Intent intent) { int state = intent.getIntExtra("state", -1); - mHpState = state; + postHpStateChanged(state); } /* audio becoming noise acts as headphones extracted */ @@ -54,7 +53,9 @@ public class HeadphoneMonitor extends BroadcastReceiver @Override public void onReceive(Context arg0, Intent arg1) { - mHpState = 0; + postHpStateChanged(0); } } + + private synchronized native void postHpStateChanged(int state); } |