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

Commit 39ec9a51 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Enable quickscrub when notification shade is showing"

parents 6641ac54 90ef063c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -181,6 +181,9 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
        public void onQuickStepStarted() {
            // Use navbar dragging as a signal to hide the rotate button
            setRotateSuggestionButtonState(false);

            // Hide the notifications panel when quick step starts
            mStatusBar.collapsePanel(true /* animate */);
        }

        @Override
+1 −5
Original line number Diff line number Diff line
@@ -75,7 +75,6 @@ public class NavigationBarGestureHelper implements TunerService.Tunable, Gesture
    private int mTouchDownY;
    private boolean mDownOnRecents;
    private VelocityTracker mVelocityTracker;
    private boolean mNotificationsVisibleOnDown;

    private boolean mDockWindowEnabled;
    private boolean mDockWindowTouchSlopExceeded;
@@ -108,9 +107,6 @@ public class NavigationBarGestureHelper implements TunerService.Tunable, Gesture
    }

    public boolean onInterceptTouchEvent(MotionEvent event) {
        if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
            mNotificationsVisibleOnDown = !mStatusBar.isPresenterFullyCollapsed();
        }
        if (!canHandleGestures()) {
            return false;
        }
@@ -275,7 +271,7 @@ public class NavigationBarGestureHelper implements TunerService.Tunable, Gesture
    }

    private boolean canHandleGestures() {
        return !mStatusBar.isKeyguardShowing() && !mNotificationsVisibleOnDown;
        return !mStatusBar.isKeyguardShowing();
    }

    private int calculateDragMode() {
+12 −1
Original line number Diff line number Diff line
@@ -791,8 +791,19 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
                showSwipeUpUI ? mQuickStepAccessibilityDelegate : null);
    }

    public boolean isNotificationsFullyCollapsed() {
        return mPanelView.isFullyCollapsed();
    }

    /**
     * Updates the {@link WindowManager.LayoutParams.FLAG_SLIPPERY} state dependent on if swipe up
     * is enabled, or the notifications is fully opened without being in an animated state. If
     * slippery is enabled, touch events will leave the nav bar window and enter into the fullscreen
     * app/home window, if not nav bar will receive a cancelled touch event once gesture leaves bar.
     */
    public void updateSlippery() {
        setSlippery(!isQuickStepSwipeUpEnabled() || mPanelView.isFullyExpanded());
        setSlippery(!isQuickStepSwipeUpEnabled() ||
                (mPanelView.isFullyExpanded() && !mPanelView.isCollapsing()));
    }

    private void setSlippery(boolean slippery) {
+21 −8
Original line number Diff line number Diff line
@@ -45,9 +45,6 @@ import android.util.Slog;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManagerGlobal;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import androidx.annotation.DimenRes;
import com.android.systemui.Dependency;
import com.android.systemui.OverviewProxyService;
import com.android.systemui.R;
@@ -72,6 +69,7 @@ public class QuickStepController implements GestureHelper {
    private boolean mQuickScrubActive;
    private boolean mAllowGestureDetection;
    private boolean mQuickStepStarted;
    private boolean mNotificationsVisibleOnDown;
    private int mTouchDownX;
    private int mTouchDownY;
    private boolean mDragPositive;
@@ -221,6 +219,7 @@ public class QuickStepController implements GestureHelper {
                mNavigationBarView.transformMatrixToLocal(mTransformLocalMatrix);
                mQuickStepStarted = false;
                mAllowGestureDetection = true;
                mNotificationsVisibleOnDown = !mNavigationBarView.isNotificationsFullyCollapsed();
                break;
            }
            case MotionEvent.ACTION_MOVE: {
@@ -257,7 +256,8 @@ public class QuickStepController implements GestureHelper {
                // Decide to start quickstep if dragging away from the navigation bar, otherwise in
                // the parallel direction, decide to start quickscrub. Only one may run.
                if (!mQuickScrubActive && exceededSwipeUpTouchSlop) {
                    if (mNavigationBarView.isQuickStepSwipeUpEnabled()) {
                    if (mNavigationBarView.isQuickStepSwipeUpEnabled()
                            && !mNotificationsVisibleOnDown) {
                        startQuickStep(event);
                    }
                    break;
@@ -303,15 +303,28 @@ public class QuickStepController implements GestureHelper {
                break;
        }

        // Proxy motion events to launcher if not handled by quick scrub
        // Proxy motion events up/cancel that would be sent after long press on any nav button
        if (!mQuickScrubActive && !mIsInScreenPinning && (mAllowGestureDetection
                || action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP)) {
        if (shouldProxyEvents(action)) {
            proxyMotionEvents(event);
        }
        return mQuickScrubActive || mQuickStepStarted || deadZoneConsumed;
    }

    private boolean shouldProxyEvents(int action) {
        if (!mQuickScrubActive && !mIsInScreenPinning) {
            // Allow down, cancel and up events, move and other events are passed if notifications
            // are not showing and disabled gestures (such as long press) are not executed
            switch (action) {
                case MotionEvent.ACTION_DOWN:
                case MotionEvent.ACTION_CANCEL:
                case MotionEvent.ACTION_UP:
                    return true;
                default:
                    return !mNotificationsVisibleOnDown && mAllowGestureDetection;
            }
        }
        return false;
    }

    @Override
    public void onDraw(Canvas canvas) {
        if (!mNavigationBarView.isQuickScrubEnabled()) {