[Android] Manage the remote control focus from within the AudioService exclusively
Ludovic Fauvet
git at videolan.org
Mon Nov 5 13:46:30 CET 2012
vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Mon Nov 5 12:44:43 2012 +0100| [7d48c359756e1179f3f0c99a856b9f20a96ac99f] | committer: Ludovic Fauvet
Manage the remote control focus from within the AudioService exclusively
Doing it on the UI is not necessary anymore, even though it could help
sometimes with badly designed application that steal the remote control
focus when they are launched without even playing anything.
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=7d48c359756e1179f3f0c99a856b9f20a96ac99f
---
vlc-android/src/org/videolan/vlc/AudioService.java | 6 +++---
vlc-android/src/org/videolan/vlc/gui/MainActivity.java | 1 -
.../src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java | 1 -
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index a5a7d9c..1805c6f 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -82,12 +82,12 @@ public class AudioService extends Service {
private RepeatType mRepeating = RepeatType.None;
private boolean mDetectHeadset = true;
private OnAudioFocusChangeListener audioFocusListener;
- private static ComponentName mRemoteControlClientReceiverComponent;
+ private ComponentName mRemoteControlClientReceiverComponent;
/**
* RemoteControlClient is for lock screen playback control.
*/
- private static RemoteControlClient mRemoteControlClient = null;
+ private RemoteControlClient mRemoteControlClient = null;
/**
* Distinguish between the "fake" (Java-backed) playlist versus the "real"
@@ -146,7 +146,7 @@ public class AudioService extends Service {
* @see http://android-developers.blogspot.fr/2010/06/allowing-applications-to-play-nicer.html
*/
@TargetApi(14)
- public static void setUpRemoteControlClient() {
+ public void setUpRemoteControlClient() {
Context context = VLCApplication.getAppContext();
AudioManager audioManager = (AudioManager)context.getSystemService(AUDIO_SERVICE);
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 6fffce1..a963e37 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -284,7 +284,6 @@ public class MainActivity extends SherlockFragmentActivity {
super.onResume();
mAudioController.addAudioPlayer(mAudioPlayer);
AudioServiceController.getInstance().bindAudioService(this);
- AudioService.setUpRemoteControlClient();
/* FIXME: this is used to avoid having MainActivity twice in the backstack */
if (getIntent().hasExtra(AudioService.START_FROM_NOTIFICATION))
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
index 1dcaf0b..396097a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
@@ -125,7 +125,6 @@ public class AudioPlayerActivity extends Activity implements IAudioPlayer {
super.onResume();
AudioServiceController.getInstance().bindAudioService(this);
mAudioController.addAudioPlayer(this);
- AudioService.setUpRemoteControlClient();
}
@Override
More information about the Android
mailing list