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

Commit 22709326 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Ignore regions specified by the nav bar overlay" into sc-dev

parents 330f8f00 1113e624
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.navigationbar;
package com.android.systemui.navigationbar;


import android.content.Context;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.View;


import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.SysUISingleton;
@@ -47,7 +48,8 @@ public class NavigationBarOverlayController {
    /**
    /**
     * Initialize the controller with visibility change callback.
     * Initialize the controller with visibility change callback.
     */
     */
    public void init(Consumer<Boolean> visibilityChangeCallback) {}
    public void init(Consumer<Boolean> visibilityChangeCallback,
            Consumer<Rect> excludeBackRegionCallback) {}


    /**
    /**
     * Set whether the view can be shown.
     * Set whether the view can be shown.
+6 −4
Original line number Original line Diff line number Diff line
@@ -323,10 +323,6 @@ public class NavigationBarView extends FrameLayout implements


        mOverviewProxyService = Dependency.get(OverviewProxyService.class);
        mOverviewProxyService = Dependency.get(OverviewProxyService.class);
        mRecentsOnboarding = new RecentsOnboarding(context, mOverviewProxyService);
        mRecentsOnboarding = new RecentsOnboarding(context, mOverviewProxyService);
        mNavBarOverlayController = Dependency.get(NavigationBarOverlayController.class);
        if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
            mNavBarOverlayController.init(mNavbarOverlayVisibilityChangeCallback);
        }


        mConfiguration = new Configuration();
        mConfiguration = new Configuration();
        mTmpLastConfiguration = new Configuration();
        mTmpLastConfiguration = new Configuration();
@@ -371,6 +367,12 @@ public class NavigationBarView extends FrameLayout implements
                        return isGesturalModeOnDefaultDisplay(getContext(), mNavBarMode);
                        return isGesturalModeOnDefaultDisplay(getContext(), mNavBarMode);
                    }
                    }
                });
                });

        mNavBarOverlayController = Dependency.get(NavigationBarOverlayController.class);
        if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
            mNavBarOverlayController.init(mNavbarOverlayVisibilityChangeCallback,
                    mEdgeBackGestureHandler::updateNavigationBarOverlayExcludeRegion);
        }
    }
    }


    public void setAutoHideController(AutoHideController autoHideController) {
    public void setAutoHideController(AutoHideController autoHideController) {
+9 −2
Original line number Original line Diff line number Diff line
@@ -187,6 +187,7 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
    private final Executor mMainExecutor;
    private final Executor mMainExecutor;


    private final Rect mPipExcludedBounds = new Rect();
    private final Rect mPipExcludedBounds = new Rect();
    private final Rect mNavBarOverlayExcludedBounds = new Rect();
    private final Region mExcludeRegion = new Region();
    private final Region mExcludeRegion = new Region();
    private final Region mUnrestrictedExcludeRegion = new Region();
    private final Region mUnrestrictedExcludeRegion = new Region();


@@ -366,6 +367,10 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
        mTouchSlop = mViewConfiguration.getScaledTouchSlop() * backGestureSlop;
        mTouchSlop = mViewConfiguration.getScaledTouchSlop() * backGestureSlop;
    }
    }


    public void updateNavigationBarOverlayExcludeRegion(Rect exclude) {
        mNavBarOverlayExcludedBounds.set(exclude);
    }

    private void onNavigationSettingsChanged() {
    private void onNavigationSettingsChanged() {
        boolean wasBackAllowed = isHandlingGestures();
        boolean wasBackAllowed = isHandlingGestures();
        updateCurrentUserResources();
        updateCurrentUserResources();
@@ -629,8 +634,9 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
            return false;
            return false;
        }
        }


        // If the point is inside the PiP excluded bounds, then drop it.
        // If the point is inside the PiP or Nav bar overlay excluded bounds, then ignore the back
        if (mPipExcludedBounds.contains(x, y)) {
        // gesture
        if (mPipExcludedBounds.contains(x, y) || mNavBarOverlayExcludedBounds.contains(x, y)) {
            return false;
            return false;
        }
        }


@@ -893,6 +899,7 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
        pw.println("  mExcludeRegion=" + mExcludeRegion);
        pw.println("  mExcludeRegion=" + mExcludeRegion);
        pw.println("  mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion);
        pw.println("  mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion);
        pw.println("  mPipExcludedBounds=" + mPipExcludedBounds);
        pw.println("  mPipExcludedBounds=" + mPipExcludedBounds);
        pw.println("  mNavBarOverlayExcludedBounds=" + mNavBarOverlayExcludedBounds);
        pw.println("  mEdgeWidthLeft=" + mEdgeWidthLeft);
        pw.println("  mEdgeWidthLeft=" + mEdgeWidthLeft);
        pw.println("  mEdgeWidthRight=" + mEdgeWidthRight);
        pw.println("  mEdgeWidthRight=" + mEdgeWidthRight);
        pw.println("  mLeftInset=" + mLeftInset);
        pw.println("  mLeftInset=" + mLeftInset);