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

Commit 7b2e3df2 authored by Tony Wickham's avatar Tony Wickham
Browse files

Add logs to help debug TwoButtonNavBarTouchController

Test: TaplTestsQuickstep#testSwitchToOverview()

Bug: 13714484
Change-Id: I21740ac0fd6ddf2923fd081a00c84a463f13673b
parent 12eeecc3
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -24,11 +24,13 @@ import static com.android.launcher3.Utilities.EDGE_NAV_BAR;

import android.animation.ValueAnimator;
import android.os.SystemClock;
import android.util.Log;
import android.view.MotionEvent;

import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.AbstractStateChangeTouchController;
import com.android.launcher3.touch.SingleAxisSwipeDetector;
import com.android.quickstep.SystemUiProxy;
@@ -76,9 +78,18 @@ public class TwoButtonNavbarTouchController extends AbstractStateChangeTouchCont
            return true;
        }
        if (AbstractFloatingView.getTopOpenView(mLauncher) != null) {
            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.TWO_BUTTON_NORMAL_NOT_OVERVIEW,
                        "Didn't intercept touch due to top view: "
                                + AbstractFloatingView.getTopOpenView(mLauncher));
            }
            return false;
        }
        if ((ev.getEdgeFlags() & EDGE_NAV_BAR) == 0) {
            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.TWO_BUTTON_NORMAL_NOT_OVERVIEW,
                        "Didn't intercept touch because event wasn't from nav bar");
            }
            return false;
        }
        if (!mIsTransposed && mLauncher.isInState(OVERVIEW)) {
@@ -89,14 +100,21 @@ public class TwoButtonNavbarTouchController extends AbstractStateChangeTouchCont

    @Override
    protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) {
        final LauncherState targetState;
        if (mIsTransposed) {
            boolean draggingFromNav =
                    mLauncher.getDeviceProfile().isSeascape() == isDragTowardPositive;
            return draggingFromNav ? HINT_STATE_TWO_BUTTON : NORMAL;
            targetState = draggingFromNav ? HINT_STATE_TWO_BUTTON : NORMAL;
        } else {
            LauncherState startState = mStartState != null ? mStartState : fromState;
            return isDragTowardPositive ^ (startState == OVERVIEW) ? HINT_STATE_TWO_BUTTON : NORMAL;
            targetState = isDragTowardPositive ^ (startState == OVERVIEW)
                    ? HINT_STATE_TWO_BUTTON : NORMAL;
        }

        if (TestProtocol.sDebugTracing) {
            Log.d(TestProtocol.TWO_BUTTON_NORMAL_NOT_OVERVIEW, "Target state: " + targetState);
        }
        return targetState;
    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -113,4 +113,5 @@ public final class TestProtocol {
    public static final String WORK_PROFILE_REMOVED = "b/159671700";
    public static final String TIS_NO_EVENTS = "b/180915942";
    public static final String GET_RECENTS_FAILED = "b/177472267";
    public static final String TWO_BUTTON_NORMAL_NOT_OVERVIEW = "b/13714484";
}