Preload the media button receiver

It has a somewhat noticable initialization delay
This commit is contained in:
Christopher Eby 2010-04-05 21:51:10 -05:00
parent 368e04c7ad
commit 998b82a469

View File

@ -696,6 +696,10 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On
mHandler.sendEmptyMessageDelayed(SAVE_STATE, 5000);
break;
case POST_CREATE:
// Preload the receiver so we don't have an intial delay as it
// loads for the first button press
sendBroadcast(new Intent(Intent.ACTION_MEDIA_BUTTON));
mReceiver = new Receiver();
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_HEADSET_PLUG);