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);
|
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) {
|
public NavigationBarView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
|
|||||||
@@ -1091,18 +1091,9 @@ public class PhoneStatusBar extends StatusBar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((diff & StatusBarManager.DISABLE_NAVIGATION) != 0) {
|
if ((diff & (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK)) != 0) {
|
||||||
if ((state & StatusBarManager.DISABLE_NAVIGATION) != 0) {
|
setNavigationVisibility(state &
|
||||||
Slog.d(TAG, "DISABLE_NAVIGATION: yes");
|
(StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK));
|
||||||
|
|
||||||
// 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_NOTIFICATION_ICONS) != 0) {
|
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.
|
* 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();
|
mTicker.halt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((diff & StatusBarManager.DISABLE_NAVIGATION) != 0) {
|
if ((diff & (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK)) != 0) {
|
||||||
if ((state & StatusBarManager.DISABLE_NAVIGATION) != 0) {
|
setNavigationVisibility(state &
|
||||||
Slog.i(TAG, "DISABLE_NAVIGATION: yes");
|
(StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK));
|
||||||
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_BACK) != 0) {
|
}
|
||||||
if ((state & StatusBarManager.DISABLE_BACK) != 0) {
|
|
||||||
Slog.i(TAG, "DISABLE_BACK: yes");
|
private void setNavigationVisibility(int visibility) {
|
||||||
mBackButton.setEnabled(false);
|
boolean disableNavigation = ((visibility & StatusBarManager.DISABLE_NAVIGATION) != 0);
|
||||||
mInputMethodSwitchButton.setScreenLocked(true);
|
boolean disableBack = ((visibility & StatusBarManager.DISABLE_BACK) != 0);
|
||||||
} else {
|
|
||||||
Slog.i(TAG, "DISABLE_BACK: no");
|
Slog.i(TAG, "DISABLE_BACK: " + (disableBack ? "yes" : "no"));
|
||||||
mBackButton.setEnabled(true);
|
Slog.i(TAG, "DISABLE_NAVIGATION: " + (disableNavigation ? "yes" : "no"));
|
||||||
mInputMethodSwitchButton.setScreenLocked(false);
|
|
||||||
}
|
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) {
|
private boolean hasTicker(Notification n) {
|
||||||
|
|||||||
@@ -1185,15 +1185,19 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int flags = StatusBarManager.DISABLE_NONE;
|
int flags = StatusBarManager.DISABLE_NONE;
|
||||||
if (mShowing && !mHidden) {
|
if (mShowing) {
|
||||||
// showing lockscreen exclusively; disable various extra
|
// disable navigation status bar components if lock screen is up
|
||||||
// statusbar components.
|
|
||||||
flags |= StatusBarManager.DISABLE_NAVIGATION;
|
flags |= StatusBarManager.DISABLE_NAVIGATION;
|
||||||
flags |= StatusBarManager.DISABLE_CLOCK;
|
if (!mHidden) {
|
||||||
}
|
// showing lockscreen exclusively (no activities in front of it)
|
||||||
if (mShowing && (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND)) {
|
// disable clock and back button too
|
||||||
// showing secure lockscreen; disable expanding.
|
flags |= StatusBarManager.DISABLE_BACK;
|
||||||
flags |= StatusBarManager.DISABLE_EXPAND;
|
flags |= StatusBarManager.DISABLE_CLOCK;
|
||||||
|
}
|
||||||
|
if (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND) {
|
||||||
|
// showing secure lockscreen; disable expanding.
|
||||||
|
flags |= StatusBarManager.DISABLE_EXPAND;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
|||||||
Reference in New Issue
Block a user