diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-04-10 20:37:32 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2014-04-10 21:10:22 +0200 |
commit | e5c7a894635d72514d6f1e952d0f18ba6035e86d (patch) | |
tree | 6c589b2c588e79c6b4b06be8eae64a9d3e38bd11 /packages/SystemUI | |
parent | d4a57440ca5fc8461959176475b0fcd8a6e05871 (diff) | |
download | frameworks_base-e5c7a894635d72514d6f1e952d0f18ba6035e86d.zip frameworks_base-e5c7a894635d72514d6f1e952d0f18ba6035e86d.tar.gz frameworks_base-e5c7a894635d72514d6f1e952d0f18ba6035e86d.tar.bz2 |
Hide back button on keyguard and make it work for bouncer.
Bug: 13635952
Change-Id: Ie9824dd9926c9deb0a38c8e0a6161f605a489622
Diffstat (limited to 'packages/SystemUI')
4 files changed, 45 insertions, 2 deletions
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 11ccf2e..7cbde36 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -105,6 +105,10 @@ public class KeyguardBouncer { return KeyguardViewMediator.AWAKE_INTERVAL_DEFAULT_MS; } + public boolean isShowing() { + return mRoot != null && mRoot.getVisibility() == View.VISIBLE; + } + private void ensureView() { if (mRoot == null) { inflateView(); @@ -128,4 +132,8 @@ public class KeyguardBouncer { mRoot = null; } } + + public boolean onBackPressed() { + return mKeyguardView != null && mKeyguardView.handleBackKey(); + } } 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 a8b86a8..05d723a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -2857,6 +2857,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode { } } + public boolean onBackPressed() { + if (mOnKeyguard) { + return mStatusBarKeyguardViewManager.onBackPressed(); + } else { + animateCollapsePanels(); + return true; + } + } + private void showBouncer() { if (mOnKeyguard) { mStatusBarKeyguardViewManager.dismiss(); 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 73fc466..b8592c3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -62,7 +62,6 @@ public class StatusBarKeyguardViewManager { mContext = context; mViewMediatorCallback = callback; mLockPatternUtils = lockPatternUtils; - } public void registerStatusBar(PhoneStatusBar phoneStatusBar, @@ -83,10 +82,12 @@ public class StatusBarKeyguardViewManager { mStatusBarWindowManager.setKeyguardShowing(true); mPhoneStatusBar.showKeyguard(); mBouncer.prepare(); + updateBackButtonState(); } public void showBouncer() { mBouncer.show(); + updateBackButtonState(); } /** @@ -95,6 +96,7 @@ public class StatusBarKeyguardViewManager { public void reset() { mBouncer.reset(); mPhoneStatusBar.showKeyguard(); + updateBackButtonState(); } public void onScreenTurnedOff() { @@ -165,4 +167,28 @@ public class StatusBarKeyguardViewManager { public boolean isShowing() { return mShowing; } + + /** + * Notifies this manager that the back button has been pressed. + * + * @return whether the back press has been handled + */ + public boolean onBackPressed() { + if (mBouncer.isShowing()) { + mBouncer.hide(); + mPhoneStatusBar.showKeyguard(); + updateBackButtonState(); + return true; + } + return false; + } + + private void updateBackButtonState() { + int vis = mContainer.getSystemUiVisibility(); + if (mBouncer.isShowing()) { + mContainer.setSystemUiVisibility(vis & ~View.STATUS_BAR_DISABLE_BACK); + } else { + mContainer.setSystemUiVisibility(vis | View.STATUS_BAR_DISABLE_BACK); + } + } } 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 ea3f899..dd89f47 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -79,7 +79,7 @@ public class StatusBarWindowView extends FrameLayout switch (event.getKeyCode()) { case KeyEvent.KEYCODE_BACK: if (!down) { - mService.animateCollapsePanels(); + mService.onBackPressed(); } return true; } |