Merge "Updating logging so that edge swipe logs do not get evicted by normal taps" into sc-dev
This commit is contained in:
@@ -251,8 +251,9 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
|
|||||||
private float mMLResults;
|
private float mMLResults;
|
||||||
|
|
||||||
// For debugging
|
// For debugging
|
||||||
private ArrayDeque<String> mPredictionLog = new ArrayDeque<>();
|
private LogArray mPredictionLog = new LogArray(MAX_NUM_LOGGED_PREDICTIONS);
|
||||||
private ArrayDeque<String> mGestureLog = new ArrayDeque<>();
|
private LogArray mGestureLogInsideInsets = new LogArray(MAX_NUM_LOGGED_GESTURES);
|
||||||
|
private LogArray mGestureLogOutsideInsets = new LogArray(MAX_NUM_LOGGED_GESTURES);
|
||||||
|
|
||||||
private final GestureNavigationSettingsObserver mGestureNavigationSettingsObserver;
|
private final GestureNavigationSettingsObserver mGestureNavigationSettingsObserver;
|
||||||
|
|
||||||
@@ -631,7 +632,7 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
|
|||||||
return mMLResults >= mMLModelThreshold ? 1 : 0;
|
return mMLResults >= mMLModelThreshold ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isWithinTouchRegion(int x, int y) {
|
private boolean isWithinInsets(int x, int y) {
|
||||||
// Disallow if we are in the bottom gesture area
|
// Disallow if we are in the bottom gesture area
|
||||||
if (y >= (mDisplaySize.y - mBottomGestureHeight)) {
|
if (y >= (mDisplaySize.y - mBottomGestureHeight)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -644,7 +645,10 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
|
|||||||
&& x < (mDisplaySize.x - 2 * (mEdgeWidthRight + mRightInset))) {
|
&& x < (mDisplaySize.x - 2 * (mEdgeWidthRight + mRightInset))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isWithinTouchRegion(int x, int y) {
|
||||||
// If the point is inside the PiP or Nav bar overlay excluded bounds, then ignore the back
|
// If the point is inside the PiP or Nav bar overlay excluded bounds, then ignore the back
|
||||||
// gesture
|
// gesture
|
||||||
final boolean isInsidePip = mIsInPipMode && mPipExcludedBounds.contains(x, y);
|
final boolean isInsidePip = mIsInPipMode && mPipExcludedBounds.contains(x, y);
|
||||||
@@ -675,14 +679,8 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For debugging purposes
|
// For debugging purposes
|
||||||
if (mPredictionLog.size() >= MAX_NUM_LOGGED_PREDICTIONS) {
|
mPredictionLog.log(String.format("Prediction [%d,%d,%d,%d,%f,%d]",
|
||||||
mPredictionLog.removeFirst();
|
|
||||||
}
|
|
||||||
mPredictionLog.addLast(String.format("Prediction [%d,%d,%d,%d,%f,%d]",
|
|
||||||
System.currentTimeMillis(), x, y, app, mMLResults, withinRange ? 1 : 0));
|
System.currentTimeMillis(), x, y, app, mMLResults, withinRange ? 1 : 0));
|
||||||
if (DEBUG_MISSING_GESTURE) {
|
|
||||||
Log.d(DEBUG_MISSING_GESTURE_TAG, mPredictionLog.peekLast());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always allow if the user is in a transient sticky immersive state
|
// Always allow if the user is in a transient sticky immersive state
|
||||||
if (mIsNavBarShownTransiently) {
|
if (mIsNavBarShownTransiently) {
|
||||||
@@ -755,7 +753,8 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
|
|||||||
mMLResults = 0;
|
mMLResults = 0;
|
||||||
mLogGesture = false;
|
mLogGesture = false;
|
||||||
mInRejectedExclusion = false;
|
mInRejectedExclusion = false;
|
||||||
mAllowGesture = !mDisabledForQuickstep && mIsBackGestureAllowed
|
boolean isWithinInsets = isWithinInsets((int) ev.getX(), (int) ev.getY());
|
||||||
|
mAllowGesture = !mDisabledForQuickstep && mIsBackGestureAllowed && isWithinInsets
|
||||||
&& !mGestureBlockingActivityRunning
|
&& !mGestureBlockingActivityRunning
|
||||||
&& !QuickStepContract.isBackGestureDisabled(mSysUiFlags)
|
&& !QuickStepContract.isBackGestureDisabled(mSysUiFlags)
|
||||||
&& isWithinTouchRegion((int) ev.getX(), (int) ev.getY());
|
&& isWithinTouchRegion((int) ev.getX(), (int) ev.getY());
|
||||||
@@ -769,18 +768,13 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
|
|||||||
mThresholdCrossed = false;
|
mThresholdCrossed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For debugging purposes
|
// For debugging purposes, only log edge points
|
||||||
if (mGestureLog.size() >= MAX_NUM_LOGGED_GESTURES) {
|
(isWithinInsets ? mGestureLogInsideInsets : mGestureLogOutsideInsets).log(String.format(
|
||||||
mGestureLog.removeFirst();
|
|
||||||
}
|
|
||||||
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));
|
||||||
if (DEBUG_MISSING_GESTURE) {
|
|
||||||
Log.d(DEBUG_MISSING_GESTURE_TAG, mGestureLog.peekLast());
|
|
||||||
}
|
|
||||||
} else if (mAllowGesture || mLogGesture) {
|
} else if (mAllowGesture || mLogGesture) {
|
||||||
if (!mThresholdCrossed) {
|
if (!mThresholdCrossed) {
|
||||||
mEndPoint.x = (int) ev.getX();
|
mEndPoint.x = (int) ev.getX();
|
||||||
@@ -907,7 +901,7 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
|
|||||||
pw.println(" mUseMLModel=" + mUseMLModel);
|
pw.println(" mUseMLModel=" + mUseMLModel);
|
||||||
pw.println(" mDisabledForQuickstep=" + mDisabledForQuickstep);
|
pw.println(" mDisabledForQuickstep=" + mDisabledForQuickstep);
|
||||||
pw.println(" mStartingQuickstepRotation=" + mStartingQuickstepRotation);
|
pw.println(" mStartingQuickstepRotation=" + mStartingQuickstepRotation);
|
||||||
pw.println(" mInRejectedExclusion" + mInRejectedExclusion);
|
pw.println(" mInRejectedExclusion=" + mInRejectedExclusion);
|
||||||
pw.println(" mExcludeRegion=" + mExcludeRegion);
|
pw.println(" mExcludeRegion=" + mExcludeRegion);
|
||||||
pw.println(" mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion);
|
pw.println(" mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion);
|
||||||
pw.println(" mIsInPipMode=" + mIsInPipMode);
|
pw.println(" mIsInPipMode=" + mIsInPipMode);
|
||||||
@@ -922,7 +916,8 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
|
|||||||
pw.println(" mTouchSlop=" + mTouchSlop);
|
pw.println(" mTouchSlop=" + mTouchSlop);
|
||||||
pw.println(" mBottomGestureHeight=" + mBottomGestureHeight);
|
pw.println(" mBottomGestureHeight=" + mBottomGestureHeight);
|
||||||
pw.println(" mPredictionLog=" + String.join("\n", mPredictionLog));
|
pw.println(" mPredictionLog=" + String.join("\n", mPredictionLog));
|
||||||
pw.println(" mGestureLog=" + String.join("\n", mGestureLog));
|
pw.println(" mGestureLogInsideInsets=" + String.join("\n", mGestureLogInsideInsets));
|
||||||
|
pw.println(" mGestureLogOutsideInsets=" + String.join("\n", mGestureLogOutsideInsets));
|
||||||
pw.println(" mEdgeBackPlugin=" + mEdgeBackPlugin);
|
pw.println(" mEdgeBackPlugin=" + mEdgeBackPlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -945,4 +940,23 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
|
|||||||
}
|
}
|
||||||
proto.edgeBackGestureHandler.allowGesture = mAllowGesture;
|
proto.edgeBackGestureHandler.allowGesture = mAllowGesture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static class LogArray extends ArrayDeque<String> {
|
||||||
|
private final int mLength;
|
||||||
|
|
||||||
|
LogArray(int length) {
|
||||||
|
mLength = length;
|
||||||
|
}
|
||||||
|
|
||||||
|
void log(String message) {
|
||||||
|
if (size() >= mLength) {
|
||||||
|
removeFirst();
|
||||||
|
}
|
||||||
|
addLast(message);
|
||||||
|
if (DEBUG_MISSING_GESTURE) {
|
||||||
|
Log.d(DEBUG_MISSING_GESTURE_TAG, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user