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

Commit bd28a128 authored by Winson Chung's avatar Winson Chung Committed by android-build-merger
Browse files

Merge "Update the edge back gesture width from the current user's overlays" into qt-dev

am: 4cdce5a8

Change-Id: Ib16a8c4086847c9c1e60953b09b9093c439bc052
parents 30089253 4cdce5a8
Loading
Loading
Loading
Loading
+22 −6
Original line number Original line Diff line number Diff line
@@ -57,6 +57,7 @@ import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.systemui.shared.system.WindowManagerWrapper;


import java.io.PrintWriter;
import java.util.concurrent.Executor;
import java.util.concurrent.Executor;


/**
/**
@@ -118,7 +119,7 @@ public class EdgeBackGestureHandler implements DisplayListener {


    private final Region mExcludeRegion = new Region();
    private final Region mExcludeRegion = new Region();
    // The edge width where touch down is allowed
    // The edge width where touch down is allowed
    private final int mEdgeWidth;
    private int mEdgeWidth;
    // The slop to distinguish between horizontal and vertical motion
    // The slop to distinguish between horizontal and vertical motion
    private final float mTouchSlop;
    private final float mTouchSlop;
    // Duration after which we consider the event as longpress.
    // Duration after which we consider the event as longpress.
@@ -163,10 +164,6 @@ public class EdgeBackGestureHandler implements DisplayListener {
        mWm = context.getSystemService(WindowManager.class);
        mWm = context.getSystemService(WindowManager.class);
        mOverviewProxyService = overviewProxyService;
        mOverviewProxyService = overviewProxyService;


        // TODO: Get this for the current user
        mEdgeWidth = res.getDimensionPixelSize(
                com.android.internal.R.dimen.config_backGestureInset);

        // Reduce the default touch slop to ensure that we can intercept the gesture
        // Reduce the default touch slop to ensure that we can intercept the gesture
        // before the app starts to react to it.
        // before the app starts to react to it.
        // TODO(b/130352502) Tune this value and extract into a constant
        // TODO(b/130352502) Tune this value and extract into a constant
@@ -176,6 +173,12 @@ public class EdgeBackGestureHandler implements DisplayListener {
        mNavBarHeight = res.getDimensionPixelSize(R.dimen.navigation_bar_frame_height);
        mNavBarHeight = res.getDimensionPixelSize(R.dimen.navigation_bar_frame_height);
        mMinArrowPosition = res.getDimensionPixelSize(R.dimen.navigation_edge_arrow_min_y);
        mMinArrowPosition = res.getDimensionPixelSize(R.dimen.navigation_edge_arrow_min_y);
        mFingerOffset = res.getDimensionPixelSize(R.dimen.navigation_edge_finger_offset);
        mFingerOffset = res.getDimensionPixelSize(R.dimen.navigation_edge_finger_offset);
        updateCurrentUserResources(res);
    }

    public void updateCurrentUserResources(Resources res) {
        mEdgeWidth = res.getDimensionPixelSize(
                com.android.internal.R.dimen.config_backGestureInset);
    }
    }


    /**
    /**
@@ -194,9 +197,10 @@ public class EdgeBackGestureHandler implements DisplayListener {
        updateIsEnabled();
        updateIsEnabled();
    }
    }


    public void onNavigationModeChanged(int mode) {
    public void onNavigationModeChanged(int mode, Context currentUserContext) {
        mIsGesturalModeEnabled = QuickStepContract.isGesturalMode(mode);
        mIsGesturalModeEnabled = QuickStepContract.isGesturalMode(mode);
        updateIsEnabled();
        updateIsEnabled();
        updateCurrentUserResources(currentUserContext.getResources());
    }
    }


    private void disposeInputChannel() {
    private void disposeInputChannel() {
@@ -270,6 +274,8 @@ public class EdgeBackGestureHandler implements DisplayListener {
                            | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
                            | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
                            | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
                            | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
                    PixelFormat.TRANSLUCENT);
                    PixelFormat.TRANSLUCENT);
            mEdgePanelLp.privateFlags |=
                    WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
            mEdgePanelLp.setTitle(TAG + mDisplayId);
            mEdgePanelLp.setTitle(TAG + mDisplayId);
            mEdgePanelLp.accessibilityTitle = mContext.getString(R.string.nav_bar_edge_panel);
            mEdgePanelLp.accessibilityTitle = mContext.getString(R.string.nav_bar_edge_panel);
            mEdgePanelLp.windowAnimations = 0;
            mEdgePanelLp.windowAnimations = 0;
@@ -449,6 +455,16 @@ public class EdgeBackGestureHandler implements DisplayListener {
        mRightInset = rightInset;
        mRightInset = rightInset;
    }
    }


    public void dump(PrintWriter pw) {
        pw.println("EdgeBackGestureHandler:");
        pw.println("  mIsEnabled=" + mIsEnabled);
        pw.println("  mAllowGesture=" + mAllowGesture);
        pw.println("  mExcludeRegion=" + mExcludeRegion);
        pw.println("  mImeHeight=" + mImeHeight);
        pw.println("  mIsAttached=" + mIsAttached);
        pw.println("  mEdgeWidth=" + mEdgeWidth);
    }

    class SysUiInputEventReceiver extends InputEventReceiver {
    class SysUiInputEventReceiver extends InputEventReceiver {
        SysUiInputEventReceiver(InputChannel channel, Looper looper) {
        SysUiInputEventReceiver(InputChannel channel, Looper looper) {
            super(channel, looper);
            super(channel, looper);
+3 −1
Original line number Original line Diff line number Diff line
@@ -772,9 +772,10 @@ public class NavigationBarView extends FrameLayout implements


    @Override
    @Override
    public void onNavigationModeChanged(int mode) {
    public void onNavigationModeChanged(int mode) {
        Context curUserCtx = Dependency.get(NavigationModeController.class).getCurrentUserContext();
        mNavBarMode = mode;
        mNavBarMode = mode;
        mBarTransitions.onNavigationModeChanged(mNavBarMode);
        mBarTransitions.onNavigationModeChanged(mNavBarMode);
        mEdgeBackGestureHandler.onNavigationModeChanged(mNavBarMode);
        mEdgeBackGestureHandler.onNavigationModeChanged(mNavBarMode, curUserCtx);
        mRecentsOnboarding.onNavigationModeChanged(mNavBarMode);
        mRecentsOnboarding.onNavigationModeChanged(mNavBarMode);
        getRotateSuggestionButton().onNavigationModeChanged(mNavBarMode);
        getRotateSuggestionButton().onNavigationModeChanged(mNavBarMode);


@@ -1103,6 +1104,7 @@ public class NavigationBarView extends FrameLayout implements
        mContextualButtonGroup.dump(pw);
        mContextualButtonGroup.dump(pw);
        mRecentsOnboarding.dump(pw);
        mRecentsOnboarding.dump(pw);
        mTintController.dump(pw);
        mTintController.dump(pw);
        mEdgeBackGestureHandler.dump(pw);
    }
    }


    @Override
    @Override
+1 −1
Original line number Original line Diff line number Diff line
@@ -224,7 +224,7 @@ public class NavigationModeController implements Dumpable {
        return mode;
        return mode;
    }
    }


    private Context getCurrentUserContext() {
    public Context getCurrentUserContext() {
        int userId = ActivityManagerWrapper.getInstance().getCurrentUserId();
        int userId = ActivityManagerWrapper.getInstance().getCurrentUserId();
        if (DEBUG) {
        if (DEBUG) {
            Log.d(TAG, "getCurrentUserContext: contextUser=" + mContext.getUserId()
            Log.d(TAG, "getCurrentUserContext: contextUser=" + mContext.getUserId()