Merge "Show back button in status bar when in an activity in front of the lockscreen."
This commit is contained in:
committed by
Android (Google) Code Review
commit
6c79bcf351
@@ -70,6 +70,14 @@ public class NavigationBarView extends LinearLayout {
|
||||
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);
|
||||
|
||||
|
||||
@@ -1091,18 +1091,9 @@ public class PhoneStatusBar extends StatusBar {
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ public class PhoneStatusBar extends StatusBar {
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -949,29 +949,34 @@ public class TabletStatusBar extends StatusBar implements
|
||||
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) {
|
||||
|
||||
@@ -1185,15 +1185,19 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user