mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
Looks like Android 2.3 is more strict when enforcing permissions. Explicitly declare allowed intents under the Service tag in AndroidManifest.xml.
Remove useless rockbox intent class. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29552 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c9190dc188
commit
64cf0dd765
2 changed files with 25 additions and 26 deletions
|
|
@ -19,7 +19,12 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service android:name=".RockboxService"/>
|
||||
<service android:name=".RockboxService">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="android.intent.action.MEDIA_BUTTON" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<receiver android:name=".Helper.MediaButtonReceiver$MediaReceiver"
|
||||
android:enabled="true"
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public class RockboxWidgetProvider extends AppWidgetProvider
|
|||
if (state.enablePrev)
|
||||
{
|
||||
views.setOnClickPendingIntent(R.id.prev,
|
||||
RockboxMediaIntent.newPendingIntent(context,
|
||||
newPendingIntent(context,
|
||||
KeyEvent.KEYCODE_MEDIA_PREVIOUS));
|
||||
}
|
||||
else
|
||||
|
|
@ -127,7 +127,7 @@ public class RockboxWidgetProvider extends AppWidgetProvider
|
|||
if (state.enablePlayPause)
|
||||
{
|
||||
views.setOnClickPendingIntent(R.id.playPause,
|
||||
RockboxMediaIntent.newPendingIntent(context,
|
||||
newPendingIntent(context,
|
||||
KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE));
|
||||
}
|
||||
else
|
||||
|
|
@ -137,7 +137,7 @@ public class RockboxWidgetProvider extends AppWidgetProvider
|
|||
if (state.enableNext)
|
||||
{
|
||||
views.setOnClickPendingIntent(R.id.next,
|
||||
RockboxMediaIntent.newPendingIntent(context,
|
||||
newPendingIntent(context,
|
||||
KeyEvent.KEYCODE_MEDIA_NEXT));
|
||||
}
|
||||
else
|
||||
|
|
@ -147,7 +147,7 @@ public class RockboxWidgetProvider extends AppWidgetProvider
|
|||
if (state.enableStop)
|
||||
{
|
||||
views.setOnClickPendingIntent(R.id.stop,
|
||||
RockboxMediaIntent.newPendingIntent(context,
|
||||
newPendingIntent(context,
|
||||
KeyEvent.KEYCODE_MEDIA_STOP));
|
||||
}
|
||||
else
|
||||
|
|
@ -190,24 +190,18 @@ public class RockboxWidgetProvider extends AppWidgetProvider
|
|||
appWidgetManager.updateAppWidget(appWidgetId, views);
|
||||
}
|
||||
|
||||
private static class RockboxMediaIntent extends Intent
|
||||
{
|
||||
private RockboxMediaIntent(Context c, int keycode)
|
||||
{
|
||||
super(ACTION_MEDIA_BUTTON, Uri.EMPTY, c, RockboxService.class);
|
||||
putExtra(EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP,
|
||||
keycode));
|
||||
}
|
||||
|
||||
public static PendingIntent newPendingIntent(Context c, int keycode)
|
||||
public static PendingIntent newPendingIntent(Context context, int keycode)
|
||||
{
|
||||
/* Use keycode as request to code to prevent successive
|
||||
* PendingIntents from overwritting one another.
|
||||
* This seems hackish but at least it works.
|
||||
* see: http://code.google.com/p/android/issues/detail?id=863
|
||||
*/
|
||||
return PendingIntent.getService(c, keycode, new RockboxMediaIntent(c, keycode), 0);
|
||||
}
|
||||
Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, Uri.EMPTY,
|
||||
context, RockboxService.class);
|
||||
intent.putExtra(Intent.EXTRA_KEY_EVENT,
|
||||
new KeyEvent(KeyEvent.ACTION_UP, keycode));
|
||||
return PendingIntent.getService(context, keycode, intent, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue