Ensure that ML model results are still bounded by the gesture insets
- In some cases, the ML model may return that it is a valid swipe
even if it is out of the current inset bounds
Bug: 178561216
Test: Enable ML model, rotate to landscape and try to swipe near
the edges
Change-Id: Iaecd11acf50a1a19fe5964e11e06fb564ca6988c
This commit is contained in:
@@ -609,20 +609,21 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa
|
|||||||
if (mVocab != null) {
|
if (mVocab != null) {
|
||||||
app = mVocab.getOrDefault(mPackageName, -1);
|
app = mVocab.getOrDefault(mPackageName, -1);
|
||||||
}
|
}
|
||||||
// Check if we are within the tightest bounds beyond which
|
|
||||||
// we would not need to run the ML model.
|
// Denotes whether we should proceed with the gesture. Even if it is false, we may want to
|
||||||
boolean withinRange = x < mMLEnableWidth + mLeftInset
|
// log it assuming it is not invalid due to exclusion.
|
||||||
|| x >= (mDisplaySize.x - mMLEnableWidth - mRightInset);
|
boolean withinRange = x < mEdgeWidthLeft + mLeftInset
|
||||||
if (!withinRange) {
|
|| x >= (mDisplaySize.x - mEdgeWidthRight - mRightInset);
|
||||||
|
if (withinRange) {
|
||||||
int results = -1;
|
int results = -1;
|
||||||
if (mUseMLModel && (results = getBackGesturePredictionsCategory(x, y, app)) != -1) {
|
|
||||||
withinRange = results == 1;
|
// Check if we are within the tightest bounds beyond which we would not need to run the
|
||||||
} else {
|
// ML model
|
||||||
// Denotes whether we should proceed with the gesture.
|
boolean withinMinRange = x < mMLEnableWidth + mLeftInset
|
||||||
// Even if it is false, we may want to log it assuming
|
|| x >= (mDisplaySize.x - mMLEnableWidth - mRightInset);
|
||||||
// it is not invalid due to exclusion.
|
if (!withinMinRange && mUseMLModel
|
||||||
withinRange = x < mEdgeWidthLeft + mLeftInset
|
&& (results = getBackGesturePredictionsCategory(x, y, app)) != -1) {
|
||||||
|| x >= (mDisplaySize.x - mEdgeWidthRight - mRightInset);
|
withinRange = (results == 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -726,7 +727,7 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa
|
|||||||
mGestureLog.removeFirst();
|
mGestureLog.removeFirst();
|
||||||
}
|
}
|
||||||
mGestureLog.addLast(String.format(
|
mGestureLog.addLast(String.format(
|
||||||
"Gesture [%d,alw=%B,%B, %B,%B,disp=%s,wl=%d,il=%d,wr=%d,ir=%d,excl=%s]",
|
"Gesture [%d,alw=%B,%B,%B,%B,disp=%s,wl=%d,il=%d,wr=%d,ir=%d,excl=%s]",
|
||||||
System.currentTimeMillis(), mAllowGesture, mIsOnLeftEdge, mIsBackGestureAllowed,
|
System.currentTimeMillis(), mAllowGesture, mIsOnLeftEdge, mIsBackGestureAllowed,
|
||||||
QuickStepContract.isBackGestureDisabled(mSysUiFlags), mDisplaySize,
|
QuickStepContract.isBackGestureDisabled(mSysUiFlags), mDisplaySize,
|
||||||
mEdgeWidthLeft, mLeftInset, mEdgeWidthRight, mRightInset, mExcludeRegion));
|
mEdgeWidthLeft, mLeftInset, mEdgeWidthRight, mRightInset, mExcludeRegion));
|
||||||
|
|||||||
Reference in New Issue
Block a user