Skip to content

Commit 5a3322f

Browse files
Jim MillerAndroid (Google) Code Review
authored andcommitted
Merge "Fix unresponsive back button in keyguard." into jb-mr1-dev
2 parents fdcb225 + 0a34d9e commit 5a3322f

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -266,17 +266,6 @@ private void showDialog(String title, String message) {
266266
dialog.show();
267267
}
268268

269-
@Override
270-
public boolean dispatchKeyEvent(KeyEvent event) {
271-
if (event.getAction() == KeyEvent.ACTION_UP
272-
&& event.getKeyCode() == KeyEvent.KEYCODE_BACK
273-
&& mCurrentSecuritySelection != SecurityMode.None) {
274-
mCallback.dismiss(false);
275-
return true;
276-
}
277-
return super.dispatchKeyEvent(event);
278-
}
279-
280269
private void showTimeoutDialog() {
281270
int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
282271
int messageId = 0;
@@ -859,4 +848,12 @@ public void goToUserSwitcher() {
859848
mAppWidgetContainer.setCurrentPage(getWidgetPosition(R.id.keyguard_multi_user_selector));
860849
}
861850

851+
public boolean handleBackKey() {
852+
if (mCurrentSecuritySelection != SecurityMode.None) {
853+
mCallback.dismiss(false);
854+
return true;
855+
}
856+
return false;
857+
}
858+
862859
}

policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@ protected void onConfigurationChanged(Configuration newConfig) {
129129
super.onConfigurationChanged(newConfig);
130130
maybeCreateKeyguardLocked(shouldEnableScreenRotation(), null);
131131
}
132+
133+
@Override
134+
public boolean dispatchKeyEvent(KeyEvent event) {
135+
if (event.getAction() == KeyEvent.ACTION_DOWN
136+
&& event.getKeyCode() == KeyEvent.KEYCODE_BACK
137+
&& mKeyguardView != null) {
138+
if (mKeyguardView.handleBackKey()) {
139+
return true;
140+
}
141+
}
142+
return super.dispatchKeyEvent(event);
143+
}
132144
}
133145

134146
SparseArray<Parcelable> mStateContainer = new SparseArray<Parcelable>();

0 commit comments

Comments
 (0)