import android.os.SystemClock;
import android.util.Log;
import android.util.MathUtils;
+import android.util.StatsLog;
import android.view.Gravity;
import android.view.IPinnedStackController;
import android.view.IPinnedStackListener;
public void onSystemGestureExclusionChanged(int displayId,
Region systemGestureExclusion, Region unrestrictedOrNull) {
if (displayId == mDisplayId) {
- mMainExecutor.execute(() -> mExcludeRegion.set(systemGestureExclusion));
+ mMainExecutor.execute(() -> {
+ mExcludeRegion.set(systemGestureExclusion);
+ mUnrestrictedExcludeRegion.set(unrestrictedOrNull != null
+ ? unrestrictedOrNull : systemGestureExclusion);
+ });
}
}
};
private final Executor mMainExecutor;
private final Region mExcludeRegion = new Region();
+ private final Region mUnrestrictedExcludeRegion = new Region();
+
// The edge width where touch down is allowed
private int mEdgeWidth;
// The slop to distinguish between horizontal and vertical motion
private final PointF mDownPoint = new PointF();
private boolean mThresholdCrossed = false;
private boolean mAllowGesture = false;
+ private boolean mInRejectedExclusion = false;
private boolean mIsOnLeftEdge;
private int mImeHeight = 0;
if (isInExcludedRegion) {
mOverviewProxyService.notifyBackAction(false /* completed */, -1, -1,
false /* isButton */, !mIsOnLeftEdge);
+ StatsLog.write(StatsLog.BACK_GESTURE_REPORTED_REPORTED,
+ StatsLog.BACK_GESTURE__TYPE__INCOMPLETE_EXCLUDED, y,
+ mIsOnLeftEdge ? StatsLog.BACK_GESTURE__X_LOCATION__LEFT :
+ StatsLog.BACK_GESTURE__X_LOCATION__RIGHT);
+ } else {
+ mInRejectedExclusion = mUnrestrictedExcludeRegion.contains(x, y);
}
return !isInExcludedRegion;
}
private void cancelGesture(MotionEvent ev) {
// Send action cancel to reset all the touch events
mAllowGesture = false;
+ mInRejectedExclusion = false;
MotionEvent cancelEv = MotionEvent.obtain(ev);
cancelEv.setAction(MotionEvent.ACTION_CANCEL);
mEdgePanel.handleTouch(cancelEv);
// either the bouncer is showing or the notification panel is hidden
int stateFlags = mOverviewProxyService.getSystemUiStateFlags();
mIsOnLeftEdge = ev.getX() <= mEdgeWidth + mLeftInset;
+ mInRejectedExclusion = false;
mAllowGesture = !QuickStepContract.isBackGestureDisabled(stateFlags)
&& isWithinTouchRegion((int) ev.getX(), (int) ev.getY());
if (mAllowGesture) {
}
mOverviewProxyService.notifyBackAction(performAction, (int) mDownPoint.x,
(int) mDownPoint.y, false /* isButton */, !mIsOnLeftEdge);
+ int backtype = performAction ? (mInRejectedExclusion
+ ? StatsLog.BACK_GESTURE__TYPE__COMPLETED_REJECTED :
+ StatsLog.BACK_GESTURE__TYPE__COMPLETED) :
+ StatsLog.BACK_GESTURE__TYPE__INCOMPLETE;
+ StatsLog.write(StatsLog.BACK_GESTURE_REPORTED_REPORTED, backtype,
+ (int) mDownPoint.y, mIsOnLeftEdge
+ ? StatsLog.BACK_GESTURE__X_LOCATION__LEFT :
+ StatsLog.BACK_GESTURE__X_LOCATION__RIGHT);
}
if (isUp || action == MotionEvent.ACTION_CANCEL) {
mRegionSamplingHelper.stop();
pw.println("EdgeBackGestureHandler:");
pw.println(" mIsEnabled=" + mIsEnabled);
pw.println(" mAllowGesture=" + mAllowGesture);
+ pw.println(" mInRejectedExclusion" + mInRejectedExclusion);
pw.println(" mExcludeRegion=" + mExcludeRegion);
+ pw.println(" mUnrestrictedExcludeRegion=" + mUnrestrictedExcludeRegion);
pw.println(" mImeHeight=" + mImeHeight);
pw.println(" mIsAttached=" + mIsAttached);
pw.println(" mEdgeWidth=" + mEdgeWidth);