Fix disappearing BACK button.
We weren't properly applying the disabled flags from one orientation to the other. This crops up when the lockscreen changes the flags and forces a reorientation at the same time; the other orientation can become stale. Bug: 5312123 Change-Id: I7cbb7bbf69e6d86cb47450bcdfa692a1f766cd5e
This commit is contained in:
@@ -42,7 +42,7 @@ import com.android.systemui.R;
|
||||
|
||||
public class NavigationBarView extends LinearLayout {
|
||||
final static boolean DEBUG = false;
|
||||
final static String TAG = "NavigationBarView";
|
||||
final static String TAG = "PhoneStatusBar/NavigationBarView";
|
||||
|
||||
final static boolean DEBUG_DEADZONE = false;
|
||||
|
||||
@@ -60,6 +60,7 @@ public class NavigationBarView extends LinearLayout {
|
||||
boolean mVertical;
|
||||
|
||||
boolean mHidden, mLowProfile;
|
||||
int mDisabledFlags = 0;
|
||||
|
||||
public View getRecentsButton() {
|
||||
return mCurrentView.findViewById(R.id.recent_apps);
|
||||
@@ -99,7 +100,7 @@ public class NavigationBarView extends LinearLayout {
|
||||
// even though setting the systemUI visibility below will turn these views
|
||||
// on, we need them to come up faster so that they can catch this motion
|
||||
// event
|
||||
setLowProfile(false, false);
|
||||
setLowProfile(false, false, false);
|
||||
|
||||
try {
|
||||
mBarService.setSystemUiVisibility(0);
|
||||
@@ -110,9 +111,18 @@ public class NavigationBarView extends LinearLayout {
|
||||
}
|
||||
};
|
||||
|
||||
public void setNavigationVisibility(int disabledFlags) {
|
||||
boolean disableNavigation = ((disabledFlags & View.STATUS_BAR_DISABLE_NAVIGATION) != 0);
|
||||
boolean disableBack = ((disabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0);
|
||||
public void setDisabledFlags(int disabledFlags) {
|
||||
Slog.d(TAG, "setDisabledFlags: " + disabledFlags);
|
||||
setDisabledFlags(disabledFlags, false);
|
||||
}
|
||||
|
||||
public void setDisabledFlags(int disabledFlags, boolean force) {
|
||||
if (!force && mDisabledFlags == disabledFlags) return;
|
||||
|
||||
mDisabledFlags = disabledFlags;
|
||||
|
||||
final boolean disableNavigation = ((disabledFlags & View.STATUS_BAR_DISABLE_NAVIGATION) != 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);
|
||||
@@ -121,11 +131,11 @@ public class NavigationBarView extends LinearLayout {
|
||||
}
|
||||
|
||||
public void setLowProfile(final boolean lightsOut) {
|
||||
setLowProfile(lightsOut, true);
|
||||
setLowProfile(lightsOut, true, false);
|
||||
}
|
||||
|
||||
public void setLowProfile(final boolean lightsOut, final boolean animate) {
|
||||
if (lightsOut == mLowProfile) return;
|
||||
public void setLowProfile(final boolean lightsOut, final boolean animate, final boolean force) {
|
||||
if (!force && lightsOut == mLowProfile) return;
|
||||
|
||||
mLowProfile = lightsOut;
|
||||
|
||||
@@ -245,6 +255,10 @@ public class NavigationBarView extends LinearLayout {
|
||||
mCurrentView.setVisibility(View.VISIBLE);
|
||||
mVertical = (rot == Surface.ROTATION_90 || rot == Surface.ROTATION_270);
|
||||
|
||||
// force the low profile & disabled states into compliance
|
||||
setLowProfile(mLowProfile, false, true /* force */);
|
||||
setDisabledFlags(mDisabledFlags, true /* force */);
|
||||
|
||||
if (DEBUG_DEADZONE) {
|
||||
mCurrentView.findViewById(R.id.deadzone).setBackgroundColor(0x808080FF);
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ public class PhoneStatusBar extends StatusBar {
|
||||
mNavigationBarView =
|
||||
(NavigationBarView) View.inflate(context, R.layout.navigation_bar, null);
|
||||
|
||||
setNavigationVisibility(mDisabled);
|
||||
mNavigationBarView.setDisabledFlags(mDisabled);
|
||||
|
||||
sb.setOnSystemUiVisibilityChangeListener(
|
||||
new View.OnSystemUiVisibilityChangeListener() {
|
||||
@@ -1083,62 +1083,67 @@ public class PhoneStatusBar extends StatusBar {
|
||||
old, state, diff));
|
||||
}
|
||||
|
||||
StringBuilder flagdbg = new StringBuilder();
|
||||
flagdbg.append("disable: < ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_EXPAND) != 0) ? "EXPAND" : "expand");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_EXPAND) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) ? "ICONS" : "icons");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0) ? "ALERTS" : "alerts");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) ? "TICKER" : "ticker");
|
||||
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_CLOCK) != 0) ? "CLOCK" : "clock");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_CLOCK) != 0) ? "* " : " ");
|
||||
flagdbg.append(">");
|
||||
Slog.d(TAG, flagdbg.toString());
|
||||
|
||||
if ((diff & StatusBarManager.DISABLE_CLOCK) != 0) {
|
||||
boolean show = (state & StatusBarManager.DISABLE_CLOCK) == 0;
|
||||
showClock(show);
|
||||
}
|
||||
if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) {
|
||||
if ((state & StatusBarManager.DISABLE_EXPAND) != 0) {
|
||||
Slog.d(TAG, "DISABLE_EXPAND: yes");
|
||||
animateCollapse();
|
||||
}
|
||||
}
|
||||
|
||||
if ((diff & (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK)) != 0) {
|
||||
setNavigationVisibility(state &
|
||||
(StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK));
|
||||
// the nav bar will take care of DISABLE_NAVIGATION and DISABLE_BACK
|
||||
mNavigationBarView.setDisabledFlags(state);
|
||||
|
||||
if ((state & StatusBarManager.DISABLE_NAVIGATION) != 0) {
|
||||
// close recents if it's visible
|
||||
mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL);
|
||||
mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);
|
||||
}
|
||||
}
|
||||
|
||||
if ((diff & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
|
||||
if ((state & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
|
||||
Slog.d(TAG, "DISABLE_NOTIFICATION_ICONS: yes");
|
||||
if (mTicking) {
|
||||
mTicker.halt();
|
||||
} else {
|
||||
setNotificationIconVisibility(false, com.android.internal.R.anim.fade_out);
|
||||
}
|
||||
} else {
|
||||
Slog.d(TAG, "DISABLE_NOTIFICATION_ICONS: no");
|
||||
if (!mExpandedVisible) {
|
||||
setNotificationIconVisibility(true, com.android.internal.R.anim.fade_in);
|
||||
}
|
||||
}
|
||||
} else if ((diff & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) {
|
||||
if (mTicking && (state & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) {
|
||||
Slog.d(TAG, "DISABLE_NOTIFICATION_TICKER: yes");
|
||||
mTicker.halt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 (mNavigationBarView != null) {
|
||||
mNavigationBarView.setNavigationVisibility(visibility);
|
||||
}
|
||||
|
||||
if (disableNavigation) {
|
||||
// close recents if it's visible
|
||||
mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL);
|
||||
mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* All changes to the status bar and notifications funnel through here and are batched.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user