summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorDianne Hackborn <>2009-04-09 12:31:13 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-09 12:31:13 -0700
commit5eabbd9f27b5684508b5f5f1f99030c67984ae81 (patch)
treece5a74bab92023e7b3a49564183468a111bf51ca /core/java
parentd6fbffe6eabd7e910507f85853e1bc797a3c5d6d (diff)
downloadframeworks_base-5eabbd9f27b5684508b5f5f1f99030c67984ae81.zip
frameworks_base-5eabbd9f27b5684508b5f5f1f99030c67984ae81.tar.gz
frameworks_base-5eabbd9f27b5684508b5f5f1f99030c67984ae81.tar.bz2
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
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/KeyEvent.java33
-rw-r--r--core/java/android/widget/MediaController.java4
-rw-r--r--core/java/android/widget/VideoView.java4
3 files changed, 24 insertions, 17 deletions
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index 41779ba..6349288 100644
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -111,14 +111,13 @@ public class KeyEvent implements Parcelable {
public static final int KEYCODE_MENU = 82;
public static final int KEYCODE_NOTIFICATION = 83;
public static final int KEYCODE_SEARCH = 84;
- public static final int KEYCODE_PLAYPAUSE = 85;
- public static final int KEYCODE_STOP = 86;
- public static final int KEYCODE_NEXTSONG = 87;
- public static final int KEYCODE_PREVIOUSSONG = 88;
- public static final int KEYCODE_REWIND = 89;
- public static final int KEYCODE_FORWARD = 90;
+ public static final int KEYCODE_MEDIA_PLAY_PAUSE= 85;
+ public static final int KEYCODE_MEDIA_STOP = 86;
+ public static final int KEYCODE_MEDIA_NEXT = 87;
+ public static final int KEYCODE_MEDIA_PREVIOUS = 88;
+ public static final int KEYCODE_MEDIA_REWIND = 89;
+ public static final int KEYCODE_MEDIA_FAST_FORWARD = 90;
public static final int KEYCODE_MUTE = 91;
- private static final int LAST_KEYCODE = KEYCODE_MUTE;
// NOTE: If you add a new keycode here you must also add it to:
// isSystem()
@@ -127,7 +126,15 @@ public class KeyEvent implements Parcelable {
// frameworks/base/core/res/res/values/attrs.xml
// commands/monkey/Monkey.java
// emulator?
+ //
+ // Also Android currently does not reserve code ranges for vendor-
+ // specific key codes. If you have new key codes to have, you
+ // MUST contribute a patch to the open source project to define
+ // those new codes. This is intended to maintain a consistent
+ // set of key code definitions across all Android devices.
+ private static final int LAST_KEYCODE = KEYCODE_MUTE;
+
/**
* @deprecated There are now more than MAX_KEYCODE keycodes.
* Use {@link #getMaxKeyCode()} instead.
@@ -582,12 +589,12 @@ public class KeyEvent implements Parcelable {
case KEYCODE_MUTE:
case KEYCODE_POWER:
case KEYCODE_HEADSETHOOK:
- case KEYCODE_PLAYPAUSE:
- case KEYCODE_STOP:
- case KEYCODE_NEXTSONG:
- case KEYCODE_PREVIOUSSONG:
- case KEYCODE_REWIND:
- case KEYCODE_FORWARD:
+ case KEYCODE_MEDIA_PLAY_PAUSE:
+ case KEYCODE_MEDIA_STOP:
+ case KEYCODE_MEDIA_NEXT:
+ case KEYCODE_MEDIA_PREVIOUS:
+ case KEYCODE_MEDIA_REWIND:
+ case KEYCODE_MEDIA_FAST_FORWARD:
case KEYCODE_CAMERA:
case KEYCODE_FOCUS:
case KEYCODE_SEARCH:
diff --git a/core/java/android/widget/MediaController.java b/core/java/android/widget/MediaController.java
index a2ec83f..b162a0e 100644
--- a/core/java/android/widget/MediaController.java
+++ b/core/java/android/widget/MediaController.java
@@ -388,12 +388,12 @@ public class MediaController extends FrameLayout {
int keyCode = event.getKeyCode();
if (event.getRepeatCount() == 0 && event.isDown() && (
keyCode == KeyEvent.KEYCODE_HEADSETHOOK ||
- keyCode == KeyEvent.KEYCODE_PLAYPAUSE ||
+ keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE ||
keyCode == KeyEvent.KEYCODE_SPACE)) {
doPauseResume();
show(sDefaultTimeout);
return true;
- } else if (keyCode == KeyEvent.KEYCODE_STOP) {
+ } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP) {
if (mPlayer.isPlaying()) {
mPlayer.pause();
updatePausePlay();
diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java
index 4c5df2f..6d3a2d3 100644
--- a/core/java/android/widget/VideoView.java
+++ b/core/java/android/widget/VideoView.java
@@ -460,7 +460,7 @@ public class VideoView extends SurfaceView implements MediaPlayerControl {
mMediaPlayer != null &&
mMediaController != null) {
if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK ||
- keyCode == KeyEvent.KEYCODE_PLAYPAUSE) {
+ keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
if (mMediaPlayer.isPlaying()) {
pause();
mMediaController.show();
@@ -469,7 +469,7 @@ public class VideoView extends SurfaceView implements MediaPlayerControl {
mMediaController.hide();
}
return true;
- } else if (keyCode == KeyEvent.KEYCODE_STOP
+ } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP
&& mMediaPlayer.isPlaying()) {
pause();
mMediaController.show();