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

Commit 3ee81a95 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by The Android Open Source Project
Browse files

AI 145382: API review: change new media keycode names to avoid ambiguity.

  Updates the key maps.  During this I noticed that the dream keymap didn't have all of the media buttons like the sapphire key map...!  So this is now changed to match.
  BUG=1779435

Automated import of CL 145382
parent 070615ad
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ public abstract class KeyguardViewBase extends FrameLayout {
        final int keyCode = event.getKeyCode();
        if (event.getAction() == KeyEvent.ACTION_DOWN) {
            switch (keyCode) {
                case KeyEvent.KEYCODE_PLAYPAUSE:
                case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
                    /* Suppress PLAYPAUSE toggle when phone is ringing or
                     * in-call to avoid music playback */
                    if (mTelephonyManager == null) {
@@ -154,11 +154,11 @@ public abstract class KeyguardViewBase extends FrameLayout {
                        return true;  // suppress key event
                    }
                case KeyEvent.KEYCODE_HEADSETHOOK: 
                case KeyEvent.KEYCODE_STOP: 
                case KeyEvent.KEYCODE_NEXTSONG: 
                case KeyEvent.KEYCODE_PREVIOUSSONG: 
                case KeyEvent.KEYCODE_REWIND: 
                case KeyEvent.KEYCODE_FORWARD: {
                case KeyEvent.KEYCODE_MEDIA_STOP: 
                case KeyEvent.KEYCODE_MEDIA_NEXT: 
                case KeyEvent.KEYCODE_MEDIA_PREVIOUS: 
                case KeyEvent.KEYCODE_MEDIA_REWIND: 
                case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: {
                    Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
                    intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
                    getContext().sendOrderedBroadcast(intent, null);
@@ -190,12 +190,12 @@ public abstract class KeyguardViewBase extends FrameLayout {
            switch (keyCode) {
                case KeyEvent.KEYCODE_MUTE:
                case KeyEvent.KEYCODE_HEADSETHOOK: 
                case KeyEvent.KEYCODE_PLAYPAUSE: 
                case KeyEvent.KEYCODE_STOP: 
                case KeyEvent.KEYCODE_NEXTSONG: 
                case KeyEvent.KEYCODE_PREVIOUSSONG: 
                case KeyEvent.KEYCODE_REWIND: 
                case KeyEvent.KEYCODE_FORWARD: {
                case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: 
                case KeyEvent.KEYCODE_MEDIA_STOP: 
                case KeyEvent.KEYCODE_MEDIA_NEXT: 
                case KeyEvent.KEYCODE_MEDIA_PREVIOUS: 
                case KeyEvent.KEYCODE_MEDIA_REWIND: 
                case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: {
                    Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
                    intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
                    getContext().sendOrderedBroadcast(intent, null);
+6 −6
Original line number Diff line number Diff line
@@ -676,12 +676,12 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
            case KeyEvent.KEYCODE_VOLUME_DOWN:
            case KeyEvent.KEYCODE_MUTE:
            case KeyEvent.KEYCODE_HEADSETHOOK: 
            case KeyEvent.KEYCODE_PLAYPAUSE: 
            case KeyEvent.KEYCODE_STOP: 
            case KeyEvent.KEYCODE_NEXTSONG: 
            case KeyEvent.KEYCODE_PREVIOUSSONG: 
            case KeyEvent.KEYCODE_REWIND: 
            case KeyEvent.KEYCODE_FORWARD:
            case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: 
            case KeyEvent.KEYCODE_MEDIA_STOP: 
            case KeyEvent.KEYCODE_MEDIA_NEXT: 
            case KeyEvent.KEYCODE_MEDIA_PREVIOUS: 
            case KeyEvent.KEYCODE_MEDIA_REWIND: 
            case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
            case KeyEvent.KEYCODE_CAMERA:
                return false;
        }
+12 −12
Original line number Diff line number Diff line
@@ -1230,7 +1230,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
            }


            case KeyEvent.KEYCODE_PLAYPAUSE:
            case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
                /* Suppress PLAYPAUSE toggle when phone is ringing or in-call
                 * to avoid music playback */
                if (mTelephonyManager == null) {
@@ -1243,11 +1243,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                }
            case KeyEvent.KEYCODE_MUTE:
            case KeyEvent.KEYCODE_HEADSETHOOK:
            case KeyEvent.KEYCODE_STOP:
            case KeyEvent.KEYCODE_NEXTSONG:
            case KeyEvent.KEYCODE_PREVIOUSSONG:
            case KeyEvent.KEYCODE_REWIND:
            case KeyEvent.KEYCODE_FORWARD: {
            case KeyEvent.KEYCODE_MEDIA_STOP:
            case KeyEvent.KEYCODE_MEDIA_NEXT:
            case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
            case KeyEvent.KEYCODE_MEDIA_REWIND:
            case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: {
                Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
                intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
                getContext().sendOrderedBroadcast(intent, null);
@@ -1370,12 +1370,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
            }

            case KeyEvent.KEYCODE_HEADSETHOOK:
            case KeyEvent.KEYCODE_PLAYPAUSE:
            case KeyEvent.KEYCODE_STOP:
            case KeyEvent.KEYCODE_NEXTSONG:
            case KeyEvent.KEYCODE_PREVIOUSSONG:
            case KeyEvent.KEYCODE_REWIND:
            case KeyEvent.KEYCODE_FORWARD: {
            case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
            case KeyEvent.KEYCODE_MEDIA_STOP:
            case KeyEvent.KEYCODE_MEDIA_NEXT:
            case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
            case KeyEvent.KEYCODE_MEDIA_REWIND:
            case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD: {
                Intent intent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
                intent.putExtra(Intent.EXTRA_KEY_EVENT, event);
                getContext().sendOrderedBroadcast(intent, null);
+6 −6
Original line number Diff line number Diff line
@@ -1385,12 +1385,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    
    static boolean isMediaKey(int code) {
        if (code == KeyEvent.KEYCODE_HEADSETHOOK || 
                code == KeyEvent.KEYCODE_PLAYPAUSE ||
                code == KeyEvent.KEYCODE_STOP || 
                code == KeyEvent.KEYCODE_NEXTSONG ||
                code == KeyEvent.KEYCODE_PREVIOUSSONG || 
                code == KeyEvent.KEYCODE_PREVIOUSSONG ||
                code == KeyEvent.KEYCODE_FORWARD) {
                code == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE ||
                code == KeyEvent.KEYCODE_MEDIA_STOP || 
                code == KeyEvent.KEYCODE_MEDIA_NEXT ||
                code == KeyEvent.KEYCODE_MEDIA_PREVIOUS || 
                code == KeyEvent.KEYCODE_MEDIA_PREVIOUS ||
                code == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) {
            return true;
        }
        return false;