Skip to content

Commit d99e7fd

Browse files
author
Jim Miller
committed
Fix 6398209: Improve responsiveness of swipe up to search
This fixes an issue where the swipe-up gesture for search was broken on phones and tablets. Because the underlying window was slippery, there was a race condition between the touch moving outside the window and the layout flag change in the search panel being noticed. As a result, the code would sometimes inadvertently dismiss the search panel even though the gesture was successful. It also changes the timing slightly so we show the search panel longer for quick gestures. Change-Id: I30c04b21d3367db4d41c01f23e27edf366711462
1 parent a482f94 commit d99e7fd

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

packages/SystemUI/src/com/android/systemui/SearchPanelView.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public boolean isInContentArea(int x, int y) {
146146
}
147147
}
148148

149-
public void show(boolean show, boolean animate) {
149+
public void show(final boolean show, boolean animate) {
150150
if (animate) {
151151
if (mShowing != show) {
152152
mShowing = show;
@@ -156,21 +156,24 @@ public void show(boolean show, boolean animate) {
156156
mShowing = show;
157157
onAnimationEnd(null);
158158
}
159-
setVisibility(show ? View.VISIBLE : View.GONE);
160-
if (show) {
161-
setFocusable(true);
162-
setFocusableInTouchMode(true);
163-
requestFocus();
164-
}
159+
postDelayed(new Runnable() {
160+
public void run() {
161+
setVisibility(show ? View.VISIBLE : View.INVISIBLE);
162+
if (show) {
163+
setFocusable(true);
164+
setFocusableInTouchMode(true);
165+
requestFocus();
166+
}
167+
}
168+
}, show ? 0 : 100);
165169
}
166170

167171
public void hide(boolean animate) {
168-
if (!animate) {
169-
setVisibility(View.GONE);
170-
}
171172
if (mBar != null) {
172173
// This will indirectly cause show(false, ...) to get called
173174
mBar.animateCollapse();
175+
} else {
176+
setVisibility(View.INVISIBLE);
174177
}
175178
}
176179

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,6 @@ public void showSearchPanel() {
461461
WindowManager.LayoutParams lp =
462462
(android.view.WindowManager.LayoutParams) mNavigationBarView.getLayoutParams();
463463
lp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
464-
lp.flags &= ~WindowManager.LayoutParams.FLAG_SLIPPERY;
465464
WindowManagerImpl.getDefault().updateViewLayout(mNavigationBarView, lp);
466465
}
467466

@@ -471,7 +470,6 @@ public void hideSearchPanel() {
471470
WindowManager.LayoutParams lp =
472471
(android.view.WindowManager.LayoutParams) mNavigationBarView.getLayoutParams();
473472
lp.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
474-
lp.flags |= WindowManager.LayoutParams.FLAG_SLIPPERY;
475473
WindowManagerImpl.getDefault().updateViewLayout(mNavigationBarView, lp);
476474
}
477475

@@ -552,8 +550,7 @@ private WindowManager.LayoutParams getNavigationBarLayoutParams() {
552550
| WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
553551
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
554552
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
555-
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
556-
| WindowManager.LayoutParams.FLAG_SLIPPERY,
553+
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
557554
PixelFormat.OPAQUE);
558555
// this will allow the navbar to run in an overlay on devices that support this
559556
if (ActivityManager.isHighEndGfx(mDisplay)) {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,6 @@ public void showSearchPanel() {
704704
WindowManager.LayoutParams lp =
705705
(android.view.WindowManager.LayoutParams) mStatusBarView.getLayoutParams();
706706
lp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
707-
lp.flags &= ~WindowManager.LayoutParams.FLAG_SLIPPERY;
708707
WindowManagerImpl.getDefault().updateViewLayout(mStatusBarView, lp);
709708
}
710709

@@ -714,7 +713,6 @@ public void hideSearchPanel() {
714713
WindowManager.LayoutParams lp =
715714
(android.view.WindowManager.LayoutParams) mStatusBarView.getLayoutParams();
716715
lp.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
717-
lp.flags |= WindowManager.LayoutParams.FLAG_SLIPPERY;
718716
WindowManagerImpl.getDefault().updateViewLayout(mStatusBarView, lp);
719717
}
720718

0 commit comments

Comments
 (0)