[Android] don't handle call headset button during phone calls, leave it to android

Sébastien Toque git at videolan.org
Thu Jun 21 16:26:07 CEST 2012


android | branch: master | Sébastien Toque <xilasz at gmail.com> | Thu Jun 21 16:25:56 2012 +0200| [1945d5cd599cf930b7c8394d96ded66756a40f18] | committer: Sébastien Toque

don't handle call headset button during phone calls, leave it to android

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=1945d5cd599cf930b7c8394d96ded66756a40f18
---

 vlc-android/src/org/videolan/vlc/AudioService.java |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 8e9f6d6..86c3c89 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -52,6 +52,7 @@ import android.os.Message;
 import android.os.RemoteException;
 import android.os.SystemClock;
 import android.provider.MediaStore;
+import android.telephony.TelephonyManager;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.widget.RemoteViews;
@@ -162,7 +163,9 @@ public class AudioService extends Service {
              */
             else if (action.equalsIgnoreCase(Intent.ACTION_MEDIA_BUTTON)) {
                 KeyEvent event = (KeyEvent) intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
-                if (mCurrentMedia == null || event == null)
+                TelephonyManager telManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
+                if (mCurrentMedia == null || event == null ||
+                        telManager.getCallState() != TelephonyManager.CALL_STATE_IDLE)
                     return;
 
                 switch (event.getKeyCode())



More information about the Android mailing list