summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2016-08-03 12:17:23 (GMT)
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-08-03 12:17:23 (GMT)
commit4961f4edbc2194359a15430fa99d063ac46c643d (patch)
tree7f6da3b8fd47fd0bb0c13b2b4f6726abeb8468a3
parenta6f204a76ba5336d2e651fcb608b79cc1826c64d (diff)
parent815e4d86dc19e623b32366b035d027a3ffa169fa (diff)
downloadandroid_packages_apps_Eleven-4961f4edbc2194359a15430fa99d063ac46c643d.zip
android_packages_apps_Eleven-4961f4edbc2194359a15430fa99d063ac46c643d.tar.gz
android_packages_apps_Eleven-4961f4edbc2194359a15430fa99d063ac46c643d.tar.bz2
Merge "handle media keys" into cm-13.0
-rw-r--r--src/com/cyanogenmod/eleven/MusicPlaybackService.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/com/cyanogenmod/eleven/MusicPlaybackService.java b/src/com/cyanogenmod/eleven/MusicPlaybackService.java
index 1f5660c..22e641d 100644
--- a/src/com/cyanogenmod/eleven/MusicPlaybackService.java
+++ b/src/com/cyanogenmod/eleven/MusicPlaybackService.java
@@ -66,7 +66,6 @@ import com.cyanogenmod.eleven.provider.SongPlayCount;
import com.cyanogenmod.eleven.service.MusicPlaybackTrack;
import com.cyanogenmod.eleven.utils.BitmapWithColors;
import com.cyanogenmod.eleven.utils.Lists;
-import com.cyanogenmod.eleven.utils.PreferenceUtils;
import com.cyanogenmod.eleven.utils.ShakeDetector;
import com.cyanogenmod.eleven.utils.SrtManager;
@@ -705,6 +704,7 @@ public class MusicPlaybackService extends Service {
}
});
mSession.setFlags(MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS);
+ mSession.setFlags(MediaSession.FLAG_HANDLES_MEDIA_BUTTONS);
}
/**
@@ -1488,8 +1488,16 @@ public class MusicPlaybackService extends Service {
? PlaybackState.STATE_PLAYING
: PlaybackState.STATE_PAUSED;
+ long playBackStateActions = PlaybackState.ACTION_PLAY |
+ PlaybackState.ACTION_PLAY_PAUSE |
+ PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
+ PlaybackState.ACTION_PAUSE |
+ PlaybackState.ACTION_SKIP_TO_NEXT |
+ PlaybackState.ACTION_SKIP_TO_PREVIOUS;
+
if (what.equals(PLAYSTATE_CHANGED) || what.equals(POSITION_CHANGED)) {
mSession.setPlaybackState(new PlaybackState.Builder()
+ .setActions(playBackStateActions)
.setState(playState, position(), 1.0f).build());
} else if (what.equals(META_CHANGED) || what.equals(QUEUE_CHANGED)) {
Bitmap albumArt = getAlbumArt(false).getBitmap();
@@ -1517,6 +1525,7 @@ public class MusicPlaybackService extends Service {
.build());
mSession.setPlaybackState(new PlaybackState.Builder()
+ .setActions(playBackStateActions)
.setState(playState, position(), 1.0f).build());
}
}