Merge "Fixed an issue where the insets of the cutout weren't respected" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f8668fe661
@@ -152,6 +152,8 @@ public class EdgeBackGestureHandler implements DisplayListener {
|
||||
private WindowManager.LayoutParams mEdgePanelLp;
|
||||
private final Rect mSamplingRect = new Rect();
|
||||
private RegionSamplingHelper mRegionSamplingHelper;
|
||||
private int mLeftInset;
|
||||
private int mRightInset;
|
||||
|
||||
public EdgeBackGestureHandler(Context context, OverviewProxyService overviewProxyService) {
|
||||
final Resources res = context.getResources();
|
||||
@@ -299,7 +301,7 @@ public class EdgeBackGestureHandler implements DisplayListener {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (x > mEdgeWidth && x < (mDisplaySize.x - mEdgeWidth)) {
|
||||
if (x > mEdgeWidth + mLeftInset && x < (mDisplaySize.x - mEdgeWidth - mRightInset)) {
|
||||
return false;
|
||||
}
|
||||
boolean isInExcludedRegion = mExcludeRegion.contains(x, y);
|
||||
@@ -325,7 +327,7 @@ public class EdgeBackGestureHandler implements DisplayListener {
|
||||
// Verify if this is in within the touch region and we aren't in immersive mode, and
|
||||
// either the bouncer is showing or the notification panel is hidden
|
||||
int stateFlags = mOverviewProxyService.getSystemUiStateFlags();
|
||||
mIsOnLeftEdge = ev.getX() <= mEdgeWidth;
|
||||
mIsOnLeftEdge = ev.getX() <= mEdgeWidth + mLeftInset;
|
||||
mAllowGesture = !QuickStepContract.isBackGestureDisabled(stateFlags)
|
||||
&& isWithinTouchRegion((int) ev.getX(), (int) ev.getY());
|
||||
if (mAllowGesture) {
|
||||
@@ -400,7 +402,7 @@ public class EdgeBackGestureHandler implements DisplayListener {
|
||||
|
||||
private void updateSamplingRect() {
|
||||
int top = mEdgePanelLp.y;
|
||||
int left = mIsOnLeftEdge ? 0 : mDisplaySize.x - mEdgePanelLp.width;
|
||||
int left = mIsOnLeftEdge ? mLeftInset : mDisplaySize.x - mRightInset - mEdgePanelLp.width;
|
||||
int right = left + mEdgePanelLp.width;
|
||||
int bottom = top + mEdgePanelLp.height;
|
||||
mSamplingRect.set(left, top, right, bottom);
|
||||
@@ -442,6 +444,11 @@ public class EdgeBackGestureHandler implements DisplayListener {
|
||||
InputManager.getInstance().injectInputEvent(ev, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
|
||||
}
|
||||
|
||||
public void setInsets(int leftInset, int rightInset) {
|
||||
mLeftInset = leftInset;
|
||||
mRightInset = rightInset;
|
||||
}
|
||||
|
||||
class SysUiInputEventReceiver extends InputEventReceiver {
|
||||
SysUiInputEventReceiver(InputChannel channel, Looper looper) {
|
||||
super(channel, looper);
|
||||
|
||||
@@ -1107,8 +1107,13 @@ public class NavigationBarView extends FrameLayout implements
|
||||
|
||||
@Override
|
||||
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
|
||||
setPadding(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(),
|
||||
insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom());
|
||||
int leftInset = insets.getSystemWindowInsetLeft();
|
||||
int rightInset = insets.getSystemWindowInsetRight();
|
||||
setPadding(leftInset, insets.getSystemWindowInsetTop(), rightInset,
|
||||
insets.getSystemWindowInsetBottom());
|
||||
// we're passing the insets onto the gesture handler since the back arrow is only
|
||||
// conditionally added and doesn't always get all the insets.
|
||||
mEdgeBackGestureHandler.setInsets(leftInset, rightInset);
|
||||
return super.onApplyWindowInsets(insets);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user