diff options
author | ByteHamster <info@bytehamster.com> | 2018-05-29 23:25:19 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2018-05-29 23:25:19 +0200 |
commit | 02186a3f0da9c8f687607f72fb8613989b6fb8e2 (patch) | |
tree | 88b437282655fe1484379858925d1e05482ba345 /app | |
parent | fe92c98661e3b0817aed2c26dee258b0a572dd5e (diff) | |
download | AntennaPod-02186a3f0da9c8f687607f72fb8613989b6fb8e2.zip |
Limit broadcasts to current app
Diffstat (limited to 'app')
7 files changed, 16 insertions, 8 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index 294ab5af8..8d51d0bd3 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -628,7 +628,8 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi int playerStatus = PlaybackPreferences.getCurrentPlayerStatus(); if(playerStatus == PlaybackPreferences.PLAYER_STATUS_PLAYING) { sendBroadcast(new Intent( - PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE)); + PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE) + .setPackage(getPackageName())); } } remover.executeAsync(); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java index 091f8daab..deda73970 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -863,7 +863,8 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements } if (butSkip != null) { - butSkip.setOnClickListener(v -> sendBroadcast(new Intent(PlaybackService.ACTION_SKIP_CURRENT_EPISODE))); + butSkip.setOnClickListener(v -> sendBroadcast(new Intent(PlaybackService.ACTION_SKIP_CURRENT_EPISODE) + .setPackage(getPackageName()))); } } diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java index f3ed1cb62..4b2af2cf5 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java @@ -414,7 +414,8 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem remover.skipOnCompletion = true; if(controller.getStatus() == PlayerStatus.PLAYING) { sendBroadcast(new Intent( - PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE)); + PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE) + .setPackage(getPackageName())); } } } diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java b/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java index d8f324e8a..1656af338 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java @@ -86,13 +86,15 @@ public class DefaultActionButtonCallback implements ActionButtonCallback { .startWhenPrepared(true) .shouldStream(false) .start(); - context.sendBroadcast(new Intent(PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE)); + context.sendBroadcast(new Intent(PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE) + .setPackage(context.getPackageName())); } else if (media.isCurrentlyPaused()) { new PlaybackServiceStarter(context, media) .startWhenPrepared(true) .shouldStream(false) .start(); - context.sendBroadcast(new Intent(PlaybackService.ACTION_RESUME_PLAY_CURRENT_EPISODE)); + context.sendBroadcast(new Intent(PlaybackService.ACTION_RESUME_PLAY_CURRENT_EPISODE) + .setPackage(context.getPackageName())); } else { DBTasks.playMedia(context, media, false, true, false); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java index 1247aacbb..66171ece1 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java @@ -212,7 +212,8 @@ public class SubscriptionFragment extends Fragment { int playerStatus = PlaybackPreferences.getCurrentPlayerStatus(); if(playerStatus == PlaybackPreferences.PLAYER_STATUS_PLAYING) { getActivity().sendBroadcast(new Intent( - PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE)); + PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE) + .setPackage(getContext().getPackageName())); } } remover.executeAsync(); diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java index de47ee5e4..65fae96eb 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java @@ -158,7 +158,8 @@ public class FeedItemMenuHandler { FeedItem selectedItem) { switch (menuItemId) { case R.id.skip_episode_item: - context.sendBroadcast(new Intent(PlaybackService.ACTION_SKIP_CURRENT_EPISODE)); + context.sendBroadcast(new Intent(PlaybackService.ACTION_SKIP_CURRENT_EPISODE) + .setPackage(context.getPackageName())); break; case R.id.remove_item: DBWriter.deleteFeedMediaOfItem(context, selectedItem.getMedia().getId()); diff --git a/app/src/main/java/de/danoeh/antennapod/spa/SPAUtil.java b/app/src/main/java/de/danoeh/antennapod/spa/SPAUtil.java index 75cbd8b5a..27a3213f7 100644 --- a/app/src/main/java/de/danoeh/antennapod/spa/SPAUtil.java +++ b/app/src/main/java/de/danoeh/antennapod/spa/SPAUtil.java @@ -41,7 +41,8 @@ public class SPAUtil { } SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(appContext); if (!prefs.getBoolean(PREF_HAS_QUERIED_SP_APPS, false)) { - appContext.sendBroadcast(new Intent(SPAReceiver.ACTION_SP_APPS_QUERY_FEEDS)); + appContext.sendBroadcast(new Intent(SPAReceiver.ACTION_SP_APPS_QUERY_FEEDS) + .setPackage(context.getPackageName())); if (BuildConfig.DEBUG) Log.d(TAG, "Sending SP_APPS_QUERY_FEEDS intent"); SharedPreferences.Editor editor = prefs.edit(); |