Skip to content

Commit 64394de

Browse files
Winson ChungAndroid (Google) Code Review
authored andcommitted
Merge "Ensure that ML model results are still bounded by the gesture insets" into rvc-qpr-dev
2 parents 17d7e62 + 183e9b7 commit 64394de

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -560,20 +560,21 @@ private boolean isWithinTouchRegion(int x, int y) {
560560
if (mVocab != null) {
561561
app = mVocab.getOrDefault(mPackageName, -1);
562562
}
563-
// Check if we are within the tightest bounds beyond which
564-
// we would not need to run the ML model.
565-
boolean withinRange = x <= mMLEnableWidth + mLeftInset
566-
|| x >= (mDisplaySize.x - mMLEnableWidth - mRightInset);
567-
if (!withinRange) {
563+
564+
// Denotes whether we should proceed with the gesture. Even if it is false, we may want to
565+
// log it assuming it is not invalid due to exclusion.
566+
boolean withinRange = x < mEdgeWidthLeft + mLeftInset
567+
|| x >= (mDisplaySize.x - mEdgeWidthRight - mRightInset);
568+
if (withinRange) {
568569
int results = -1;
569-
if (mUseMLModel && (results = getBackGesturePredictionsCategory(x, y, app)) != -1) {
570-
withinRange = results == 1;
571-
} else {
572-
// Denotes whether we should proceed with the gesture.
573-
// Even if it is false, we may want to log it assuming
574-
// it is not invalid due to exclusion.
575-
withinRange = x <= mEdgeWidthLeft + mLeftInset
576-
|| x >= (mDisplaySize.x - mEdgeWidthRight - mRightInset);
570+
571+
// Check if we are within the tightest bounds beyond which we would not need to run the
572+
// ML model
573+
boolean withinMinRange = x < mMLEnableWidth + mLeftInset
574+
|| x >= (mDisplaySize.x - mMLEnableWidth - mRightInset);
575+
if (!withinMinRange && mUseMLModel
576+
&& (results = getBackGesturePredictionsCategory(x, y, app)) != -1) {
577+
withinRange = (results == 1);
577578
}
578579
}
579580

0 commit comments

Comments
 (0)