@@ -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