diff options
5 files changed, 21 insertions, 1 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java index d8e5b8a..a9206e7 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java @@ -297,7 +297,7 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa * @param event The key event * @return whether the event was consumed as a media key. */ - private boolean interceptMediaKey(KeyEvent event) { + public boolean interceptMediaKey(KeyEvent event) { final int keyCode = event.getKeyCode(); if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (keyCode) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 1ffb4ee..d8e1766 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.phone; import android.content.Context; +import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -160,4 +161,9 @@ public class KeyguardBouncer { return false; } } + + public boolean interceptMediaKey(KeyEvent event) { + ensureView(); + return mKeyguardView.interceptMediaKey(event); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 922ac05..23b0594 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -68,6 +68,7 @@ import android.util.EventLog; import android.util.Log; import android.view.Display; import android.view.Gravity; +import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.VelocityTracker; @@ -2767,6 +2768,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } } + public boolean interceptMediaKey(KeyEvent event) { + return mState == StatusBarState.KEYGUARD + && mStatusBarKeyguardViewManager.interceptMediaKey(event); + } + public boolean onMenuPressed() { return mState == StatusBarState.KEYGUARD && mStatusBarKeyguardViewManager.onMenuPressed(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index b624c96..2ae21ac 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -20,6 +20,7 @@ import android.content.Context; import android.os.Bundle; import android.os.RemoteException; import android.util.Slog; +import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; @@ -227,4 +228,8 @@ public class StatusBarKeyguardViewManager { public boolean onMenuPressed() { return mBouncer.onMenuPressed(); } + + public boolean interceptMediaKey(KeyEvent event) { + return mBouncer.interceptMediaKey(event); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java index e802d18..b51626d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -103,6 +103,9 @@ public class StatusBarWindowView extends FrameLayout { return mService.onMenuPressed(); } } + if (mService.interceptMediaKey(event)) { + return true; + } return super.dispatchKeyEvent(event); } |