This starts a Media3 MediaSession when the service starts. A custom player class gets passed into that session to receive commands from other apps and the android os.
Currently we pad out some dummy items to make SimpleBasePlayer think we can do next and previous tracks.
MPD handles the threading for the native calls so we can just directly call the bridge from the player class.
This will allow the android client to directly make calls to the mpd process to change tracks
I went with camel case on the function names here, if you use an underscore
javac generates a function tht looks like this:
JNIEXPORT void JNICALL Java_org_musicpd_Bridge_play_1previous
I figured what we ended up with looks a little nicer:
JNIEXPORT void JNICALL Java_org_musicpd_Bridge_playPrevious
This changes lets us use the latest UI design from Google, Material 3.
Google only provides the material UI 3 themes for compose, compose only works with kotlin.
We're not interested in the *.class files, we run javac only to
generate the JNI header. By using @PRIVATE_DIR@, it gets stored to a
directory we can ignore, and not into the source tree.
Most of the Android specific meson code has been removed and replaced with
the grade build system.
The new meson build scripts build and move the libmpd.so binaries into the correct
location that gradle expects. After than gradle handles building the rest of the Android app.
Icons and banners have been updated for the modern app packaging expectations.
For reference here was the figma template Google provides that I used to back the png versions
for older versions of Android <https://www.figma.com/community/file/1283953738855070149>
Boost makes building a piece of software much more difficult than
necessary. It's a huge library, and just uncompressing it takes a
considerable amount of time. MPD only used a tiny fraction of it, yet
its header bloat made the MPD build very slow. Locating Boost was
difficult due to its arcane build system and its resistance to use
pkg-config; it's always a special case. MPD could never use features
of newer Boost versions because Linux distributions always shipped old
Boost versions. Boost made everything complicated and slow.
So, finally, after getting rid of GLib (commit ccdb94b06c), switching
to C++ and using Boost (commit 0801b3f495), we've finally get rid of
it 8 years later.
Unfortunately, I had to reimplement parts of it along the way
(e.g. IntrusiveList). Kind of NIH, but on the other hand, compiling
MPD has become much easier for users.