From 9ea996a330a21af89f308bdf52e02a470643013b Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Mon, 25 Aug 2014 11:23:36 -0700 Subject: [PATCH] Do not restore the media button event receiver Do not restore the media button event receiver on behalf of the application that registered. Prevents reported vulnerability. Bug 15428797 Change-Id: I507faefd211def0d2ea074706de76c0d06157c5a --- media/java/android/media/AudioService.java | 23 ---------------------- 1 file changed, 23 deletions(-) diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index f0fdfc158184c..33a687df46c25 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -747,9 +747,6 @@ public class AudioService extends IAudioService.Stub implements OnFinished { // Broadcast vibrate settings broadcastVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER); broadcastVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION); - - // Restore the default media button receiver from the system settings - restoreMediaButtonReceiver(); } private int rescaleIndex(int index, int srcStream, int dstStream) { @@ -4837,26 +4834,6 @@ public class AudioService extends IAudioService.Stub implements OnFinished { } } - /** - * Helper function: - * Restore remote control receiver from the system settings. - */ - private void restoreMediaButtonReceiver() { - String receiverName = Settings.System.getStringForUser(mContentResolver, - Settings.System.MEDIA_BUTTON_RECEIVER, UserHandle.USER_CURRENT); - if ((null != receiverName) && !receiverName.isEmpty()) { - ComponentName eventReceiver = ComponentName.unflattenFromString(receiverName); - // construct a PendingIntent targeted to the restored component name - // for the media button and register it - Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON); - // the associated intent will be handled by the component being registered - mediaButtonIntent.setComponent(eventReceiver); - PendingIntent pi = PendingIntent.getBroadcast(mContext, - 0/*requestCode, ignored*/, mediaButtonIntent, 0/*flags*/); - registerMediaButtonIntent(pi, eventReceiver); - } - } - /** * Helper function: * Set the new remote control receiver at the top of the RC focus stack.