Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d99e7fd9 authored by Jim Miller's avatar Jim Miller
Browse files

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
parent a482f942
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ public class SearchPanelView extends FrameLayout implements
        }
    }

    public void show(boolean show, boolean animate) {
    public void show(final boolean show, boolean animate) {
        if (animate) {
            if (mShowing != show) {
                mShowing = show;
@@ -156,21 +156,24 @@ public class SearchPanelView extends FrameLayout implements
            mShowing = show;
            onAnimationEnd(null);
        }
        setVisibility(show ? View.VISIBLE : View.GONE);
        postDelayed(new Runnable() {
            public void run() {
                setVisibility(show ? View.VISIBLE : View.INVISIBLE);
                if (show) {
                    setFocusable(true);
                    setFocusableInTouchMode(true);
                    requestFocus();
                }
            }
        }, show ? 0 : 100);
    }

    public void hide(boolean animate) {
        if (!animate) {
            setVisibility(View.GONE);
        }
        if (mBar != null) {
            // This will indirectly cause show(false, ...) to get called
            mBar.animateCollapse();
        } else {
            setVisibility(View.INVISIBLE);
        }
    }

+1 −4
Original line number Diff line number Diff line
@@ -461,7 +461,6 @@ public class PhoneStatusBar extends BaseStatusBar {
        WindowManager.LayoutParams lp =
            (android.view.WindowManager.LayoutParams) mNavigationBarView.getLayoutParams();
        lp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
        lp.flags &= ~WindowManager.LayoutParams.FLAG_SLIPPERY;
        WindowManagerImpl.getDefault().updateViewLayout(mNavigationBarView, lp);
    }

@@ -471,7 +470,6 @@ public class PhoneStatusBar extends BaseStatusBar {
        WindowManager.LayoutParams lp =
            (android.view.WindowManager.LayoutParams) mNavigationBarView.getLayoutParams();
        lp.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
        lp.flags |= WindowManager.LayoutParams.FLAG_SLIPPERY;
        WindowManagerImpl.getDefault().updateViewLayout(mNavigationBarView, lp);
    }

@@ -552,8 +550,7 @@ public class PhoneStatusBar extends BaseStatusBar {
                    | WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
                    | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                    | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                    | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
                    | WindowManager.LayoutParams.FLAG_SLIPPERY,
                    | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
                PixelFormat.OPAQUE);
        // this will allow the navbar to run in an overlay on devices that support this
        if (ActivityManager.isHighEndGfx(mDisplay)) {
+0 −2
Original line number Diff line number Diff line
@@ -704,7 +704,6 @@ public class TabletStatusBar extends BaseStatusBar implements
        WindowManager.LayoutParams lp =
            (android.view.WindowManager.LayoutParams) mStatusBarView.getLayoutParams();
        lp.flags &= ~WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
        lp.flags &= ~WindowManager.LayoutParams.FLAG_SLIPPERY;
        WindowManagerImpl.getDefault().updateViewLayout(mStatusBarView, lp);
    }

@@ -714,7 +713,6 @@ public class TabletStatusBar extends BaseStatusBar implements
        WindowManager.LayoutParams lp =
            (android.view.WindowManager.LayoutParams) mStatusBarView.getLayoutParams();
        lp.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
        lp.flags |= WindowManager.LayoutParams.FLAG_SLIPPERY;
        WindowManagerImpl.getDefault().updateViewLayout(mStatusBarView, lp);
    }