Merge "Handle media key events correctly on Keyguard."
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,9 @@ public class StatusBarWindowView extends FrameLayout {
|
||||
return mService.onMenuPressed();
|
||||
}
|
||||
}
|
||||
if (mService.interceptMediaKey(event)) {
|
||||
return true;
|
||||
}
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user