Skip to content

Commit dba9356

Browse files
committed
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
1 parent 2984971 commit dba9356

File tree

9 files changed

+82
-72
lines changed

9 files changed

+82
-72
lines changed

core/java/android/app/StatusBarManager.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,20 @@ public class StatusBarManager {
4040
public static final int DISABLE_NOTIFICATION_TICKER
4141
= View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER;
4242
public static final int DISABLE_SYSTEM_INFO = View.STATUS_BAR_DISABLE_SYSTEM_INFO;
43-
public static final int DISABLE_NAVIGATION = View.STATUS_BAR_DISABLE_NAVIGATION;
43+
public static final int DISABLE_HOME = View.STATUS_BAR_DISABLE_HOME;
44+
public static final int DISABLE_RECENT = View.STATUS_BAR_DISABLE_RECENT;
4445
public static final int DISABLE_BACK = View.STATUS_BAR_DISABLE_BACK;
4546
public static final int DISABLE_CLOCK = View.STATUS_BAR_DISABLE_CLOCK;
4647

48+
@Deprecated
49+
public static final int DISABLE_NAVIGATION =
50+
View.STATUS_BAR_DISABLE_HOME | View.STATUS_BAR_DISABLE_RECENT;
51+
4752
public static final int DISABLE_NONE = 0x00000000;
4853

4954
public static final int DISABLE_MASK = DISABLE_EXPAND | DISABLE_NOTIFICATION_ICONS
5055
| DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER
51-
| DISABLE_SYSTEM_INFO| DISABLE_NAVIGATION | DISABLE_BACK | DISABLE_CLOCK;
56+
| DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK;
5257

5358
private Context mContext;
5459
private IStatusBarService mService;

core/java/android/view/View.java

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,20 +1891,18 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
18911891
* NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
18921892
* out of the public fields to keep the undefined bits out of the developer's way.
18931893
*
1894-
* Flag to hide only the navigation buttons. Don't use this
1894+
* Flag to hide only the home button. Don't use this
18951895
* unless you're a special part of the system UI (i.e., setup wizard, keyguard).
1896-
*
1897-
* THIS DOES NOT DISABLE THE BACK BUTTON
18981896
*/
1899-
public static final int STATUS_BAR_DISABLE_NAVIGATION = 0x00200000;
1897+
public static final int STATUS_BAR_DISABLE_HOME = 0x00200000;
19001898

19011899
/**
19021900
* @hide
19031901
*
19041902
* NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
19051903
* out of the public fields to keep the undefined bits out of the developer's way.
19061904
*
1907-
* Flag to hide only the back button. Don't use this
1905+
* Flag to hide only the back button. Don't use this
19081906
* unless you're a special part of the system UI (i.e., setup wizard, keyguard).
19091907
*/
19101908
public static final int STATUS_BAR_DISABLE_BACK = 0x00400000;
@@ -1920,6 +1918,28 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
19201918
*/
19211919
public static final int STATUS_BAR_DISABLE_CLOCK = 0x00800000;
19221920

1921+
/**
1922+
* @hide
1923+
*
1924+
* NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked
1925+
* out of the public fields to keep the undefined bits out of the developer's way.
1926+
*
1927+
* Flag to hide only the recent apps button. Don't use this
1928+
* unless you're a special part of the system UI (i.e., setup wizard, keyguard).
1929+
*/
1930+
public static final int STATUS_BAR_DISABLE_RECENT = 0x01000000;
1931+
1932+
/**
1933+
* @hide
1934+
*
1935+
* NOTE: This flag may only be used in subtreeSystemUiVisibility, etc. etc.
1936+
*
1937+
* This hides HOME and RECENT and is provided for compatibility with interim implementations.
1938+
*/
1939+
@Deprecated
1940+
public static final int STATUS_BAR_DISABLE_NAVIGATION =
1941+
STATUS_BAR_DISABLE_HOME | STATUS_BAR_DISABLE_RECENT;
1942+
19231943
/**
19241944
* @hide
19251945
*/

packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,13 @@ public void setDisabledFlags(int disabledFlags, boolean force) {
116116

117117
mDisabledFlags = disabledFlags;
118118

119-
final boolean disableNavigation = ((disabledFlags & View.STATUS_BAR_DISABLE_NAVIGATION) != 0);
119+
final boolean disableHome = ((disabledFlags & View.STATUS_BAR_DISABLE_HOME) != 0);
120+
final boolean disableRecent = ((disabledFlags & View.STATUS_BAR_DISABLE_RECENT) != 0);
120121
final boolean disableBack = ((disabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0);
121122

122123
getBackButton() .setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
123-
getHomeButton() .setVisibility(disableNavigation ? View.INVISIBLE : View.VISIBLE);
124-
getRecentsButton().setVisibility(disableNavigation ? View.INVISIBLE : View.VISIBLE);
125-
126-
getMenuButton() .setVisibility((disableNavigation || !mShowMenu)
127-
? View.INVISIBLE : View.VISIBLE);
124+
getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
125+
getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
128126
}
129127

130128
public void setMenuVisibility(final boolean show) {
@@ -136,9 +134,7 @@ public void setMenuVisibility(final boolean show, final boolean force) {
136134

137135
mShowMenu = show;
138136

139-
getMenuButton().setVisibility(
140-
(0 != (mDisabledFlags & View.STATUS_BAR_DISABLE_NAVIGATION) || !mShowMenu)
141-
? View.INVISIBLE : View.VISIBLE);
137+
getMenuButton().setVisibility(mShowMenu ? View.VISIBLE : View.INVISIBLE);
142138
}
143139

144140
public void setLowProfile(final boolean lightsOut) {

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -300,18 +300,6 @@ protected View makeStatusBarView() {
300300
(NavigationBarView) View.inflate(context, R.layout.navigation_bar, null);
301301

302302
mNavigationBarView.setDisabledFlags(mDisabled);
303-
304-
sb.setOnSystemUiVisibilityChangeListener(
305-
new View.OnSystemUiVisibilityChangeListener() {
306-
@Override
307-
public void onSystemUiVisibilityChange(int visibility) {
308-
if (DEBUG) {
309-
Slog.d(TAG, "systemUi: " + visibility);
310-
}
311-
boolean hide = (0 != (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION));
312-
mNavigationBarView.setHidden(hide);
313-
}
314-
});
315303
}
316304
} catch (Resources.NotFoundException ex) {
317305
// no nav bar for you
@@ -1064,10 +1052,12 @@ public void disable(int state) {
10641052
flagdbg.append(((diff & StatusBarManager.DISABLE_NOTIFICATION_TICKER) != 0) ? "* " : " ");
10651053
flagdbg.append(((state & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) ? "SYSTEM_INFO" : "system_info");
10661054
flagdbg.append(((diff & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) ? "* " : " ");
1067-
flagdbg.append(((state & StatusBarManager.DISABLE_NAVIGATION) != 0) ? "NAVIGATION" : "navigation");
1068-
flagdbg.append(((diff & StatusBarManager.DISABLE_NAVIGATION) != 0) ? "* " : " ");
10691055
flagdbg.append(((state & StatusBarManager.DISABLE_BACK) != 0) ? "BACK" : "back");
10701056
flagdbg.append(((diff & StatusBarManager.DISABLE_BACK) != 0) ? "* " : " ");
1057+
flagdbg.append(((state & StatusBarManager.DISABLE_HOME) != 0) ? "HOME" : "home");
1058+
flagdbg.append(((diff & StatusBarManager.DISABLE_HOME) != 0) ? "* " : " ");
1059+
flagdbg.append(((state & StatusBarManager.DISABLE_RECENT) != 0) ? "RECENT" : "recent");
1060+
flagdbg.append(((diff & StatusBarManager.DISABLE_RECENT) != 0) ? "* " : " ");
10711061
flagdbg.append(((state & StatusBarManager.DISABLE_CLOCK) != 0) ? "CLOCK" : "clock");
10721062
flagdbg.append(((diff & StatusBarManager.DISABLE_CLOCK) != 0) ? "* " : " ");
10731063
flagdbg.append(">");
@@ -1083,11 +1073,13 @@ public void disable(int state) {
10831073
}
10841074
}
10851075

1086-
if ((diff & (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK)) != 0) {
1087-
// the nav bar will take care of DISABLE_NAVIGATION and DISABLE_BACK
1076+
if ((diff & (StatusBarManager.DISABLE_HOME
1077+
| StatusBarManager.DISABLE_RECENT
1078+
| StatusBarManager.DISABLE_BACK)) != 0) {
1079+
// the nav bar will take care of these
10881080
if (mNavigationBarView != null) mNavigationBarView.setDisabledFlags(state);
10891081

1090-
if ((state & StatusBarManager.DISABLE_NAVIGATION) != 0) {
1082+
if ((state & StatusBarManager.DISABLE_RECENT) != 0) {
10911083
// close recents if it's visible
10921084
mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL);
10931085
mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);

packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -964,34 +964,24 @@ public void disable(int state) {
964964
mTicker.halt();
965965
}
966966
}
967-
if ((diff & (StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK)) != 0) {
968-
setNavigationVisibility(state &
969-
(StatusBarManager.DISABLE_NAVIGATION | StatusBarManager.DISABLE_BACK));
967+
if ((diff & (StatusBarManager.DISABLE_RECENT
968+
| StatusBarManager.DISABLE_BACK
969+
| StatusBarManager.DISABLE_HOME)) != 0) {
970+
setNavigationVisibility(state);
970971
}
971972
}
972973

973974
private void setNavigationVisibility(int visibility) {
974-
boolean disableNavigation = ((visibility & StatusBarManager.DISABLE_NAVIGATION) != 0);
975+
boolean disableHome = ((visibility & StatusBarManager.DISABLE_HOME) != 0);
976+
boolean disableRecent = ((visibility & StatusBarManager.DISABLE_RECENT) != 0);
975977
boolean disableBack = ((visibility & StatusBarManager.DISABLE_BACK) != 0);
976978

977-
Slog.i(TAG, "DISABLE_BACK: " + (disableBack ? "yes" : "no"));
978-
Slog.i(TAG, "DISABLE_NAVIGATION: " + (disableNavigation ? "yes" : "no"));
979+
mBackButton.setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
980+
mHomeButton.setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
981+
mRecentButton.setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
979982

980-
if (disableNavigation && disableBack) {
981-
mNavigationArea.setVisibility(View.INVISIBLE);
982-
} else {
983-
int backVisiblity = (disableBack ? View.INVISIBLE : View.VISIBLE);
984-
int navVisibility = (disableNavigation ? View.INVISIBLE : View.VISIBLE);
985-
986-
mBackButton.setVisibility(backVisiblity);
987-
mHomeButton.setVisibility(navVisibility);
988-
mRecentButton.setVisibility(navVisibility);
989-
// don't change menu button visibility here
990-
991-
mNavigationArea.setVisibility(View.VISIBLE);
992-
}
993-
994-
mInputMethodSwitchButton.setScreenLocked(disableNavigation);
983+
mInputMethodSwitchButton.setScreenLocked(
984+
(visibility & StatusBarManager.DISABLE_SYSTEM_INFO) != 0);
995985
}
996986

997987
private boolean hasTicker(Notification n) {

policy/src/com/android/internal/policy/impl/KeyguardViewBase.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ public abstract class KeyguardViewBase extends FrameLayout {
5050
public KeyguardViewBase(Context context) {
5151
super(context);
5252

53-
setSystemUiVisibility(STATUS_BAR_DISABLE_BACK);
54-
5553
// This is a faster way to draw the background on devices without hardware acceleration
5654
setBackgroundDrawable(new Drawable() {
5755
@Override

policy/src/com/android/internal/policy/impl/KeyguardViewManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,17 @@ public synchronized void show() {
171171
}
172172
}
173173

174+
// Disable aspects of the system/status/navigation bars that are not appropriate or
175+
// useful for the lockscreen but can be re-shown by dialogs or SHOW_WHEN_LOCKED activities.
176+
// Other disabled bits are handled by the KeyguardViewMediator talking directly to the
177+
// status bar service.
178+
int visFlags =
179+
( View.STATUS_BAR_DISABLE_BACK
180+
| View.STATUS_BAR_DISABLE_HOME
181+
| View.STATUS_BAR_DISABLE_CLOCK
182+
);
183+
mKeyguardHost.setSystemUiVisibility(visFlags);
184+
174185
mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
175186
mKeyguardHost.setVisibility(View.VISIBLE);
176187
mKeyguardView.requestFocus();

policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,19 +1188,12 @@ private void adjustStatusBarLocked() {
11881188
}
11891189
}
11901190

1191+
// Disable aspects of the system/status/navigation bars that must not be re-enabled by
1192+
// windows that appear on top, ever
11911193
int flags = StatusBarManager.DISABLE_NONE;
11921194
if (mShowing) {
1193-
// disable navigation status bar components if lock screen is up
1194-
flags |= StatusBarManager.DISABLE_NAVIGATION;
1195-
if (!mHidden) {
1196-
// showing lockscreen exclusively (no activities in front of it)
1197-
// disable back button too
1198-
flags |= StatusBarManager.DISABLE_BACK;
1199-
if (mUpdateMonitor.isClockVisible()) {
1200-
// lockscreen showing a clock, so hide statusbar clock
1201-
flags |= StatusBarManager.DISABLE_CLOCK;
1202-
}
1203-
}
1195+
// disable navigation status bar components (home, recents) if lock screen is up
1196+
flags |= StatusBarManager.DISABLE_RECENT;
12041197
if (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND) {
12051198
// showing secure lockscreen; disable expanding.
12061199
flags |= StatusBarManager.DISABLE_EXPAND;

tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ public void run() {
114114
// v.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
115115
// }
116116
// },
117-
new Test("systemUiVisibility: STATUS_BAR_DISABLE_NAVIGATION") {
117+
new Test("systemUiVisibility: STATUS_BAR_DISABLE_HOME") {
118118
public void run() {
119-
mListView.setSystemUiVisibility(View.STATUS_BAR_DISABLE_NAVIGATION);
119+
mListView.setSystemUiVisibility(View.STATUS_BAR_DISABLE_HOME);
120120
}
121121
},
122122
new Test("Double Remove") {
@@ -227,16 +227,21 @@ public void run() {
227227
}, 3000);
228228
}
229229
},
230-
new Test("Disable Navigation") {
230+
new Test("Disable Home (StatusBarManager)") {
231231
public void run() {
232-
mStatusBarManager.disable(StatusBarManager.DISABLE_NAVIGATION);
232+
mStatusBarManager.disable(StatusBarManager.DISABLE_HOME);
233233
}
234234
},
235-
new Test("Disable Back") {
235+
new Test("Disable Back (StatusBarManager)") {
236236
public void run() {
237237
mStatusBarManager.disable(StatusBarManager.DISABLE_BACK);
238238
}
239239
},
240+
new Test("Disable Recent (StatusBarManager)") {
241+
public void run() {
242+
mStatusBarManager.disable(StatusBarManager.DISABLE_RECENT);
243+
}
244+
},
240245
new Test("Disable Clock") {
241246
public void run() {
242247
mStatusBarManager.disable(StatusBarManager.DISABLE_CLOCK);

0 commit comments

Comments
 (0)