Merge "Show back button in status bar when in an activity in front of the lockscreen."
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index e6c0b96..98dca92 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -70,6 +70,14 @@
return mCurrentView.findViewById(R.id.menu);
}
+ public View getBackButton() {
+ return mCurrentView.findViewById(R.id.back);
+ }
+
+ public View getHomeButton() {
+ return mCurrentView.findViewById(R.id.home);
+ }
+
public NavigationBarView(Context context, AttributeSet attrs) {
super(context, attrs);
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 7868626..4ba514a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1091,18 +1091,9 @@
}
}
- if ((diff & StatusBarManager.DISABLE_NAVIGATION) != 0) {
- if ((state & StatusBarManager.DISABLE_NAVIGATION) != 0) {
- Slog.d(TAG, "DISABLE_NAVIGATION: yes");
-
- // close recents if it's visible
- mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL);
- mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);
- }
-
- if (mNavigationBarView != null) {
- mNavigationBarView.setEnabled((state & StatusBarManager.DISABLE_NAVIGATION) == 0);
- }
+ if ((diff & (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK)) != 0) {
+ setNavigationVisibility(state &
+ (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK));
}
if ((diff & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
@@ -1127,6 +1118,30 @@
}
}
+ private void setNavigationVisibility(int visibility) {
+ boolean disableNavigation = ((visibility & StatusBarManager.DISABLE_NAVIGATION) != 0);
+ boolean disableBack = ((visibility & StatusBarManager.DISABLE_BACK) != 0);
+
+ Slog.i(TAG, "DISABLE_BACK: " + (disableBack ? "yes" : "no"));
+ Slog.i(TAG, "DISABLE_NAVIGATION: " + (disableNavigation ? "yes" : "no"));
+
+ if (disableNavigation && disableBack) {
+ mNavigationBarView.setEnabled(false);
+ } else {
+ mNavigationBarView.getBackButton().setEnabled(!disableBack);
+ mNavigationBarView.getHomeButton().setEnabled(!disableNavigation);
+ mNavigationBarView.getRecentsButton().setEnabled(!disableNavigation);
+
+ if (disableNavigation) {
+ // close recents if it's visible
+ mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL);
+ mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);
+ }
+
+ mNavigationBarView.setEnabled(true);
+ }
+ }
+
/**
* All changes to the status bar and notifications funnel through here and are batched.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 2ab667d..00f611f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -949,29 +949,34 @@
mTicker.halt();
}
}
- if ((diff & StatusBarManager.DISABLE_NAVIGATION) != 0) {
- if ((state & StatusBarManager.DISABLE_NAVIGATION) != 0) {
- Slog.i(TAG, "DISABLE_NAVIGATION: yes");
- mNavigationArea.setVisibility(View.INVISIBLE);
- mInputMethodSwitchButton.setScreenLocked(true);
- } else {
- Slog.i(TAG, "DISABLE_NAVIGATION: no");
- mNavigationArea.setVisibility(View.VISIBLE);
- mInputMethodSwitchButton.setScreenLocked(false);
- }
+ if ((diff & (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK)) != 0) {
+ setNavigationVisibility(state &
+ (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK));
}
- if ((diff & StatusBarManager.DISABLE_BACK) != 0) {
- if ((state & StatusBarManager.DISABLE_BACK) != 0) {
- Slog.i(TAG, "DISABLE_BACK: yes");
- mBackButton.setEnabled(false);
- mInputMethodSwitchButton.setScreenLocked(true);
- } else {
- Slog.i(TAG, "DISABLE_BACK: no");
- mBackButton.setEnabled(true);
- mInputMethodSwitchButton.setScreenLocked(false);
- }
+ }
+
+ private void setNavigationVisibility(int visibility) {
+ boolean disableNavigation = ((visibility & StatusBarManager.DISABLE_NAVIGATION) != 0);
+ boolean disableBack = ((visibility & StatusBarManager.DISABLE_BACK) != 0);
+
+ Slog.i(TAG, "DISABLE_BACK: " + (disableBack ? "yes" : "no"));
+ Slog.i(TAG, "DISABLE_NAVIGATION: " + (disableNavigation ? "yes" : "no"));
+
+ if (disableNavigation && disableBack) {
+ mNavigationArea.setVisibility(View.INVISIBLE);
+ } else {
+ int backVisiblity = (disableBack ? View.INVISIBLE : View.VISIBLE);
+ int navVisibility = (disableNavigation ? View.INVISIBLE : View.VISIBLE);
+
+ mBackButton.setVisibility(backVisiblity);
+ mHomeButton.setVisibility(navVisibility);
+ mRecentButton.setVisibility(navVisibility);
+ // don't change menu button visibility here
+
+ mNavigationArea.setVisibility(View.VISIBLE);
}
+ mInputMethodSwitchButton.setScreenLocked(disableNavigation);
}
private boolean hasTicker(Notification n) {
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index 162381d..a544167 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -1185,15 +1185,19 @@
}
int flags = StatusBarManager.DISABLE_NONE;
- if (mShowing && !mHidden) {
- // showing lockscreen exclusively; disable various extra
- // statusbar components.
+ if (mShowing) {
+ // disable navigation status bar components if lock screen is up
flags |= StatusBarManager.DISABLE_NAVIGATION;
- flags |= StatusBarManager.DISABLE_CLOCK;
- }
- if (mShowing && (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND)) {
- // showing secure lockscreen; disable expanding.
- flags |= StatusBarManager.DISABLE_EXPAND;
+ if (!mHidden) {
+ // showing lockscreen exclusively (no activities in front of it)
+ // disable clock and back button too
+ flags |= StatusBarManager.DISABLE_BACK;
+ flags |= StatusBarManager.DISABLE_CLOCK;
+ }
+ if (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND) {
+ // showing secure lockscreen; disable expanding.
+ flags |= StatusBarManager.DISABLE_EXPAND;
+ }
}
if (DEBUG) {