Merge "Password bouncer - Go back on first gesture"
This commit is contained in:
@@ -374,6 +374,17 @@ public class KeyguardHostViewController extends ViewController<KeyguardHostView>
|
||||
return !configDisabled || isTestHarness || fileOverride;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the current bouncer is password
|
||||
*/
|
||||
public boolean dispatchBackKeyEventPreIme() {
|
||||
if (mKeyguardSecurityContainerController.getCurrentSecurityMode()
|
||||
== SecurityMode.Password) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the media keys to work when the keyguard is showing.
|
||||
* The media keys should be of no interest to the actual keyguard view(s),
|
||||
|
||||
@@ -494,6 +494,14 @@ public class KeyguardBouncer {
|
||||
return mKeyguardViewController.interceptMediaKey(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the pre IME back event should be handled
|
||||
*/
|
||||
public boolean dispatchBackKeyEventPreIme() {
|
||||
ensureView();
|
||||
return mKeyguardViewController.dispatchBackKeyEventPreIme();
|
||||
}
|
||||
|
||||
public void notifyKeyguardAuthenticated(boolean strongAuth) {
|
||||
ensureView();
|
||||
mKeyguardViewController.finish(strongAuth, KeyguardUpdateMonitor.getCurrentUser());
|
||||
|
||||
@@ -162,6 +162,11 @@ public class NotificationShadeWindowView extends FrameLayout {
|
||||
return mInteractionEventHandler.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEventPreIme(KeyEvent event) {
|
||||
return mInteractionEventHandler.dispatchKeyEventPreIme(event);
|
||||
}
|
||||
|
||||
protected void setInteractionEventHandler(InteractionEventHandler listener) {
|
||||
mInteractionEventHandler = listener;
|
||||
}
|
||||
@@ -361,6 +366,8 @@ public class NotificationShadeWindowView extends FrameLayout {
|
||||
boolean interceptMediaKey(KeyEvent event);
|
||||
|
||||
boolean dispatchKeyEvent(KeyEvent event);
|
||||
|
||||
boolean dispatchKeyEventPreIme(KeyEvent event);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -347,6 +347,11 @@ public class NotificationShadeWindowViewController {
|
||||
return mService.interceptMediaKey(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEventPreIme(KeyEvent event) {
|
||||
return mService.dispatchKeyEventPreIme(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
boolean down = event.getAction() == KeyEvent.ACTION_DOWN;
|
||||
|
||||
@@ -3520,6 +3520,23 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
&& mStatusBarKeyguardViewManager.interceptMediaKey(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* While IME is active and a BACK event is detected, check with
|
||||
* {@link StatusBarKeyguardViewManager#dispatchBackKeyEventPreIme(KeyEvent)} to see if the event
|
||||
* should be handled before routing to IME, in order to prevent the user having to hit back
|
||||
* twice to exit bouncer.
|
||||
*/
|
||||
public boolean dispatchKeyEventPreIme(KeyEvent event) {
|
||||
switch (event.getKeyCode()) {
|
||||
case KeyEvent.KEYCODE_BACK:
|
||||
if (mState == StatusBarState.KEYGUARD
|
||||
&& mStatusBarKeyguardViewManager.dispatchBackKeyEventPreIme()) {
|
||||
return onBackPressed();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean shouldUnlockOnMenuPressed() {
|
||||
return mDeviceInteractive && mState != StatusBarState.SHADE
|
||||
&& mStatusBarKeyguardViewManager.shouldDismissOnMenuPressed();
|
||||
|
||||
@@ -955,6 +955,13 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
return mBouncer.interceptMediaKey(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the pre IME back event should be handled
|
||||
*/
|
||||
public boolean dispatchBackKeyEventPreIme() {
|
||||
return mBouncer.dispatchBackKeyEventPreIme();
|
||||
}
|
||||
|
||||
public void readyForKeyguardDone() {
|
||||
mViewMediatorCallback.readyForKeyguardDone();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user