Fix race in media button intent registration

AudioManager.registerMediaButtonEventReceiver maps to
  AudioService.registerMediaButtonIntent
AudioManager.registerRemoteControlClient maps to
  AudioService.registerRemoteControlClient
To use RemoteControlClient, an application needs to have
 first registered its button event receiver. Therefore
 registerMediaButtonEventReceiver() needs to have
 completed registration when returning, otherwise the
 RemoteControlClient registration can sometimes fail due
 to the lack of association between the button event
 receiver and the RemoteControlClient.

Bug 8315459

Change-Id: I82c196c3f21a65e38bad275085ed4f9ec0ec60dd
1 file changed