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

Commit 837da715 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge "Bug 5045498 Send media button event receiver to remote control"

parents 994a7474 0a9faa8c
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1828,6 +1828,17 @@ public class AudioManager {
    public static final String EXTRA_REMOTE_CONTROL_CLIENT =
            "android.media.EXTRA_REMOTE_CONTROL_CLIENT";

    /**
     * @hide
     * The media button event receiver associated with the IRemoteControlClient.
     * The {@link android.content.ComponentName} value of the event receiver can be retrieved with
     * {@link android.content.ComponentName#unflattenFromString(String)}
     *
     * @see #REMOTE_CONTROL_CLIENT_CHANGED_ACTION
     */
    public static final String EXTRA_REMOTE_CONTROL_EVENT_RECEIVER =
            "android.media.EXTRA_REMOTE_CONTROL_EVENT_RECEIVER";

    /**
     * @hide
     * The flags describing what information has changed in the current remote control client.
+7 −2
Original line number Diff line number Diff line
@@ -2167,8 +2167,10 @@ public class AudioService extends IAudioService.Stub {

                case MSG_RCDISPLAY_UPDATE:
                    synchronized(mCurrentRcLock) {
                        // msg.obj is guaranteed to be non null
                        RemoteControlStackEntry rcse = (RemoteControlStackEntry)msg.obj;
                        if ((mCurrentRcClient == null) ||
                                (!mCurrentRcClient.equals((IRemoteControlClient)msg.obj))) {
                                (!mCurrentRcClient.equals(rcse.mRcClient))) {
                            // the remote control display owner has changed between the
                            // the message to update the display was sent, and the time it
                            // gets to be processed (now)
@@ -2183,6 +2185,9 @@ public class AudioService extends IAudioService.Stub {
                            rcClientIntent.putExtra(
                                    AudioManager.EXTRA_REMOTE_CONTROL_CLIENT_INFO_CHANGED,
                                    msg.arg1);
                            rcClientIntent.putExtra(
                                    AudioManager.EXTRA_REMOTE_CONTROL_EVENT_RECEIVER,
                                    rcse.mReceiverComponent.flattenToString());
                            rcClientIntent.setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
                            mContext.sendBroadcast(rcClientIntent);
                        }
@@ -3131,7 +3136,7 @@ public class AudioService extends IAudioService.Stub {
            mCurrentRcClient = rcse.mRcClient;
        }
        mAudioHandler.sendMessage( mAudioHandler.obtainMessage(MSG_RCDISPLAY_UPDATE,
                infoFlagsAboutToBeUsed /* arg1 */, 0, rcse.mRcClient /* obj */) );
                infoFlagsAboutToBeUsed /* arg1 */, 0, rcse /* obj, != null */) );
    }

    /**