From 1b9c3de87a710f195db74dbcbccf8e8f5657be96 Mon Sep 17 00:00:00 2001 From: Joshua Bahnsen Date: Tue, 31 Dec 2013 01:22:49 -0700 Subject: [PATCH] Remove lockscreen control when the option disabled --- .../androidapp/service/DownloadServiceImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/com/thejoshwa/ultrasonic/androidapp/service/DownloadServiceImpl.java b/src/com/thejoshwa/ultrasonic/androidapp/service/DownloadServiceImpl.java index 2636a3e7..27f4a354 100644 --- a/src/com/thejoshwa/ultrasonic/androidapp/service/DownloadServiceImpl.java +++ b/src/com/thejoshwa/ultrasonic/androidapp/service/DownloadServiceImpl.java @@ -1444,7 +1444,7 @@ public class DownloadServiceImpl extends Service implements DownloadService audioManager.registerRemoteControlClient(remoteControlClient); } - Log.i(TAG, String.format("In updateRemoteControl, playerState: %s", playerState)); + Log.i(TAG, String.format("In updateRemoteControl, playerState: %s [%d]", playerState, getPlayerPosition())); switch (playerState) { @@ -1514,6 +1514,15 @@ public class DownloadServiceImpl extends Service implements DownloadService Log.e(TAG, "Exception in updateRemoteControl", e); } } + else + { + if (remoteControlClient != null) + { + remoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED); + audioManager.unregisterRemoteControlClient(remoteControlClient); + remoteControlClient = null; + } + } } private synchronized void bufferAndPlay()