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
diff --git a/policy/com/android/internal/policy/impl/KeyguardViewBase.java b/policy/com/android/internal/policy/impl/KeyguardViewBase.java
index f67f6a9..2b44d45 100644
--- a/policy/com/android/internal/policy/impl/KeyguardViewBase.java
+++ b/policy/com/android/internal/policy/impl/KeyguardViewBase.java
@@ -142,7 +142,7 @@
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 @@
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 @@
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);
diff --git a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java
index 71acef9..a032cb1 100644
--- a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -676,12 +676,12 @@
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;
}
diff --git a/policy/com/android/internal/policy/impl/PhoneWindow.java b/policy/com/android/internal/policy/impl/PhoneWindow.java
index 8d9a733..da92275 100644
--- a/policy/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/com/android/internal/policy/impl/PhoneWindow.java
@@ -1230,7 +1230,7 @@
}
- 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 @@
}
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 @@
}
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);
diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java
index 95dda57..21c3267 100644
--- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1385,12 +1385,12 @@
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;