Bug 337485 - Android lockscreen support for MPRIS mode.
Summary: Android lockscreen support for MPRIS mode.
Status: RESOLVED FIXED
Alias: None
Product: kdeconnect
Classification: Applications
Component: android-application (show other bugs)
Version: unspecified
Platform: Android Android 4.x
: NOR wishlist
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
: 356637 378371 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-07-16 06:57 UTC by Todd
Modified: 2018-02-24 16:01 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Todd 2014-07-16 06:57:51 UTC
More recent versions of android let media players display themselves on the lockscreen, complete with album art and controls for next, previous, and play/pause buttons.  Even programs that provide remote-control functionality, such as BubbleUPNP (UPNP software) and Chromecast (streaming control) support it.  

It would be nice if, when using MPRIS control mode, kdeconnect also provided lock screen controls on Android devices that support it (at least as an option).
Comment 1 Aleix Pol 2018-01-16 22:18:37 UTC
*** Bug 378371 has been marked as a duplicate of this bug. ***
Comment 2 Aleix Pol 2018-01-16 23:47:51 UTC
*** Bug 356637 has been marked as a duplicate of this bug. ***
Comment 3 Nicolas Fella 2018-01-17 00:26:42 UTC
See https://phabricator.kde.org/D9266
Comment 4 Matthijs Tijink 2018-02-24 16:01:17 UTC
Git commit 2f127b30478804d9821295f11dc236306d51adb4 by Matthijs Tijink.
Committed on 24/02/2018 at 16:01.
Pushed by mtijink into branch 'master'.

Add MPRIS media control notification

Summary:

Adds a notification to show and control mpris players. It shows the title, artist etc. (so depends on D9083, but can easily be adapted to work without it, but that leads to less features).

The notification appears as soon as one of your connected devices plays music. If multiple devices/players are playing, it shows the information and controls for only one of these. If it stops playing, it tries to switch to another playing device/player. If those do not exist, it shows the same player, but allows starting it again.

Dismissing the notification is only possible if the showed player is paused (as effect, only when all players are paused). It automatically closes if the device or player disappears or disconnects and no other players are playing. I think this behaviour is intuitive, other native android music players have similar behaviour.

About the implementation: there are two parts to this: the notification and the media session control API. The first shows the notification and its controls. The second allows lock screen controls on older Android versions and control using e.g. headphone buttons. Since nearly all code is shared between the two parts, and the rest is mostly straightforward, I put them in the same diff.

Test Plan:
Tested on Android Nougat 7.1 (shows the notification with buttons, as expected; no lock screen controls, as expected) and Android Gingerbread 2.3 (shows a notification without buttons, lock screen controls work, so as expected).

I am not able to test with multiple desktops, so testing that would be appreciated.

Disabling buttons when not available should work, but all players I tested always allowed next/previous/play/pause.

Reviewers: #kde_connect, nicolasfella

Reviewed By: #kde_connect, nicolasfella

Subscribers: apol, albertvaka, nicolasfella

Tags: #kde_connect

Maniphest Tasks: T6512

Differential Revision: https://phabricator.kde.org/D9266

M  +7    -0    AndroidManifest.xml
A  +9    -0    res/drawable/ic_next_white.xml
A  +9    -0    res/drawable/ic_pause_white.xml
A  +9    -0    res/drawable/ic_play_white.xml
A  +9    -0    res/drawable/ic_previous_white.xml
M  +4    -0    res/values/strings.xml
M  +8    -1    res/xml/mprisplugin_preferences.xml
A  +86   -0    src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisMediaNotificationReceiver.java
A  +404  -0    src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisMediaSession.java
M  +15   -0    src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisPlugin.java

https://commits.kde.org/kdeconnect-android/2f127b30478804d9821295f11dc236306d51adb4