Break apart DISABLE_HOME and DISABLE_RECENT.
Additionally, start using setSystemUiVisibility() where possible in the keyguard to allow activities and dialogs to re-enable some of the navigation keys (notably: home but not recents). Finally, stop disabling MENU for activities atop the keyguard. Bug: 5380495 // no home in driveabout, clock Bug: 5396134 // able to show home/recent in keyguard Change-Id: I04eb224554ee8cff79476b85148c4cda75bb0b62
This commit is contained in:
@ -40,15 +40,20 @@ public class StatusBarManager {
|
||||
public static final int DISABLE_NOTIFICATION_TICKER
|
||||
= View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER;
|
||||
public static final int DISABLE_SYSTEM_INFO = View.STATUS_BAR_DISABLE_SYSTEM_INFO;
|
||||
public static final int DISABLE_NAVIGATION = View.STATUS_BAR_DISABLE_NAVIGATION;
|
||||
public static final int DISABLE_HOME = View.STATUS_BAR_DISABLE_HOME;
|
||||
public static final int DISABLE_RECENT = View.STATUS_BAR_DISABLE_RECENT;
|
||||
public static final int DISABLE_BACK = View.STATUS_BAR_DISABLE_BACK;
|
||||
public static final int DISABLE_CLOCK = View.STATUS_BAR_DISABLE_CLOCK;
|
||||
|
||||
@Deprecated
|
||||
public static final int DISABLE_NAVIGATION =
|
||||
View.STATUS_BAR_DISABLE_HOME | View.STATUS_BAR_DISABLE_RECENT;
|
||||
|
||||
public static final int DISABLE_NONE = 0x00000000;
|
||||
|
||||
public static final int DISABLE_MASK = DISABLE_EXPAND | DISABLE_NOTIFICATION_ICONS
|
||||
| DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER
|
||||
| DISABLE_SYSTEM_INFO| DISABLE_NAVIGATION | DISABLE_BACK | DISABLE_CLOCK;
|
||||
| DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK;
|
||||
|
||||
private Context mContext;
|
||||
private IStatusBarService mService;
|
||||
|
@ -1891,12 +1891,10 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
|
||||
* NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
|
||||
* out of the public fields to keep the undefined bits out of the developer's way.
|
||||
*
|
||||
* Flag to hide only the navigation buttons. Don't use this
|
||||
* Flag to hide only the home button. Don't use this
|
||||
* unless you're a special part of the system UI (i.e., setup wizard, keyguard).
|
||||
*
|
||||
* THIS DOES NOT DISABLE THE BACK BUTTON
|
||||
*/
|
||||
public static final int STATUS_BAR_DISABLE_NAVIGATION = 0x00200000;
|
||||
public static final int STATUS_BAR_DISABLE_HOME = 0x00200000;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
@ -1920,6 +1918,28 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
|
||||
*/
|
||||
public static final int STATUS_BAR_DISABLE_CLOCK = 0x00800000;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*
|
||||
* NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
|
||||
* out of the public fields to keep the undefined bits out of the developer's way.
|
||||
*
|
||||
* Flag to hide only the recent apps button. Don't use this
|
||||
* unless you're a special part of the system UI (i.e., setup wizard, keyguard).
|
||||
*/
|
||||
public static final int STATUS_BAR_DISABLE_RECENT = 0x01000000;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*
|
||||
* NOTE: This flag may only be used in subtreeSystemUiVisibility, etc. etc.
|
||||
*
|
||||
* This hides HOME and RECENT and is provided for compatibility with interim implementations.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final int STATUS_BAR_DISABLE_NAVIGATION =
|
||||
STATUS_BAR_DISABLE_HOME | STATUS_BAR_DISABLE_RECENT;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
|
@ -116,15 +116,13 @@ public class NavigationBarView extends LinearLayout {
|
||||
|
||||
mDisabledFlags = disabledFlags;
|
||||
|
||||
final boolean disableNavigation = ((disabledFlags & View.STATUS_BAR_DISABLE_NAVIGATION) != 0);
|
||||
final boolean disableHome = ((disabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0);
|
||||
final boolean disableRecent = ((disabledFlags & View.STATUS_BAR_DISABLE_RECENT) != 0);
|
||||
final boolean disableBack = ((disabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0);
|
||||
|
||||
getBackButton() .setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
|
||||
getHomeButton() .setVisibility(disableNavigation ? View.INVISIBLE : View.VISIBLE);
|
||||
getRecentsButton().setVisibility(disableNavigation ? View.INVISIBLE : View.VISIBLE);
|
||||
|
||||
getMenuButton() .setVisibility((disableNavigation || !mShowMenu)
|
||||
? View.INVISIBLE : View.VISIBLE);
|
||||
getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
|
||||
getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
|
||||
}
|
||||
|
||||
public void setMenuVisibility(final boolean show) {
|
||||
@ -136,9 +134,7 @@ public class NavigationBarView extends LinearLayout {
|
||||
|
||||
mShowMenu = show;
|
||||
|
||||
getMenuButton().setVisibility(
|
||||
(0 != (mDisabledFlags & View.STATUS_BAR_DISABLE_NAVIGATION) || !mShowMenu)
|
||||
? View.INVISIBLE : View.VISIBLE);
|
||||
getMenuButton().setVisibility(mShowMenu ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
|
||||
public void setLowProfile(final boolean lightsOut) {
|
||||
|
@ -300,18 +300,6 @@ public class PhoneStatusBar extends StatusBar {
|
||||
(NavigationBarView) View.inflate(context, R.layout.navigation_bar, null);
|
||||
|
||||
mNavigationBarView.setDisabledFlags(mDisabled);
|
||||
|
||||
sb.setOnSystemUiVisibilityChangeListener(
|
||||
new View.OnSystemUiVisibilityChangeListener() {
|
||||
@Override
|
||||
public void onSystemUiVisibilityChange(int visibility) {
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "systemUi: " + visibility);
|
||||
}
|
||||
boolean hide = (0 != (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION));
|
||||
mNavigationBarView.setHidden(hide);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Resources.NotFoundException ex) {
|
||||
// no nav bar for you
|
||||
@ -1064,10 +1052,12 @@ public class PhoneStatusBar extends StatusBar {
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) ? "SYSTEM_INFO" : "system_info");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_NAVIGATION) != 0) ? "NAVIGATION" : "navigation");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_NAVIGATION) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_BACK) != 0) ? "BACK" : "back");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_BACK) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_HOME) != 0) ? "HOME" : "home");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_HOME) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_RECENT) != 0) ? "RECENT" : "recent");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_RECENT) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_CLOCK) != 0) ? "CLOCK" : "clock");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_CLOCK) != 0) ? "* " : " ");
|
||||
flagdbg.append(">");
|
||||
@ -1083,11 +1073,13 @@ public class PhoneStatusBar extends StatusBar {
|
||||
}
|
||||
}
|
||||
|
||||
if ((diff & (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK)) != 0) {
|
||||
// the nav bar will take care of DISABLE_NAVIGATION and DISABLE_BACK
|
||||
if ((diff & (StatusBarManager.DISABLE_HOME
|
||||
| StatusBarManager.DISABLE_RECENT
|
||||
| StatusBarManager.DISABLE_BACK)) != 0) {
|
||||
// the nav bar will take care of these
|
||||
if (mNavigationBarView != null) mNavigationBarView.setDisabledFlags(state);
|
||||
|
||||
if ((state & StatusBarManager.DISABLE_NAVIGATION) != 0) {
|
||||
if ((state & StatusBarManager.DISABLE_RECENT) != 0) {
|
||||
// close recents if it's visible
|
||||
mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL);
|
||||
mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);
|
||||
|
@ -964,34 +964,24 @@ public class TabletStatusBar extends StatusBar implements
|
||||
mTicker.halt();
|
||||
}
|
||||
}
|
||||
if ((diff & (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK)) != 0) {
|
||||
setNavigationVisibility(state &
|
||||
(StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK));
|
||||
if ((diff & (StatusBarManager.DISABLE_RECENT
|
||||
| StatusBarManager.DISABLE_BACK
|
||||
| StatusBarManager.DISABLE_HOME)) != 0) {
|
||||
setNavigationVisibility(state);
|
||||
}
|
||||
}
|
||||
|
||||
private void setNavigationVisibility(int visibility) {
|
||||
boolean disableNavigation = ((visibility & StatusBarManager.DISABLE_NAVIGATION) != 0);
|
||||
boolean disableHome = ((visibility & StatusBarManager.DISABLE_HOME) != 0);
|
||||
boolean disableRecent = ((visibility & StatusBarManager.DISABLE_RECENT) != 0);
|
||||
boolean disableBack = ((visibility & StatusBarManager.DISABLE_BACK) != 0);
|
||||
|
||||
Slog.i(TAG, "DISABLE_BACK: " + (disableBack ? "yes" : "no"));
|
||||
Slog.i(TAG, "DISABLE_NAVIGATION: " + (disableNavigation ? "yes" : "no"));
|
||||
mBackButton.setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
|
||||
mHomeButton.setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
|
||||
mRecentButton.setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
|
||||
|
||||
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);
|
||||
mInputMethodSwitchButton.setScreenLocked(
|
||||
(visibility & StatusBarManager.DISABLE_SYSTEM_INFO) != 0);
|
||||
}
|
||||
|
||||
private boolean hasTicker(Notification n) {
|
||||
|
@ -50,8 +50,6 @@ public abstract class KeyguardViewBase extends FrameLayout {
|
||||
public KeyguardViewBase(Context context) {
|
||||
super(context);
|
||||
|
||||
setSystemUiVisibility(STATUS_BAR_DISABLE_BACK);
|
||||
|
||||
// This is a faster way to draw the background on devices without hardware acceleration
|
||||
setBackgroundDrawable(new Drawable() {
|
||||
@Override
|
||||
|
@ -171,6 +171,17 @@ public class KeyguardViewManager implements KeyguardWindowController {
|
||||
}
|
||||
}
|
||||
|
||||
// Disable aspects of the system/status/navigation bars that are not appropriate or
|
||||
// useful for the lockscreen but can be re-shown by dialogs or SHOW_WHEN_LOCKED activities.
|
||||
// Other disabled bits are handled by the KeyguardViewMediator talking directly to the
|
||||
// status bar service.
|
||||
int visFlags =
|
||||
( View.STATUS_BAR_DISABLE_BACK
|
||||
| View.STATUS_BAR_DISABLE_HOME
|
||||
| View.STATUS_BAR_DISABLE_CLOCK
|
||||
);
|
||||
mKeyguardHost.setSystemUiVisibility(visFlags);
|
||||
|
||||
mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
|
||||
mKeyguardHost.setVisibility(View.VISIBLE);
|
||||
mKeyguardView.requestFocus();
|
||||
|
@ -1188,19 +1188,12 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
|
||||
}
|
||||
}
|
||||
|
||||
// Disable aspects of the system/status/navigation bars that must not be re-enabled by
|
||||
// windows that appear on top, ever
|
||||
int flags = StatusBarManager.DISABLE_NONE;
|
||||
if (mShowing) {
|
||||
// disable navigation status bar components if lock screen is up
|
||||
flags |= StatusBarManager.DISABLE_NAVIGATION;
|
||||
if (!mHidden) {
|
||||
// showing lockscreen exclusively (no activities in front of it)
|
||||
// disable back button too
|
||||
flags |= StatusBarManager.DISABLE_BACK;
|
||||
if (mUpdateMonitor.isClockVisible()) {
|
||||
// lockscreen showing a clock, so hide statusbar clock
|
||||
flags |= StatusBarManager.DISABLE_CLOCK;
|
||||
}
|
||||
}
|
||||
// disable navigation status bar components (home, recents) if lock screen is up
|
||||
flags |= StatusBarManager.DISABLE_RECENT;
|
||||
if (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND) {
|
||||
// showing secure lockscreen; disable expanding.
|
||||
flags |= StatusBarManager.DISABLE_EXPAND;
|
||||
|
@ -114,9 +114,9 @@ public class StatusBarTest extends TestActivity
|
||||
// v.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
// }
|
||||
// },
|
||||
new Test("systemUiVisibility: STATUS_BAR_DISABLE_NAVIGATION") {
|
||||
new Test("systemUiVisibility: STATUS_BAR_DISABLE_HOME") {
|
||||
public void run() {
|
||||
mListView.setSystemUiVisibility(View.STATUS_BAR_DISABLE_NAVIGATION);
|
||||
mListView.setSystemUiVisibility(View.STATUS_BAR_DISABLE_HOME);
|
||||
}
|
||||
},
|
||||
new Test("Double Remove") {
|
||||
@ -227,16 +227,21 @@ public class StatusBarTest extends TestActivity
|
||||
}, 3000);
|
||||
}
|
||||
},
|
||||
new Test("Disable Navigation") {
|
||||
new Test("Disable Home (StatusBarManager)") {
|
||||
public void run() {
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_NAVIGATION);
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_HOME);
|
||||
}
|
||||
},
|
||||
new Test("Disable Back") {
|
||||
new Test("Disable Back (StatusBarManager)") {
|
||||
public void run() {
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_BACK);
|
||||
}
|
||||
},
|
||||
new Test("Disable Recent (StatusBarManager)") {
|
||||
public void run() {
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_RECENT);
|
||||
}
|
||||
},
|
||||
new Test("Disable Clock") {
|
||||
public void run() {
|
||||
mStatusBarManager.disable(StatusBarManager.DISABLE_CLOCK);
|
||||
|
Reference in New Issue
Block a user