[LeEco Le Pro3 ROMs, Kernels, Recoveries, & Other D] androcheck:
Hi!

[EDIT January 10, 2017]

THIS MODULE IS NO LONGER NEEDED SINCE EUI 5.9.020S! (and probably also for newer versions).

As since a few days (finally!) the 5.9.020S version was also released for the LEX720 model (before it was only released for the US model), I updated my phone and can confirm, that with 5.9.20S this module is no longer necessary. Now the buttons also work with 3rd party apps (even when the music app "com.android.music" is disabled or removed).

[/EDIT]

I am using the LeEco LEX720 running the original 5.8.018S EUI firmware. I have disabled or removed some of the pre-installed system apps including the pre-installed audio and video player.

I was hoping that the "Previous" / "Play" / "Next" buttons, which are visible all the time in the EUI control center (see attached screenshot) will also work with 3rd party apps, but unfortunately they do not. :(

[edit]

For clarification:

Normally these buttons do in fact work with 3rd party apps (without any mod), but they need the LeEco Music player installed to do so. The buttons broadcast special LeEco-specific intents to the LeEco Music player, which then performs the desired actions (start stop the own player or forward the event to a currently running 3rd party player). If you disable or remove the Le Eco Music player (package "com.android.music") then this buttons will stop working. This is what this Xposed module is made for: to make these buttons working even without the LeEco Music player installed.

[/edit]

When tapping these buttons EUI broadcasts one of these 3 intents (which will not be recognized by 3rd party apps):

new Intent("com.letv.music.musicservicecommand.previous");
new Intent("com.letv.music.musicservicecommand.next");
new Intent("com.letv.music.musicservicecommand.togglepause");

Therefore I created an Xposed module which hooks the methods where these intents get broadcasted and instead broadcast default ACTION_MEDIA_BUTTON events, exactly the same way they will be broadcasted when I press the media control buttons on any external (bluetooth) headset, using these 3 standard keycodes:

KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE
KeyEvent.KEYCODE_MEDIA_NEXT
KeyEvent.KEYCODE_MEDIA_PREVIOUS

(for details see: OverrideMusicControls.java)

This way, every player which reacts to the buttons on your headset, will now also work with these three buttons in the Control Center.

The module is available with full source code (under the GPL license) here on Github.

A ready to use APK file can be downloaded from the release section on the Github page:

Download Xposed-module-EUI-MusicControls-v1.0.apk

Compatibility:

This module was developed and tested on the following device:

Device: LeEco LePro 3 (LEX720)

Firmware version: 5.8.018S

Build-ID: WAXCNFN5801811012S

It may or may not work on other EUI versions, so just give it a try and look into the Xposed logs. If everything is working as expected you should see the lines below in there, otherwise it should log an error message.

EUI MusicControls: We are in com.android.systemui application. Will try to place method hooks for the music Play buttons in EUI Control Center. :)
EUI MusicControls: successfully replaced method handlePlayPause() :)
EUI MusicControls: successfully replaced method handleNext() :)
EUI MusicControls: successfully replaced method handlePrevious() :)

Have fun! :)