Commit graph

65 commits

Author SHA1 Message Date
Michael Sevakis
4db3e89652 Shuffle some functions around so that interfacing with playback.c in particular isn't required. Though playback does finish the audio init, pcm doesn't care who does it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30403 a1c6a512-1295-4272-9138-f99709370657
2011-09-01 12:15:43 +00:00
Thomas Martitz
7695b0403f Fix typo in and clarify comment.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30309 a1c6a512-1295-4272-9138-f99709370657
2011-08-14 15:21:26 +00:00
Thomas Martitz
c0a4c66f9d Android: Minor changes in ldebugf.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30304 a1c6a512-1295-4272-9138-f99709370657
2011-08-14 13:58:39 +00:00
Thomas Martitz
dbdbc242ac Remove hosted_get_volume(), as event data is available in button_get_data().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30300 a1c6a512-1295-4272-9138-f99709370657
2011-08-14 13:38:10 +00:00
Thomas Martitz
c2a6214ecc Android: Fix crash on start up.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30190 a1c6a512-1295-4272-9138-f99709370657
2011-07-22 06:50:41 +00:00
Thomas Martitz
b2f52477df 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
2011-07-19 23:44:56 +00:00
Thomas Martitz
33de9cdaef Android: Refactor some of the glue code.
* Cleanup RockboxService.java by moving the battery and
  headphone monitors to separate classes and detaching their instances
* Move those monitors and RockboxTelephony.java into a new
  monitors subdirectory
