diff options
author | ByteHamster <info@bytehamster.com> | 2022-11-03 23:16:42 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2022-11-03 23:16:42 +0100 |
commit | 70a847f6bae40cb4506b0fe368cadff1e8b2af60 (patch) | |
tree | a0d89e418ea468357f255f01825ca1b77b9eb003 /core/src/main | |
parent | 5b8cee0de0a092e78c01f195b7c7ac0bd95483d3 (diff) | |
download | AntennaPod-70a847f6bae40cb4506b0fe368cadff1e8b2af60.zip |
Remove dependency from MediaButtonReceiver to PlaybackService
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/AndroidManifest.xml | 1 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/core/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml index 3a5266ec1..3d7b3b473 100644 --- a/core/src/main/AndroidManifest.xml +++ b/core/src/main/AndroidManifest.xml @@ -28,6 +28,7 @@ <intent-filter> <action android:name="android.media.browse.MediaBrowserService"/> + <action android:name="de.danoeh.antennapod.intents.PLAYBACK_SERVICE" /> </intent-filter> </service> diff --git a/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java b/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java index 901ce95a1..e91e24ec6 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java +++ b/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java @@ -10,7 +10,6 @@ import android.util.Log; import android.view.KeyEvent; import de.danoeh.antennapod.core.ClientConfigurator; -import de.danoeh.antennapod.core.service.playback.PlaybackService; /** * Receives media button events. @@ -22,6 +21,7 @@ public class MediaButtonReceiver extends BroadcastReceiver { public static final String EXTRA_HARDWAREBUTTON = "de.danoeh.antennapod.core.service.extra.MediaButtonReceiver.HARDWAREBUTTON"; public static final String NOTIFY_BUTTON_RECEIVER = "de.danoeh.antennapod.NOTIFY_BUTTON_RECEIVER"; + public static final String PLAYBACK_SERVICE_INTENT = "de.danoeh.antennapod.intents.PLAYBACK_SERVICE"; @Override public void onReceive(Context context, Intent intent) { @@ -32,7 +32,8 @@ public class MediaButtonReceiver extends BroadcastReceiver { KeyEvent event = (KeyEvent) intent.getExtras().get(Intent.EXTRA_KEY_EVENT); if (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { ClientConfigurator.initialize(context); - Intent serviceIntent = new Intent(context, PlaybackService.class); + Intent serviceIntent = new Intent(PLAYBACK_SERVICE_INTENT); + serviceIntent.setPackage(context.getPackageName()); serviceIntent.putExtra(EXTRA_KEYCODE, event.getKeyCode()); serviceIntent.putExtra(EXTRA_SOURCE, event.getSource()); serviceIntent.putExtra(EXTRA_HARDWAREBUTTON, event.getEventTime() > 0 || event.getDownTime() > 0); |