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

This commit is contained in:
Winson Chung
2021-05-19 21:58:15 +00:00
committed by Android (Google) Code Review
3 changed files with 18 additions and 7 deletions

View File

@@ -17,6 +17,7 @@
package com.android.systemui.navigationbar;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import com.android.systemui.dagger.SysUISingleton;
@@ -47,7 +48,8 @@ public class NavigationBarOverlayController {
/**
* 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.

View File

@@ -323,10 +323,6 @@ public class NavigationBarView extends FrameLayout implements
mOverviewProxyService = Dependency.get(OverviewProxyService.class);
mRecentsOnboarding = new RecentsOnboarding(context, mOverviewProxyService);
mNavBarOverlayController = Dependency.get(NavigationBarOverlayController.class);
if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
mNavBarOverlayController.init(mNavbarOverlayVisibilityChangeCallback);
}
mConfiguration = new Configuration();
mTmpLastConfiguration = new Configuration();
@@ -371,6 +367,12 @@ public class NavigationBarView extends FrameLayout implements
return isGesturalModeOnDefaultDisplay(getContext(), mNavBarMode);
}
});
mNavBarOverlayController = Dependency.get(NavigationBarOverlayController.class);
if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
mNavBarOverlayController.init(mNavbarOverlayVisibilityChangeCallback,
mEdgeBackGestureHandler::updateNavigationBarOverlayExcludeRegion);
}
}
public void setAutoHideController(AutoHideController autoHideController) {

View File

@@ -187,6 +187,7 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
private final Executor mMainExecutor;
private final Rect mPipExcludedBounds = new Rect();
private final Rect mNavBarOverlayExcludedBounds = new Rect();
private final Region mExcludeRegion = new Region();
private final Region mUnrestrictedExcludeRegion = new Region();
@@ -366,6 +367,10 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
mTouchSlop = mViewConfiguration.getScaledTouchSlop() * backGestureSlop;
}
public void updateNavigationBarOverlayExcludeRegion(Rect exclude) {
mNavBarOverlayExcludedBounds.set(exclude);
}
private void onNavigationSettingsChanged() {
boolean wasBackAllowed = isHandlingGestures();
updateCurrentUserResources();
@@ -629,8 +634,9 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
return false;
}
// If the point is inside the PiP excluded bounds, then drop it.
if (mPipExcludedBounds.contains(x, y)) {
// If the point is inside the PiP or Nav bar overlay excluded bounds, then ignore the back
// gesture
if (mPipExcludedBounds.contains(x, y) || mNavBarOverlayExcludedBounds.contains(x, y)) {
return false;
}
@@ -893,6 +899,7 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
pw.println(" mExcludeRegion=" + mExcludeRegion);
pw.println(" mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion);
pw.println(" mPipExcludedBounds=" + mPipExcludedBounds);
pw.println(" mNavBarOverlayExcludedBounds=" + mNavBarOverlayExcludedBounds);
pw.println(" mEdgeWidthLeft=" + mEdgeWidthLeft);
pw.println(" mEdgeWidthRight=" + mEdgeWidthRight);
pw.println(" mLeftInset=" + mLeftInset);