* Call those monitors all the same from native code by creating
  the objects there

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30160 a1c6a512-1295-4272-9138-f99709370657
2011-07-18 21:02:47 +00:00
Michael Sevakis
a2b6703a36 Commit FS#12150 - Fully-functional audio mixer - and finally whip old limitations about playback of voice and other sounds when paused. Channels are independent in state and amplitude. Fade on stop/pause is handled by the channel's volume control rather than global volume which means it now works from anywhere. Opens up the possibility of plugin sounds during music playback by merely adding an additional channel enum. If any PCM drivers were not properly modified, see one of the last comments in the task for a description of the simple change that is expected. Some params are tunable in firmware/export/pcm-mixer.h as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30097 a1c6a512-1295-4272-9138-f99709370657
2011-06-29 06:37:04 +00:00
Thomas Martitz
dace72166e Android: Greatly simplify the pcm callback mechanism on both, the Java and the C side. Should be more reliable now (if the old wasn't already).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29963 a1c6a512-1295-4272-9138-f99709370657
2011-06-05 09:44:57 +00:00
Dominik Riebeling
6c22be4a3d Android: implement headphone detection thus enabling pause on unplug (FS#12097).
Listen to headphone plug events. There are currently two glitches with this:
- Android takes a while until it reports the unplug event, so there will be
  some delay until playback gets paused. This is an Android limitation.
- Rockbox debounces headphone state changes for one second. Therefore playback
  will shortly be routed to the speaker on unplug until Rockbox does the actual
  pause.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29956 a1c6a512-1295-4272-9138-f99709370657
2011-06-04 19:17:47 +00:00
Dominik Riebeling
d7d830fa08 Fix an implicit declaration warning.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29930 a1c6a512-1295-4272-9138-f99709370657
2011-05-29 17:32:49 +00:00
Jonathan Gordon
cc9079d24d Fix a problem where hardware keypresses dont reset the idle poweroff timer on android
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29924 a1c6a512-1295-4272-9138-f99709370657
2011-05-25 08:44:49 +00:00
Bertrik Sikken
9c33dca647 Fix tabs in .c and .h files in firmware/
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29832 a1c6a512-1295-4272-9138-f99709370657
2011-05-08 11:37:18 +00:00
Dominik Riebeling
fcf51bcd92 Fix whitespace errors aka tabs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29826 a1c6a512-1295-4272-9138-f99709370657
2011-05-05 19:20:58 +00:00
Thomas Martitz
8c46ddf9d7 Android: Implement app shutdown and thus, sleep timer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29602 a1c6a512-1295-4272-9138-f99709370657
2011-03-16 15:17:24 +00:00
Thomas Martitz
046cec3aa7 Android: Partly revert r29569 and only call the new getJavaEnvironment() when needed.
The environment is fine to share in general, just not across OS threads, so it's only needed
for functions which are possibly called from multiple OS threads (only 1 currently).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29601 a1c6a512-1295-4272-9138-f99709370657
2011-03-16 14:33:55 +00:00
Björn Stenberg
e50cc0e3d7 Listen to and follow external Android volume changes. (Based on FS#11914 by Maurus Cuelenaere)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29586 a1c6a512-1295-4272-9138-f99709370657
2011-03-14 12:25:48 +00:00
Maurus Cuelenaere
8aa90b6b0b Android: allocate native_buffer locally, which does away with the need to hold
a global reference to it (fixes bug).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29576 a1c6a512-1295-4272-9138-f99709370657
2011-03-12 00:35:18 +00:00
Thomas Martitz
204ac257fe Android: Switch to pthread_cond+SIGEV_THREAD for tick task handling.
The implementation wasn't really safe (sem_post from signal handler), and the new one simplifies things a bit.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29575 a1c6a512-1295-4272-9138-f99709370657
2011-03-11 23:38:36 +00:00
Thomas Martitz
662ba4868a Create GlobalRef in surfaceCreated, in accordance to r29572.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29574 a1c6a512-1295-4272-9138-f99709370657
2011-03-11 22:48:10 +00:00
Maurus Cuelenaere
0b18522cd0 Android: delete the global reference in surfaceDestroyed
This gets rid of the lcd_deinit() boilerplate.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29572 a1c6a512-1295-4272-9138-f99709370657
2011-03-11 19:38:30 +00:00
Maurus Cuelenaere
80a2c80332 Android: no need to keep RockboxPCM_class around
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29571 a1c6a512-1295-4272-9138-f99709370657
2011-03-11 19:25:05 +00:00
Maurus Cuelenaere
c2ee32b22a Partly revert "Android: use NewGlobalRef for references that are used globally"
The added complexity wasn't needed for most subsystems, as main() never returns
so local references can't be freed.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29570 a1c6a512-1295-4272-9138-f99709370657
2011-03-11 19:23:00 +00:00
Maurus Cuelenaere
66f2a08f8a Android: Don't share the JNI environment across threads, but obtain it the
correct way

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29569 a1c6a512-1295-4272-9138-f99709370657
2011-03-11 18:34:35 +00:00
Maurus Cuelenaere
2e5b7aebde Android: use NewGlobalRef for references that are used globally
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29568 a1c6a512-1295-4272-9138-f99709370657
2011-03-11 18:34:31 +00:00
Björn Stenberg
8196f21a94 Enable volume keys in Android.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29559 a1c6a512-1295-4272-9138-f99709370657
2011-03-10 22:53:58 +00:00
Thomas Jarosch
5c73e34d2d Bring idle poweroff to RaaA and the sim
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29543 a1c6a512-1295-4272-9138-f99709370657
2011-03-08 19:33:30 +00:00
Thomas Martitz
6538326ef2 Android: Fix black display after unzipping libmisc.so.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29527 a1c6a512-1295-4272-9138-f99709370657
2011-03-05 20:47:49 +00:00
Thomas Jarosch
15a358099c Introduce "power" thread for RaaA
I tried to move the #ifdefs and the code
in firmware/powermgmt.c around and it was still
a big mess for hosted applications (RaaA/sim builds).

Create our own "power" thread as recently discussed on IRC.

Fixes the sleep timer for RaaA.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29501 a1c6a512-1295-4272-9138-f99709370657
2011-03-02 19:12:55 +00:00
Thomas Jarosch
2647d11354 Move sleep timer code outside of PLATFORM_NATIVE ifdef so RaaA can access it
Also remove redundant RaaA stubs for it.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29467 a1c6a512-1295-4272-9138-f99709370657
2011-02-28 23:05:00 +00:00
Thomas Martitz
95e24dd7a5 Android:
* Re-create RockboxFramebuffer instance with every time there's a new Activity.
* Also, allow Rockbox to be started via multimedia buttons, immediately starting playback if wanted.

We don't need to keep the fb instance around when it backround, and it makes us less depending on it and the activity (less race conditions). And this is how you usually do it in Android apps.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29384 a1c6a512-1295-4272-9138-f99709370657
2011-02-23 01:10:54 +00:00
Thomas Martitz
144df92bfb Android: Rewrite lcd subsystem to use the SurfaceView API.
That enables drawing from outside the apps UI thread, i.e. from within the Rockbox native thread, without needing synchronization means, and adds determinism as to when the draw happens.
It simplifies the drawing routines and adds a convinient way of detecting whether drawing should happen or not (surfaceCreated/Destroyed).
It also restores max. fps on my phone which went down drastically with the gingerbread(CM7) update.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29333 a1c6a512-1295-4272-9138-f99709370657
2011-02-19 01:13:38 +00:00
Thomas Martitz
6d85de3419 Implement cooperative threads on hosted platforms using C code.
This replaces SDL threads with real cooperative threads, which are less cpu intensive and allow priority scheduling.
The backend for context switching is dependant on the host (sigaltstack/longjmp on Unix, Fibers on Windows).
configure has options to force or disallow SDL threads.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29327 a1c6a512-1295-4272-9138-f99709370657
2011-02-18 22:46:01 +00:00
Antoine Cellerier
c0c769c5a8 Add widgets to android port.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29170 a1c6a512-1295-4272-9138-f99709370657
2011-01-29 20:47:32 +00:00
Thomas Martitz
87c8be4a08 RaaA: Improve tagcache search to make the database built.
First, it add the ability to tagcache to walk through multiple search roots.
Second, it adds symlinks targets to the search roots if they're are not inside any of the current search roots, otherwise the symlink is ignored (unless it's a file).

The default search root is still /, so no search root will be actually added.
But the tagcache now isn't trapped by recursive symlinks anymore and successfully builds, and it's prepared for a future music directory setting.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28884 a1c6a512-1295-4272-9138-f99709370657
2010-12-23 19:02:18 +00:00
Thomas Martitz
36da28bbc7 Android: Protect lcd updates with a mutex.
The scrolling engine could lock out the main thread which may be waiting for its update to finish (wakeups are not reentrant).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28821 a1c6a512-1295-4272-9138-f99709370657
2010-12-13 02:01:47 +00:00
Thomas Martitz
c47d813451 Android: Replace the java based tick timer implemented with a not as bloated and more accurate linux hrtimer based one. Further reduces idle cpu usage (0% on my phone but still 1-2% on a Samsung Galaxy S).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28784 a1c6a512-1295-4272-9138-f99709370657
2010-12-10 15:14:18 +00:00
Thomas Martitz
2c2416094f Get rid of get_user_file_path and do the path handling in wrappers for open() and friends.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28752 a1c6a512-1295-4272-9138-f99709370657
2010-12-06 22:26:31 +00:00
Thomas Martitz
465e75a2ba Android: Fix yellow
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28734 a1c6a512-1295-4272-9138-f99709370657
2010-12-04 18:27:24 +00:00
Thomas Martitz
55b58a3f30 Android: Make lcd updates synchronous, doesn't make it faster but smoother (no updates are skipped) and guaranteed to be glitch free.
test_fps can also now report reasonable numbers: ~62 fps for both 1/1 and 1/4 updates (was 300-400 previously).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28728 a1c6a512-1295-4272-9138-f99709370657
2010-12-02 23:50:50 +00:00
Thomas Martitz
0cf2cc1607 Android: Change how detecting call state (introduced in r27746) works, from polling to event based.
* For some reason, the polling methid is much more inefficient than I thought. According to htop it caused up to 15% CPU load on some phones (e.g. Galaxy S).
The event based causes no CPU load.
Rockbox' idle CPU load is now back to 0%, while it was previously dominated by polling the call state.

* Also stop on outgoing calls (no need to explicitely pause for making a call anymore).
* Factor out the detection mechanism to separate files.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28564 a1c6a512-1295-4272-9138-f99709370657
2010-11-12 21:04:13 +00:00
Thomas Martitz
33af0dec28 Touchscreen: Improved scroll threshold
Remove the hardcoded (and way too small) scroll threshold (the distance moved in pixels before we think the users wants to scroll) and replace it with something based on the actual DPI of the screen.
On Android we call the API for that, on other touchscreens we reimplemented Android's formula (as of 2.2) and calculate it.

Flyspray: 11727

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28548 a1c6a512-1295-4272-9138-f99709370657
2010-11-10 15:25:15 +00:00
Jonathan Gordon
3772a08729 remove an unused variable and #include
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28526 a1c6a512-1295-4272-9138-f99709370657
2010-11-07 11:10:43 +00:00
Jonathan Gordon
a41041aeb4 Remote android button handling (again). do the press/unpress more like other targets (i.e correctly). The DPAD is special in that the press/unpress happens too quickly, so always post it with the BUTTON_REL. This means all keymaps using the dpad need to remember it will always have a BUTTON_REL (which also means they cant do repeats, which are impossible anyway).
Also make the back button go back to the OS home from the rockbox main menu

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28475 a1c6a512-1295-4272-9138-f99709370657
2010-11-03 14:34:57 +00:00
Thomas Martitz
49f1ec8e8a Add support multimedia keys/buttons to the core, and adapt Rockbox on android for it (multimedia buttons are found on wired headsets and the lock screen in cyanogenmod).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28421 a1c6a512-1295-4272-9138-f99709370657
2010-10-31 15:32:57 +00:00
Thomas Martitz
bf63f24168 Pass the framebuffer to the service in the constructor rather than later from native code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28411 a1c6a512-1295-4272-9138-f99709370657
2010-10-31 12:11:14 +00:00
Jonathan Gordon
26f7ee13ce Clean up usage of RockboxService. Add a proper way to check if rockbox is actually running (checking RockboxService.fb != null was very very bad)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28406 a1c6a512-1295-4272-9138-f99709370657
2010-10-31 10:35:42 +00:00
Thomas Martitz
6bb7522852 Initialize (instantiate) RockboxFramebuffer from the C code like with the othe java objects.
Remove some @Override annotations to make the Java code build with certain javac versions.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28386 a1c6a512-1295-4272-9138-f99709370657
2010-10-29 23:12:08 +00:00
Jonathan Gordon
48e900ffe2 Fix android hardware button handling so it actually works.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28345 a1c6a512-1295-4272-9138-f99709370657
2010-10-24 12:35:53 +00:00
Thomas Martitz
ad500e1063 Redirect (L)DEBUGFs to adb logcat in DEBUG enabled builds.
Exclude compilation of firmware/debug.c for hosted platforms.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28125 a1c6a512-1295-4272-9138-f99709370657
2010-09-20 17:38:47 +00:00