Make it explicit the lockscreen workaround is only relevant to pre Lollipop devices.

This commit is contained in:
orionlee 2016-09-10 12:04:01 -07:00
parent 01c3f757a1
commit 209058b3a7
1 changed files with 9 additions and 6 deletions

View File

@ -1004,9 +1004,14 @@ public class PlaybackService extends MediaBrowserServiceCompat {
if (useSkipToPreviousForRewindInLockscreen()) {
// Workaround to fool Android so that Lockscreen will expose a skip-to-previous button,
// which will be used for rewind.
// The workaround is used for pre Lollipop (Androidv5) devices.
// For Androidv5+, lockscreen widges are really notifications (compact),
// with an independent codepath
//
// @see #sessionCallback in the backing callback, skipToPrevious implementation
// is actually the same as rewind. So no new inconsistency is created.
// @see #setupNotification() for the method to create Androidv5+ lockscreen UI
// with notification (compact)
capabilities = capabilities | PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS;
}
@ -1017,11 +1022,9 @@ public class PlaybackService extends MediaBrowserServiceCompat {
private static boolean useSkipToPreviousForRewindInLockscreen() {
// showRewindOnCompactNotification() corresponds to the "Set Lockscreen Buttons"
// Settings in UI.
// Hence, from user perspective, he/she is setting the buttons for Loackscreen
//
// OPEN: it might contain other logic, e.g., the woakround might be applicable
// only to prev-Androidv5 devices.
return UserPreferences.showRewindOnCompactNotification();
// Hence, from user perspective, he/she is setting the buttons for Lockscreen
return ( UserPreferences.showRewindOnCompactNotification() &&
(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) );
}
/**