summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorYoungsang Cho <youngsang@google.com>2015-03-25 04:47:28 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-03-25 04:47:30 +0000
commit94615e49e15dd23bcced3bfb152c67f16720db07 (patch)
tree9f369edf8d4a3afb397ffc7f177fdbfd2809c4b4 /media
parent1f5fd58741564c5ebd7e0a6de3ad71eb4f279e44 (diff)
parent53aa5744c9a233e54b8f8b8389a86f99abcc4244 (diff)
downloadframeworks_base-94615e49e15dd23bcced3bfb152c67f16720db07.zip
frameworks_base-94615e49e15dd23bcced3bfb152c67f16720db07.tar.gz
frameworks_base-94615e49e15dd23bcced3bfb152c67f16720db07.tar.bz2
Merge "Make TvInputService skip to dispatch media keys to an overlay view"
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/tv/TvInputService.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java
index b887855..8ed383a 100644
--- a/media/java/android/media/tv/TvInputService.java
+++ b/media/java/android/media/tv/TvInputService.java
@@ -1077,12 +1077,19 @@ public abstract class TvInputService extends Service {
int dispatchInputEvent(InputEvent event, InputEventReceiver receiver) {
if (DEBUG) Log.d(TAG, "dispatchInputEvent(" + event + ")");
boolean isNavigationKey = false;
+ boolean skipDispatchToOverlayView = false;
if (event instanceof KeyEvent) {
KeyEvent keyEvent = (KeyEvent) event;
- isNavigationKey = isNavigationKey(keyEvent.getKeyCode());
if (keyEvent.dispatch(this, mDispatcherState, this)) {
return TvInputManager.Session.DISPATCH_HANDLED;
}
+ isNavigationKey = isNavigationKey(keyEvent.getKeyCode());
+ // When media keys and KEYCODE_MEDIA_AUDIO_TRACK are dispatched to ViewRootImpl,
+ // ViewRootImpl always consumes the keys. In this case, an application loses
+ // a chance to handle media keys. Therefore, media keys are not dispatched to
+ // ViewRootImpl.
+ skipDispatchToOverlayView = KeyEvent.isMediaKey(keyEvent.getKeyCode())
+ || keyEvent.getKeyCode() == KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK;
} else if (event instanceof MotionEvent) {
MotionEvent motionEvent = (MotionEvent) event;
final int source = motionEvent.getSource();
@@ -1100,7 +1107,8 @@ public abstract class TvInputService extends Service {
}
}
}
- if (mOverlayViewContainer == null || !mOverlayViewContainer.isAttachedToWindow()) {
+ if (mOverlayViewContainer == null || !mOverlayViewContainer.isAttachedToWindow()
+ || skipDispatchToOverlayView) {
return TvInputManager.Session.DISPATCH_NOT_HANDLED;
}
if (!mOverlayViewContainer.hasWindowFocus()) {