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

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

Merge "Using correct gesture margins in overview" into ub-launcher3-qt-r1-dev

parents 6f818e03 2f7d1fa4
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -3,11 +3,15 @@ package com.android.quickstep;
import android.content.Context;
import android.os.Bundle;

import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.testing.TestInformationHandler;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.uioverrides.states.OverviewState;
import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;

import java.util.concurrent.ExecutionException;

public class QuickstepTestInformationHandler extends TestInformationHandler {

@@ -45,6 +49,33 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
                        PortraitStatesTouchController.getHotseatTop(mLauncher));
                return response;
            }

            case TestProtocol.REQUEST_OVERVIEW_LEFT_GESTURE_MARGIN: {
                try {
                    final int leftMargin = new MainThreadExecutor().submit(() ->
                            mLauncher.<RecentsView>getOverviewPanel().getLeftGestureMargin()).get();
                    response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, leftMargin);
                } catch (ExecutionException e) {
                    e.printStackTrace();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                return response;
            }

            case TestProtocol.REQUEST_OVERVIEW_RIGHT_GESTURE_MARGIN: {
                try {
                    final int rightMargin = new MainThreadExecutor().submit(() ->
                            mLauncher.<RecentsView>getOverviewPanel().getRightGestureMargin()).
                            get();
                    response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, rightMargin);
                } catch (ExecutionException e) {
                    e.printStackTrace();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                return response;
            }
        }

        return super.call(method);
+11 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.ListView;
@@ -1742,4 +1743,14 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
            updateEnabledOverlays();
        }
    }

    public int getLeftGestureMargin() {
        final WindowInsets insets = getRootWindowInsets();
        return Math.max(insets.getSystemGestureInsets().left, insets.getSystemWindowInsetLeft());
    }

    public int getRightGestureMargin() {
        final WindowInsets insets = getRootWindowInsets();
        return Math.max(insets.getSystemGestureInsets().right, insets.getSystemWindowInsetRight());
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ public final class TestProtocol {
    public static final String REQUEST_FREEZE_APP_LIST = "freeze-app-list";
    public static final String REQUEST_UNFREEZE_APP_LIST = "unfreeze-app-list";
    public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags";
    public static final String REQUEST_OVERVIEW_LEFT_GESTURE_MARGIN = "overview-left-margin";
    public static final String REQUEST_OVERVIEW_RIGHT_GESTURE_MARGIN = "overview-right-margin";

    public static boolean sDebugTracing = false;
    public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing";
+10 −5
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.Direction;
import androidx.test.uiautomator.UiObject2;

import com.android.launcher3.testing.TestProtocol;

import java.util.Collections;
import java.util.List;

@@ -30,7 +32,6 @@ import java.util.List;
 * Common overview pane for both Launcher and fallback recents
 */
public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
    private static final int FLING_SPEED = LauncherInstrumentation.isAvd() ? 500 : 1500;
    private static final int FLINGS_FOR_DISMISS_LIMIT = 40;

    BaseOverview(LauncherInstrumentation launcher) {
@@ -51,8 +52,10 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
                     mLauncher.addContextLayer("want to fling forward in overview")) {
            LauncherInstrumentation.log("Overview.flingForward before fling");
            final UiObject2 overview = verifyActiveContainer();
            mLauncher.scroll(overview, Direction.LEFT, 1,
                    new Rect(mLauncher.getEdgeSensitivityWidth(), 0, 0, 0), 20);
            final int leftMargin = mLauncher.getTestInfo(
                    TestProtocol.REQUEST_OVERVIEW_LEFT_GESTURE_MARGIN).
                    getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD);
            mLauncher.scroll(overview, Direction.LEFT, 1, new Rect(leftMargin, 0, 0, 0), 20);
            verifyActiveContainer();
        }
    }
@@ -87,8 +90,10 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
                     mLauncher.addContextLayer("want to fling backward in overview")) {
            LauncherInstrumentation.log("Overview.flingBackward before fling");
            final UiObject2 overview = verifyActiveContainer();
            mLauncher.scroll(overview, Direction.RIGHT, 1,
                    new Rect(0, 0, mLauncher.getEdgeSensitivityWidth(), 0), 20);
            final int rightMargin = mLauncher.getTestInfo(
                    TestProtocol.REQUEST_OVERVIEW_RIGHT_GESTURE_MARGIN).
                    getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD);
            mLauncher.scroll(overview, Direction.RIGHT, 1, new Rect(0, 0, rightMargin, 0), 20);
            verifyActiveContainer();
        }
    }