Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2cb287f9 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android Git Automerger
Browse files

am 9ea996a3: Do not restore the media button event receiver

* commit '9ea996a3':
  Do not restore the media button event receiver
parents 3a544a81 9ea996a3
Loading
Loading
Loading
Loading
+0 −23
Original line number Original line Diff line number Diff line
@@ -756,9 +756,6 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
        // Broadcast vibrate settings
        // Broadcast vibrate settings
        broadcastVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER);
        broadcastVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER);
        broadcastVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION);
        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) {
    private int rescaleIndex(int index, int srcStream, int dstStream) {
@@ -4882,26 +4879,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:
     * Helper function:
     * Set the new remote control receiver at the top of the RC focus stack.
     * Set the new remote control receiver at the top of the RC focus stack.