diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 46b6db15..5bc69d5a 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -28,7 +28,6 @@ THE SOFTWARE.
android:installLocation="auto">
-
diff --git a/src/ch/blinkenlights/android/vanilla/MediaButtonReceiver.java b/src/ch/blinkenlights/android/vanilla/MediaButtonReceiver.java
index 9daa7a11..a7bd8568 100644
--- a/src/ch/blinkenlights/android/vanilla/MediaButtonReceiver.java
+++ b/src/ch/blinkenlights/android/vanilla/MediaButtonReceiver.java
@@ -32,7 +32,6 @@ import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.os.SystemClock;
-import android.telephony.TelephonyManager;
import android.view.KeyEvent;
/**
@@ -51,11 +50,6 @@ public class MediaButtonReceiver extends BroadcastReceiver {
* uninitialized.
*/
private static int sUseControls = -1;
- /**
- * Whether the phone is currently in a call. 1 for yes, 0 for no, -1 for
- * uninitialized.
- */
- private static int sInCall = -1;
/**
* Time of the last play/pause click. Used to detect double-clicks.
*/
@@ -125,30 +119,6 @@ public class MediaButtonReceiver extends BroadcastReceiver {
return sUseControls == 1;
}
- /**
- * Return whether the phone is currently in a call.
- *
- * @param context A context to use.
- */
- private static boolean isInCall(Context context)
- {
- if (sInCall == -1) {
- TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
- sInCall = (byte)(manager.getCallState() == TelephonyManager.CALL_STATE_IDLE ? 0 : 1);
- }
- return sInCall == 1;
- }
-
- /**
- * Set the cached value for whether the phone is in a call.
- *
- * @param value True if in a call, false otherwise.
- */
- public static void setInCall(boolean value)
- {
- sInCall = value ? 1 : 0;
- }
-
/**
* Process a media button key press.
*
@@ -159,7 +129,7 @@ public class MediaButtonReceiver extends BroadcastReceiver {
*/
public static boolean processKey(Context context, KeyEvent event)
{
- if (event == null || isInCall(context) || !useHeadsetControls(context))
+ if (event == null || !useHeadsetControls(context))
return false;
int action = event.getAction();
diff --git a/src/ch/blinkenlights/android/vanilla/PlaybackActivity.java b/src/ch/blinkenlights/android/vanilla/PlaybackActivity.java
index f70ccad7..d69b6fff 100644
--- a/src/ch/blinkenlights/android/vanilla/PlaybackActivity.java
+++ b/src/ch/blinkenlights/android/vanilla/PlaybackActivity.java
@@ -133,7 +133,6 @@ public abstract class PlaybackActivity extends Activity
{
super.onResume();
MediaButtonReceiver.registerMediaButton(this);
- MediaButtonReceiver.setInCall(false);
if (PlaybackService.hasInstance()) {
PlaybackService service = PlaybackService.get(this);
service.userActionTriggered();
diff --git a/src/ch/blinkenlights/android/vanilla/PlaybackService.java b/src/ch/blinkenlights/android/vanilla/PlaybackService.java
index ffea61a4..50312a63 100644
--- a/src/ch/blinkenlights/android/vanilla/PlaybackService.java
+++ b/src/ch/blinkenlights/android/vanilla/PlaybackService.java
@@ -57,8 +57,6 @@ import android.os.Process;
import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
-import android.telephony.PhoneStateListener;
-import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.RemoteViews;
import android.widget.Toast;
@@ -328,7 +326,6 @@ public final class PlaybackService extends Service
*/
private long mPendingSeekSong;
public Receiver mReceiver;
- public InCallListener mCallListener;
private String mErrorMessage;
/**
* Current fade-out progress. 1.0f if we are not fading out
@@ -430,14 +427,6 @@ public final class PlaybackService extends Service
PowerManager powerManager = (PowerManager)getSystemService(POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VanillaMusicLock");
- try {
- mCallListener = new InCallListener();
- TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
- telephonyManager.listen(mCallListener, PhoneStateListener.LISTEN_CALL_STATE);
- } catch (SecurityException e) {
- // don't have READ_PHONE_STATE
- }
-
mReceiver = new Receiver();
IntentFilter filter = new IntentFilter();
filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
@@ -1288,36 +1277,6 @@ public final class PlaybackService extends Service
}
}
- private class InCallListener extends PhoneStateListener {
- @Override
- public void onCallStateChanged(int state, String incomingNumber)
- {
- switch (state) {
- case TelephonyManager.CALL_STATE_RINGING:
- case TelephonyManager.CALL_STATE_OFFHOOK: {
- MediaButtonReceiver.setInCall(true);
-
- if (!mPlayingBeforeCall) {
- synchronized (mStateLock) {
- if (mPlayingBeforeCall = (mState & FLAG_PLAYING) != 0)
- unsetFlag(FLAG_PLAYING);
- }
- }
- break;
- }
- case TelephonyManager.CALL_STATE_IDLE: {
- MediaButtonReceiver.setInCall(false);
-
- if (mPlayingBeforeCall) {
- setFlag(FLAG_PLAYING);
- mPlayingBeforeCall = false;
- }
- break;
- }
- }
- }
- }
-
public void onMediaChange()
{
if (MediaUtils.isSongAvailable(getContentResolver())) {