From f7a58becf9b27668601209ff6176db2a8b2facfa Mon Sep 17 00:00:00 2001 From: Adrian Ulrich Date: Thu, 29 Aug 2013 10:40:21 +0200 Subject: [PATCH] remove headset_plug (autoplay on headset-insert) feature --- res/xml/preference_audio.xml | 5 ----- .../android/vanilla/PlaybackService.java | 20 +------------------ .../android/vanilla/PrefKeys.java | 1 - 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/res/xml/preference_audio.xml b/res/xml/preference_audio.xml index bbb46990..101f1fb3 100644 --- a/res/xml/preference_audio.xml +++ b/res/xml/preference_audio.xml @@ -43,11 +43,6 @@ THE SOFTWARE. android:title="@string/headset_pause_title" android:defaultValue="true" android:summary="@string/headset_pause_summary" /> - diff --git a/src/ch/blinkenlights/android/vanilla/PlaybackService.java b/src/ch/blinkenlights/android/vanilla/PlaybackService.java index 30588ba1..e262f5e9 100644 --- a/src/ch/blinkenlights/android/vanilla/PlaybackService.java +++ b/src/ch/blinkenlights/android/vanilla/PlaybackService.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Adrian Ulrich + * Copyright (C) 2012-2013 Adrian Ulrich * Copyright (C) 2010, 2011 Christopher Eby * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -282,15 +282,6 @@ public final class PlaybackService extends Service * If true, audio will not be played through the speaker. */ private boolean mHeadsetOnly; - /** - * If true, start playing when the headset is plugged in. - */ - boolean mHeadsetPlay; - /** - * True if the initial broadcast sent when registering HEADSET_PLUG has - * been receieved. - */ - boolean mPlugInitialized; /** * The time to wait before considering the player idle. */ @@ -411,7 +402,6 @@ public final class PlaybackService extends Service Song.mDisableCoverArt = settings.getBoolean(PrefKeys.DISABLE_COVER_ART, false); mHeadsetOnly = settings.getBoolean(PrefKeys.HEADSET_ONLY, false); mStockBroadcast = settings.getBoolean(PrefKeys.STOCK_BROADCAST, false); - mHeadsetPlay = settings.getBoolean(PrefKeys.HEADSET_PLAY, false); mInvertNotification = settings.getBoolean(PrefKeys.NOTIFICATION_INVERTED_COLOR, false); mNotificationAction = createNotificationAction(settings); mHeadsetPause = getSettings(this).getBoolean(PrefKeys.HEADSET_PAUSE, true); @@ -437,7 +427,6 @@ public final class PlaybackService extends Service mReceiver = new Receiver(); IntentFilter filter = new IntentFilter(); filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); - filter.addAction(Intent.ACTION_HEADSET_PLUG); filter.addAction(Intent.ACTION_SCREEN_ON); registerReceiver(mReceiver, filter); @@ -767,8 +756,6 @@ public final class PlaybackService extends Service unsetFlag(FLAG_PLAYING); } else if (PrefKeys.STOCK_BROADCAST.equals(key)) { mStockBroadcast = settings.getBoolean(key, false); - } else if (PrefKeys.HEADSET_PLAY.equals(key)) { - mHeadsetPlay = settings.getBoolean(key, false); } else if (PrefKeys.ENABLE_SHAKE.equals(key) || PrefKeys.SHAKE_ACTION.equals(key)) { mShakeAction = settings.getBoolean(PrefKeys.ENABLE_SHAKE, false) ? Action.getAction(settings, PrefKeys.SHAKE_ACTION, Action.NextSong) : Action.Nothing; setupSensor(); @@ -1262,11 +1249,6 @@ public final class PlaybackService extends Service if (AudioManager.ACTION_AUDIO_BECOMING_NOISY.equals(action)) { if (mHeadsetPause) unsetFlag(FLAG_PLAYING); - } else if (Intent.ACTION_HEADSET_PLUG.equals(action)) { - if (mHeadsetPlay && mPlugInitialized && intent.getIntExtra("state", 0) == 1) - setFlag(FLAG_PLAYING); - else if (!mPlugInitialized) - mPlugInitialized = true; } else if (Intent.ACTION_SCREEN_ON.equals(action)) { userActionTriggered(); } diff --git a/src/ch/blinkenlights/android/vanilla/PrefKeys.java b/src/ch/blinkenlights/android/vanilla/PrefKeys.java index 4edef1e6..c84ad674 100644 --- a/src/ch/blinkenlights/android/vanilla/PrefKeys.java +++ b/src/ch/blinkenlights/android/vanilla/PrefKeys.java @@ -38,7 +38,6 @@ public class PrefKeys { public static final String ENABLE_SHAKE = "enable_shake"; public static final String HEADSET_ONLY = "headset_only"; public static final String HEADSET_PAUSE = "headset_pause"; - public static final String HEADSET_PLAY = "headset_play"; public static final String IDLE_TIMEOUT = "idle_timeout"; public static final String LIBRARY_PAGE = "library_page"; public static final String MEDIA_BUTTON = "media_button";