only show the play button for non-car mode, since that is taken care of already

This commit is contained in:
Tony Tam 2020-11-22 18:20:10 -08:00
parent d9151351b0
commit aebc62d136
1 changed files with 11 additions and 7 deletions

View File

@ -1224,6 +1224,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
} }
UiModeManager uiModeManager = (UiModeManager) getApplicationContext().getSystemService(Context.UI_MODE_SERVICE); UiModeManager uiModeManager = (UiModeManager) getApplicationContext().getSystemService(Context.UI_MODE_SERVICE);
//
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) { if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_CAR) {
sessionState.addCustomAction( sessionState.addCustomAction(
new PlaybackStateCompat.CustomAction.Builder( new PlaybackStateCompat.CustomAction.Builder(
@ -1235,17 +1236,20 @@ public class PlaybackService extends MediaBrowserServiceCompat {
CUSTOM_ACTION_FAST_FORWARD, CUSTOM_ACTION_FAST_FORWARD,
getString(R.string.fast_forward_label), R.drawable.ic_notification_fast_forward) getString(R.string.fast_forward_label), R.drawable.ic_notification_fast_forward)
.build()); .build());
} else {
// This would give the PIP of videos a play button
capabilities = capabilities | PlaybackStateCompat.ACTION_PLAY;
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_WATCH) {
flavorHelper.sessionStateAddActionForWear(sessionState,
CUSTOM_ACTION_REWIND, getString(R.string.rewind_label), android.R.drawable.ic_media_rew);
flavorHelper.sessionStateAddActionForWear(sessionState,
CUSTOM_ACTION_FAST_FORWARD, getString(R.string.fast_forward_label), android.R.drawable.ic_media_ff);
flavorHelper.mediaSessionSetExtraForWear(mediaSession);
}
} }
sessionState.setActions(capabilities); sessionState.setActions(capabilities);
flavorHelper.sessionStateAddActionForWear(sessionState,
CUSTOM_ACTION_REWIND, getString(R.string.rewind_label), android.R.drawable.ic_media_rew);
flavorHelper.sessionStateAddActionForWear(sessionState,
CUSTOM_ACTION_FAST_FORWARD, getString(R.string.fast_forward_label), android.R.drawable.ic_media_ff);
flavorHelper.mediaSessionSetExtraForWear(mediaSession);
mediaSession.setPlaybackState(sessionState.build()); mediaSession.setPlaybackState(sessionState.build());
} }