summaryrefslogtreecommitdiffstats
path: root/fmapp2
diff options
context:
space:
mode:
authorKamal Negi <kamaln@codeaurora.org>2016-03-19 15:10:31 +0530
committerArne Coucheron <arco68@gmail.com>2016-07-14 06:34:30 +0200
commitacf84fb67db816488c267e3d0b42660b40baec32 (patch)
tree2eb2bfac820ad8ef22af41ebc83e29ec3767a954 /fmapp2
parent49630ffcfbae7f7864fd3dba92ccac1951429cac (diff)
downloadandroid_hardware_qcom_fm-acf84fb67db816488c267e3d0b42660b40baec32.tar.gz
android_hardware_qcom_fm-acf84fb67db816488c267e3d0b42660b40baec32.tar.bz2
android_hardware_qcom_fm-acf84fb67db816488c267e3d0b42660b40baec32.zip
fm: Remove unwanted media button key event listenersstable/cm-13.0-ZNH5Y
When FM is turned off, fm app is still listening to media key events (play, pause etc.) which results in other media consuming apps to be starved of Media Key events. Remove unwanted media button listeners so that other media resources can receive key events. Change-Id: Ib43f8b89e07928326c2af771a7465981e1690470
Diffstat (limited to 'fmapp2')
-rw-r--r--fmapp2/src/com/caf/fmradio/FMMediaButtonIntentReceiver.java19
-rw-r--r--fmapp2/src/com/caf/fmradio/FMRadio.java16
-rw-r--r--fmapp2/src/com/caf/fmradio/FMRadioService.java2
3 files changed, 1 insertions, 36 deletions
diff --git a/fmapp2/src/com/caf/fmradio/FMMediaButtonIntentReceiver.java b/fmapp2/src/com/caf/fmradio/FMMediaButtonIntentReceiver.java
index 949453f..5dd3eb7 100644
--- a/fmapp2/src/com/caf/fmradio/FMMediaButtonIntentReceiver.java
+++ b/fmapp2/src/com/caf/fmradio/FMMediaButtonIntentReceiver.java
@@ -53,25 +53,6 @@ public void onReceive(Context context, Intent intent) {
Log.d(TAG, "ACTION_AUDIO_BECOMING_NOISY intent received for ACTION_HEADSET_PLUG");
Intent i = new Intent(AUDIO_BECOMING_NOISY);
context.sendBroadcast(i);
- } else if ((action != null) && action.equals("android.intent.action.MEDIA_BUTTON")) {
- KeyEvent event = (KeyEvent)
- intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
-
- if (event == null) {
- return;
- }
- int keycode = event.getKeyCode();
- int key_action = event.getAction();
- if (((KeyEvent.KEYCODE_HEADSETHOOK == keycode) &&
- (key_action == KeyEvent.ACTION_DOWN)) ||
- (KeyEvent.KEYCODE_MEDIA_PAUSE == keycode) ||
- (KeyEvent.KEYCODE_MEDIA_PLAY == keycode)) {
-
- Log.d(TAG, "ACTION_MEDIA_BUTTON intent received for ACTION_DOWN");
- Intent i = new Intent(FM_MEDIA_BUTTON);
- i.putExtra(Intent.EXTRA_KEY_EVENT, event);
- context.sendBroadcast(i);
- }
}
}
}
diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java
index cc8f1e9..94a7526 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadio.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadio.java
@@ -2670,22 +2670,6 @@ public class FMRadio extends Activity
}//handleMessage
};
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- Log.d(LOGTAG, "KEY event received " + keyCode);
- switch (keyCode) {
- case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
- case 126: //KeyEvent.KEYCODE_MEDIA_PLAY:
- case 127: //KeyEvent.KEYCODE_MEDIA_PAUSE:
- case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
- case KeyEvent.KEYCODE_MEDIA_NEXT:
- case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
- case KeyEvent.KEYCODE_MEDIA_REWIND:
- case KeyEvent.KEYCODE_MEDIA_STOP:
- return true;
- }
- return super.onKeyDown(keyCode, event);
- }
private void resetFMStationInfoUI() {
mTunedStation.setFrequency(FmSharedPreferences.getTunedFrequency());
mTunedStation.setName("");
diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java
index 889e69b..887c228 100644
--- a/fmapp2/src/com/caf/fmradio/FMRadioService.java
+++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java
@@ -816,7 +816,7 @@ public class FMRadioService extends Service
if (!isFmOn())
return;
/* Disable FM and let the UI know */
- fmOff();
+ fmOff(FM_OFF_FROM_ANTENNA);
try
{
/* Notify the UI/Activity, only if the service is "bound"