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

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

Merge "Rename KeyEvent.isMediaKey() to isMediaSessionKey()"

parents 0ba5e3d6 9a908db9
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1862,12 +1862,12 @@ public class KeyEvent extends InputEvent implements Parcelable {
    }

    /**
     * Whether this key is a media key, which can be send to apps that are
     * interested in media key events.
     * Returns whether this key can be handled by
     * {@link android.media.session.MediaSession.Callback}.
     *
     * @hide
     */
    public static final boolean isMediaKey(int keyCode) {
    public static final boolean isMediaSessionKey(int keyCode) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_MEDIA_PLAY:
            case KeyEvent.KEYCODE_MEDIA_PAUSE:
+2 −2
Original line number Diff line number Diff line
@@ -1891,7 +1891,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                return true;
            }
            // These are all the recognized media key codes in
            // KeyEvent.isMediaKey()
            // KeyEvent.isMediaSessionKey()
            case KeyEvent.KEYCODE_MEDIA_PLAY:
            case KeyEvent.KEYCODE_MEDIA_PAUSE:
            case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
@@ -1992,7 +1992,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                return true;
            }
            // These are all the recognized media key codes in
            // KeyEvent.isMediaKey()
            // KeyEvent.isMediaSessionKey()
            case KeyEvent.KEYCODE_MEDIA_PLAY:
            case KeyEvent.KEYCODE_MEDIA_PAUSE:
            case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
+1 −3
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.annotation.UnsupportedAppUsage;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.media.session.MediaController;
import android.media.session.MediaSession;
@@ -36,7 +35,6 @@ import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;

import java.lang.ref.WeakReference;
import java.util.List;

/**
@@ -250,7 +248,7 @@ import java.util.List;
     * @throws IllegalArgumentException
     */
    public boolean sendMediaKeyEvent(KeyEvent keyEvent) throws IllegalArgumentException {
        if (!KeyEvent.isMediaKey(keyEvent.getKeyCode())) {
        if (!KeyEvent.isMediaSessionKey(keyEvent.getKeyCode())) {
            throw new IllegalArgumentException("not a media key event");
        }
        synchronized (mInfoLock) {
+1 −1
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ public final class MediaController {
        if (keyEvent == null) {
            throw new IllegalArgumentException("KeyEvent may not be null");
        }
        if (!KeyEvent.isMediaKey(keyEvent.getKeyCode())) {
        if (!KeyEvent.isMediaSessionKey(keyEvent.getKeyCode())) {
            return false;
        }
        try {
+1 −3
Original line number Diff line number Diff line
@@ -59,9 +59,7 @@ import com.android.internal.os.SomeArgs;
import com.android.internal.util.Preconditions;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * The TvInputService class represents a TV input or source such as HDMI or built-in tuner which
@@ -1400,7 +1398,7 @@ public abstract class TvInputService extends Service {
                // ViewRootImpl always consumes the keys. In this case, the application loses
                // a chance to handle media keys. Therefore, media keys are not dispatched to
                // ViewRootImpl.
                skipDispatchToOverlayView = KeyEvent.isMediaKey(keyEvent.getKeyCode())
                skipDispatchToOverlayView = KeyEvent.isMediaSessionKey(keyEvent.getKeyCode())
                        || keyEvent.getKeyCode() == KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK;
            } else if (event instanceof MotionEvent) {
                MotionEvent motionEvent = (MotionEvent) event;
Loading