summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hyunyoung Song <hyunyoungs@google.com> 2019-08-05 17:19:54 -0700
committer Hyunyoung Song <hyunyoungs@google.com> 2019-08-08 22:40:27 -0700
commit36d7a2f8cfae7215c9c8206bd821f34dcca19ce9 (patch)
treec86d38e6a5c9787918de4e9b5a02d8289aa060c5
parent5f2c9a14f5940b9bee985332c850311f2225c75a (diff)
Log various types of back gesture using StatsLog
Bug: 135152789 Test: m statsd_testdrive -j31 Test: out/host/linux-x86/bin/statsd_testdrive 224 <Verified all four types of back gesture> data { elapsed_timestamp_nanos: 113275964369614 atom { back_gesture_reported_reported { type: INCOMPLETE y_coordinate: 900 x_location: LEFT } } } data { elapsed_timestamp_nanos: 113281680894558 atom { back_gesture_reported_reported { type: COMPLETED y_coordinate: 912 x_location: LEFT } } } data { elapsed_timestamp_nanos: 113285878610809 atom { back_gesture_reported_reported { type: INCOMPLETE_EXCLUDED y_coordinate: 2496 x_location: LEFT } } } data { elapsed_timestamp_nanos: 39490430338 atom { back_gesture_reported_reported { type: COMPLETED_REJECTED y_coordinate: 856 x_location: LEFT } } } Change-Id: I986a64c296cc2a1e33db8f7ea81b05b0ee96cdd5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
index e0c6c55c2e59..74ecbe162d35 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/EdgeBackGestureHandler.java
@@ -33,6 +33,7 @@ import android.os.RemoteException;
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;
@@ -105,7 +106,11 @@ public class EdgeBackGestureHandler implements DisplayListener {
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);
+ });
}
}
};
@@ -119,6 +124,8 @@ public class EdgeBackGestureHandler implements DisplayListener {
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
@@ -137,6 +144,7 @@ public class EdgeBackGestureHandler implements DisplayListener {
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;
@@ -316,6 +324,12 @@ public class EdgeBackGestureHandler implements DisplayListener {
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;
}
@@ -323,6 +337,7 @@ public class EdgeBackGestureHandler implements DisplayListener {
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);
@@ -336,6 +351,7 @@ public class EdgeBackGestureHandler implements DisplayListener {
// 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) {
@@ -390,6 +406,14 @@ public class EdgeBackGestureHandler implements DisplayListener {
}
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();
@@ -461,7 +485,9 @@ public class EdgeBackGestureHandler implements DisplayListener {
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);