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

Commit 14f717a5 authored by RoboErik's avatar RoboErik
Browse files

rename add/removeCallback to register/unregisterCallback

bug:17390821
Change-Id: Id610b481083686dba2a28b6c7c47b747f89eef4f
parent 92e565f7
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -16376,8 +16376,6 @@ package android.media.session {
  public final class MediaController {
  public final class MediaController {
    ctor public MediaController(android.content.Context, android.media.session.MediaSession.Token);
    ctor public MediaController(android.content.Context, android.media.session.MediaSession.Token);
    method public void addCallback(android.media.session.MediaController.Callback);
    method public void addCallback(android.media.session.MediaController.Callback, android.os.Handler);
    method public void adjustVolume(int, int);
    method public void adjustVolume(int, int);
    method public boolean dispatchMediaButtonEvent(android.view.KeyEvent);
    method public boolean dispatchMediaButtonEvent(android.view.KeyEvent);
    method public android.os.Bundle getExtras();
    method public android.os.Bundle getExtras();
@@ -16392,9 +16390,11 @@ package android.media.session {
    method public android.app.PendingIntent getSessionActivity();
    method public android.app.PendingIntent getSessionActivity();
    method public android.media.session.MediaSession.Token getSessionToken();
    method public android.media.session.MediaSession.Token getSessionToken();
    method public android.media.session.MediaController.TransportControls getTransportControls();
    method public android.media.session.MediaController.TransportControls getTransportControls();
    method public void removeCallback(android.media.session.MediaController.Callback);
    method public void registerCallback(android.media.session.MediaController.Callback);
    method public void registerCallback(android.media.session.MediaController.Callback, android.os.Handler);
    method public void sendCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
    method public void sendCommand(java.lang.String, android.os.Bundle, android.os.ResultReceiver);
    method public void setVolumeTo(int, int);
    method public void setVolumeTo(int, int);
    method public void unregisterCallback(android.media.session.MediaController.Callback);
  }
  }
  public static abstract class MediaController.Callback {
  public static abstract class MediaController.Callback {
+3 −3
Original line number Original line Diff line number Diff line
@@ -980,7 +980,7 @@ import java.util.List;
        synchronized (mInfoLock) {
        synchronized (mInfoLock) {
            if (controller == null) {
            if (controller == null) {
                if (mCurrentSession != null) {
                if (mCurrentSession != null) {
                    mCurrentSession.removeCallback(mSessionCb);
                    mCurrentSession.unregisterCallback(mSessionCb);
                    mCurrentSession = null;
                    mCurrentSession = null;
                    sendMsg(mEventHandler, MSG_CLIENT_CHANGE, SENDMSG_REPLACE,
                    sendMsg(mEventHandler, MSG_CLIENT_CHANGE, SENDMSG_REPLACE,
                            0 /* genId */, 1 /* clearing */, null /* obj */, 0 /* delay */);
                            0 /* genId */, 1 /* clearing */, null /* obj */, 0 /* delay */);
@@ -989,12 +989,12 @@ import java.util.List;
                    || !controller.getSessionToken()
                    || !controller.getSessionToken()
                            .equals(mCurrentSession.getSessionToken())) {
                            .equals(mCurrentSession.getSessionToken())) {
                if (mCurrentSession != null) {
                if (mCurrentSession != null) {
                    mCurrentSession.removeCallback(mSessionCb);
                    mCurrentSession.unregisterCallback(mSessionCb);
                }
                }
                sendMsg(mEventHandler, MSG_CLIENT_CHANGE, SENDMSG_REPLACE,
                sendMsg(mEventHandler, MSG_CLIENT_CHANGE, SENDMSG_REPLACE,
                        0 /* genId */, 0 /* clearing */, null /* obj */, 0 /* delay */);
                        0 /* genId */, 0 /* clearing */, null /* obj */, 0 /* delay */);
                mCurrentSession = controller;
                mCurrentSession = controller;
                mCurrentSession.addCallback(mSessionCb, mEventHandler);
                mCurrentSession.registerCallback(mSessionCb, mEventHandler);


                PlaybackState state = controller.getPlaybackState();
                PlaybackState state = controller.getPlaybackState();
                sendMsg(mEventHandler, MSG_NEW_PLAYBACK_STATE, SENDMSG_REPLACE,
                sendMsg(mEventHandler, MSG_NEW_PLAYBACK_STATE, SENDMSG_REPLACE,
+9 −9
Original line number Original line Diff line number Diff line
@@ -329,24 +329,24 @@ public final class MediaController {
    }
    }


    /**
    /**
     * Adds a callback to receive updates from the Session. Updates will be
     * Registers a callback to receive updates from the Session. Updates will be
     * posted on the caller's thread.
     * posted on the caller's thread.
     *
     *
     * @param callback The callback object, must not be null.
     * @param callback The callback object, must not be null.
     */
     */
    public void addCallback(@NonNull Callback callback) {
    public void registerCallback(@NonNull Callback callback) {
        addCallback(callback, null);
        registerCallback(callback, null);
    }
    }


    /**
    /**
     * Adds a callback to receive updates from the session. Updates will be
     * Registers a callback to receive updates from the session. Updates will be
     * posted on the specified handler's thread.
     * posted on the specified handler's thread.
     *
     *
     * @param callback The callback object, must not be null.
     * @param callback The callback object, must not be null.
     * @param handler The handler to post updates on. If null the callers thread
     * @param handler The handler to post updates on. If null the callers thread
     *            will be used.
     *            will be used.
     */
     */
    public void addCallback(@NonNull Callback callback, @Nullable Handler handler) {
    public void registerCallback(@NonNull Callback callback, @Nullable Handler handler) {
        if (callback == null) {
        if (callback == null) {
            throw new IllegalArgumentException("callback must not be null");
            throw new IllegalArgumentException("callback must not be null");
        }
        }
@@ -359,12 +359,12 @@ public final class MediaController {
    }
    }


    /**
    /**
     * Stop receiving updates on the specified callback. If an update has
     * Unregisters the specified callback. If an update has already been posted
     * already been posted you may still receive it after calling this method.
     * you may still receive it after calling this method.
     *
     *
     * @param callback The callback to remove.
     * @param callback The callback to remove.
     */
     */
    public void removeCallback(@NonNull Callback callback) {
    public void unregisterCallback(@NonNull Callback callback) {
        if (callback == null) {
        if (callback == null) {
            throw new IllegalArgumentException("callback must not be null");
            throw new IllegalArgumentException("callback must not be null");
        }
        }
@@ -495,7 +495,7 @@ public final class MediaController {


    /**
    /**
     * Callback for receiving updates on from the session. A Callback can be
     * Callback for receiving updates on from the session. A Callback can be
     * registered using {@link #addCallback}
     * registered using {@link #registerCallback}
     */
     */
    public static abstract class Callback {
    public static abstract class Callback {
        /**
        /**
+2 −2
Original line number Original line Diff line number Diff line
@@ -1730,12 +1730,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                    // something old was playing
                    // something old was playing
                    Log.v(TAG, "DEBUG_MEDIA: Disconnecting from old controller: "
                    Log.v(TAG, "DEBUG_MEDIA: Disconnecting from old controller: "
                            + mMediaController);
                            + mMediaController);
                    mMediaController.removeCallback(mMediaListener);
                    mMediaController.unregisterCallback(mMediaListener);
                }
                }
                mMediaController = controller;
                mMediaController = controller;


                if (mMediaController != null) {
                if (mMediaController != null) {
                    mMediaController.addCallback(mMediaListener);
                    mMediaController.registerCallback(mMediaListener);
                    mMediaMetadata = mMediaController.getMetadata();
                    mMediaMetadata = mMediaController.getMetadata();
                    if (DEBUG_MEDIA) {
                    if (DEBUG_MEDIA) {
                        Log.v(TAG, "DEBUG_MEDIA: insert listener, receive metadata: "
                        Log.v(TAG, "DEBUG_MEDIA: insert listener, receive metadata: "
+3 −3
Original line number Original line Diff line number Diff line
@@ -1055,11 +1055,11 @@ public class VolumePanel extends Handler {
        if (sc != null) {
        if (sc != null) {
            if (streamType == STREAM_REMOTE_MUSIC && controller != sc.controller) {
            if (streamType == STREAM_REMOTE_MUSIC && controller != sc.controller) {
                if (sc.controller != null) {
                if (sc.controller != null) {
                    sc.controller.removeCallback(mMediaControllerCb);
                    sc.controller.unregisterCallback(mMediaControllerCb);
                }
                }
                sc.controller = controller;
                sc.controller = controller;
                if (controller != null) {
                if (controller != null) {
                    sc.controller.addCallback(mMediaControllerCb);
                    sc.controller.registerCallback(mMediaControllerCb);
                }
                }
            }
            }
            if (sc.seekbarView.getMax() != max) {
            if (sc.seekbarView.getMax() != max) {
@@ -1175,7 +1175,7 @@ public class VolumePanel extends Handler {
            StreamControl sc = mStreamControls.get(STREAM_REMOTE_MUSIC);
            StreamControl sc = mStreamControls.get(STREAM_REMOTE_MUSIC);
            if (sc != null) {
            if (sc != null) {
                if (sc.controller != null) {
                if (sc.controller != null) {
                    sc.controller.removeCallback(mMediaControllerCb);
                    sc.controller.unregisterCallback(mMediaControllerCb);
                    sc.controller = null;
                    sc.controller = null;
                }
                }
            }
            }
Loading