Skip to content

Commit 8385adc

Browse files
John SpurlockAndroid (Google) Code Review
authored andcommitted
Merge "NavBar: Slippery on the unsecured lock screen." into jb-dev
2 parents bfd125a + d5ef546 commit 8385adc

File tree

2 files changed

+29
-18
lines changed

2 files changed

+29
-18
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,28 @@ public void setDisabledFlags(int disabledFlags, boolean force) {
225225
final boolean disableRecent = ((disabledFlags & View.STATUS_BAR_DISABLE_RECENT) != 0);
226226
final boolean disableBack = ((disabledFlags & View.STATUS_BAR_DISABLE_BACK) != 0);
227227

228+
setSlippery(disableHome && disableRecent && disableBack);
229+
228230
getBackButton() .setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
229231
getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
230232
getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
231233
}
232234

235+
public void setSlippery(boolean newSlippery) {
236+
WindowManager.LayoutParams lp = (WindowManager.LayoutParams) getLayoutParams();
237+
if (lp != null) {
238+
boolean oldSlippery = (lp.flags & WindowManager.LayoutParams.FLAG_SLIPPERY) != 0;
239+
if (!oldSlippery && newSlippery) {
240+
lp.flags |= WindowManager.LayoutParams.FLAG_SLIPPERY;
241+
} else if (oldSlippery && !newSlippery) {
242+
lp.flags &= ~WindowManager.LayoutParams.FLAG_SLIPPERY;
243+
} else {
244+
return;
245+
}
246+
WindowManagerImpl.getDefault().updateViewLayout(this, lp);
247+
}
248+
}
249+
233250
public void setMenuVisibility(final boolean show) {
234251
setMenuVisibility(show, false);
235252
}

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

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ public boolean onTouch(View v, MotionEvent event) {
379379
mIntruderAlertView.setBar(this);
380380
}
381381

382+
updateShowSearchHoldoff();
383+
382384
mStatusBarView.mService = this;
383385

384386
mChoreographer = Choreographer.getInstance();
@@ -666,7 +668,6 @@ private WindowManager.LayoutParams getNavigationBarLayoutParams() {
666668

667669
lp.setTitle("NavigationBar");
668670
lp.windowAnimations = 0;
669-
670671
return lp;
671672
}
672673

@@ -811,8 +812,12 @@ public void removeNotification(IBinder key) {
811812
@Override
812813
protected void onConfigurationChanged(Configuration newConfig) {
813814
updateRecentsPanel();
814-
mShowSearchHoldoff = mContext.getResources().getInteger(
815-
R.integer.config_show_search_delay);
815+
updateShowSearchHoldoff();
816+
}
817+
818+
private void updateShowSearchHoldoff() {
819+
mShowSearchHoldoff = mContext.getResources().getInteger(
820+
R.integer.config_show_search_delay);
816821
}
817822

818823
private void loadNotificationShade() {
@@ -1177,7 +1182,8 @@ private void makeExpandedVisible(boolean revealAfterDraw) {
11771182

11781183
mExpandedVisible = true;
11791184
mPile.setLayoutTransitionsEnabled(true);
1180-
makeSlippery(mNavigationBarView, true);
1185+
if (mNavigationBarView != null)
1186+
mNavigationBarView.setSlippery(true);
11811187

11821188
updateCarrierLabelVisibility(true);
11831189

@@ -1201,19 +1207,6 @@ private void makeExpandedVisible(boolean revealAfterDraw) {
12011207
visibilityChanged(true);
12021208
}
12031209

1204-
private static void makeSlippery(View view, boolean slippery) {
1205-
if (view == null) {
1206-
return;
1207-
}
1208-
WindowManager.LayoutParams lp = (WindowManager.LayoutParams) view.getLayoutParams();
1209-
if (slippery) {
1210-
lp.flags |= WindowManager.LayoutParams.FLAG_SLIPPERY;
1211-
} else {
1212-
lp.flags &= ~WindowManager.LayoutParams.FLAG_SLIPPERY;
1213-
}
1214-
WindowManagerImpl.getDefault().updateViewLayout(view, lp);
1215-
}
1216-
12171210
public void animateExpand() {
12181211
if (SPEW) Slog.d(TAG, "Animate expand: expanded=" + mExpanded);
12191212
if ((mDisabled & StatusBarManager.DISABLE_EXPAND) != 0) {
@@ -1298,8 +1291,9 @@ void performCollapse() {
12981291
}
12991292
mExpandedVisible = false;
13001293
mPile.setLayoutTransitionsEnabled(false);
1294+
if (mNavigationBarView != null)
1295+
mNavigationBarView.setSlippery(false);
13011296
visibilityChanged(false);
1302-
makeSlippery(mNavigationBarView, false);
13031297

13041298
// Shrink the window to the size of the status bar only
13051299
WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mStatusBarWindow.getLayoutParams();

0 commit comments

Comments
 (0)