mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-18 18:17:43 +03:00
Further attempts to improve reliability of lockscreen controls
This commit is contained in:
parent
0881c918be
commit
be1f907024
@ -1429,6 +1429,8 @@ public class DownloadServiceImpl extends Service implements DownloadService
|
|||||||
{
|
{
|
||||||
if (remoteControlClient == null)
|
if (remoteControlClient == null)
|
||||||
{
|
{
|
||||||
|
Log.i(TAG, "In updateRemoteControl, setting up remote control");
|
||||||
|
|
||||||
Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON);
|
Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON);
|
||||||
intent.setComponent(new ComponentName(this.getPackageName(), MediaButtonIntentReceiver.class.getName()));
|
intent.setComponent(new ComponentName(this.getPackageName(), MediaButtonIntentReceiver.class.getName()));
|
||||||
remoteControlClient = new RemoteControlClient(PendingIntent.getBroadcast(this, 0, intent, 0));
|
remoteControlClient = new RemoteControlClient(PendingIntent.getBroadcast(this, 0, intent, 0));
|
||||||
@ -1439,9 +1441,11 @@ public class DownloadServiceImpl extends Service implements DownloadService
|
|||||||
RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS |
|
RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS |
|
||||||
RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE |
|
RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE |
|
||||||
RemoteControlClient.FLAG_KEY_MEDIA_STOP);
|
RemoteControlClient.FLAG_KEY_MEDIA_STOP);
|
||||||
|
|
||||||
|
audioManager.registerRemoteControlClient(remoteControlClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
audioManager.registerRemoteControlClient(remoteControlClient);
|
Log.i(TAG, String.format("In updateRemoteControl, playerState: %s", playerState));
|
||||||
|
|
||||||
switch (playerState)
|
switch (playerState)
|
||||||
{
|
{
|
||||||
@ -1451,15 +1455,16 @@ public class DownloadServiceImpl extends Service implements DownloadService
|
|||||||
case PAUSED:
|
case PAUSED:
|
||||||
remoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED);
|
remoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PAUSED);
|
||||||
break;
|
break;
|
||||||
|
case DOWNLOADING:
|
||||||
|
case PREPARING:
|
||||||
|
remoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_BUFFERING);
|
||||||
|
break;
|
||||||
case IDLE:
|
case IDLE:
|
||||||
case COMPLETED:
|
case COMPLETED:
|
||||||
case STOPPED:
|
|
||||||
remoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
|
|
||||||
break;
|
|
||||||
case DOWNLOADING:
|
|
||||||
case PREPARED:
|
case PREPARED:
|
||||||
case PREPARING:
|
case STOPPED:
|
||||||
default:
|
default:
|
||||||
|
remoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1731,7 +1736,7 @@ public class DownloadServiceImpl extends Service implements DownloadService
|
|||||||
|
|
||||||
if (!isPartial || (downloadFile.isWorkDone() && (Math.abs(duration - pos) < 10000)))
|
if (!isPartial || (downloadFile.isWorkDone() && (Math.abs(duration - pos) < 10000)))
|
||||||
{
|
{
|
||||||
if (nextPlaying != null && nextPlayerState == PlayerState.PREPARED)
|
if (Util.getGaplessPlaybackPreference(DownloadServiceImpl.this) && nextPlaying != null && nextPlayerState == PlayerState.PREPARED)
|
||||||
{
|
{
|
||||||
if (!nextSetup)
|
if (!nextSetup)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user