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

Commit b59ecae1 authored by Hyundo Moon's avatar Hyundo Moon Committed by Android (Google) Code Review
Browse files

Merge "Add MediaController.getHandlerForCallback() for testing"

parents 7c889905 b921e031
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@ import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;

import com.android.internal.annotations.VisibleForTesting;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
@@ -437,7 +439,7 @@ public final class MediaController {
        }

        if (mSessionInfo == null) {
            Log.w(TAG, "sessionInfo shouldn't be null.");
            Log.d(TAG, "sessionInfo is not set.");
            mSessionInfo = Bundle.EMPTY;
        } else if (MediaSession.hasCustomParcelable(mSessionInfo)) {
            Log.w(TAG, "sessionInfo contains custom parcelable. Ignoring.");
@@ -514,6 +516,17 @@ public final class MediaController {
        return success;
    }

    /**
     * Gets associated handler for the given callback.
     * @hide
     */
    @VisibleForTesting
    public Handler getHandlerForCallback(Callback cb) {
        synchronized (mLock) {
            return getHandlerForCallbackLocked(cb);
        }
    }

    private MessageHandler getHandlerForCallbackLocked(Callback cb) {
        if (cb == null) {
            throw new IllegalArgumentException("Callback cannot be null");