Merge "Add debug logs with LogBuffer for touch/tap events" into tm-qpr-dev am: ad23a83ccf am: 0025c24843
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20272304 Change-Id: Ied6240d40dafad418a1862d7b3f708f8fc49d558 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -5681,6 +5681,7 @@ public final class NotificationPanelViewController {
|
||||
|
||||
/** @see ViewGroup#onInterceptTouchEvent(MotionEvent) */
|
||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||
mShadeLog.logMotionEvent(event, "NPVC onInterceptTouchEvent");
|
||||
if (SPEW_LOGCAT) {
|
||||
Log.v(TAG,
|
||||
"NPVC onInterceptTouchEvent (" + event.getId() + "): (" + event.getX()
|
||||
@@ -5693,6 +5694,8 @@ public final class NotificationPanelViewController {
|
||||
// Do not let touches go to shade or QS if the bouncer is visible,
|
||||
// but still let user swipe down to expand the panel, dismissing the bouncer.
|
||||
if (mCentralSurfaces.isBouncerShowing()) {
|
||||
mShadeLog.v("NotificationPanelViewController MotionEvent intercepted: "
|
||||
+ "bouncer is showing");
|
||||
return true;
|
||||
}
|
||||
if (mCommandQueue.panelsEnabled()
|
||||
@@ -5700,15 +5703,21 @@ public final class NotificationPanelViewController {
|
||||
&& mHeadsUpTouchHelper.onInterceptTouchEvent(event)) {
|
||||
mMetricsLogger.count(COUNTER_PANEL_OPEN, 1);
|
||||
mMetricsLogger.count(COUNTER_PANEL_OPEN_PEEK, 1);
|
||||
mShadeLog.v("NotificationPanelViewController MotionEvent intercepted: "
|
||||
+ "HeadsUpTouchHelper");
|
||||
return true;
|
||||
}
|
||||
if (!shouldQuickSettingsIntercept(mDownX, mDownY, 0)
|
||||
&& mPulseExpansionHandler.onInterceptTouchEvent(event)) {
|
||||
mShadeLog.v("NotificationPanelViewController MotionEvent intercepted: "
|
||||
+ "PulseExpansionHandler");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isFullyCollapsed() && onQsIntercept(event)) {
|
||||
debugLog("onQsIntercept true");
|
||||
mShadeLog.v("NotificationPanelViewController MotionEvent intercepted: "
|
||||
+ "QsIntercept");
|
||||
return true;
|
||||
}
|
||||
if (mInstantExpanding || !mNotificationsDragEnabled || mTouchDisabled || (mMotionAborted
|
||||
@@ -5739,6 +5748,9 @@ public final class NotificationPanelViewController {
|
||||
if (mAnimatingOnDown && mClosing && !mHintAnimationRunning) {
|
||||
cancelHeightAnimator();
|
||||
mTouchSlopExceeded = true;
|
||||
mShadeLog.v("NotificationPanelViewController MotionEvent intercepted:"
|
||||
+ " mAnimatingOnDown: true, mClosing: true, mHintAnimationRunning:"
|
||||
+ " false");
|
||||
return true;
|
||||
}
|
||||
mInitialExpandY = y;
|
||||
@@ -5783,6 +5795,8 @@ public final class NotificationPanelViewController {
|
||||
&& hAbs > Math.abs(x - mInitialExpandX)) {
|
||||
cancelHeightAnimator();
|
||||
startExpandMotion(x, y, true /* startTracking */, mExpandedHeight);
|
||||
mShadeLog.v("NotificationPanelViewController MotionEvent"
|
||||
+ " intercepted: startExpandMotion");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ class PulsingGestureListener @Inject constructor(
|
||||
private val centralSurfaces: CentralSurfaces,
|
||||
private val ambientDisplayConfiguration: AmbientDisplayConfiguration,
|
||||
private val statusBarStateController: StatusBarStateController,
|
||||
private val shadeLogger: ShadeLogger,
|
||||
tunerService: TunerService,
|
||||
dumpManager: DumpManager
|
||||
) : GestureDetector.SimpleOnGestureListener(), Dumpable {
|
||||
@@ -77,18 +78,23 @@ class PulsingGestureListener @Inject constructor(
|
||||
}
|
||||
|
||||
override fun onSingleTapUp(e: MotionEvent): Boolean {
|
||||
if (statusBarStateController.isDozing &&
|
||||
singleTapEnabled &&
|
||||
!dockManager.isDocked &&
|
||||
!falsingManager.isProximityNear &&
|
||||
!falsingManager.isFalseTap(LOW_PENALTY)
|
||||
) {
|
||||
centralSurfaces.wakeUpIfDozing(
|
||||
val isNotDocked = !dockManager.isDocked
|
||||
shadeLogger.logSingleTapUp(statusBarStateController.isDozing, singleTapEnabled, isNotDocked)
|
||||
if (statusBarStateController.isDozing && singleTapEnabled && isNotDocked) {
|
||||
val proximityIsNotNear = !falsingManager.isProximityNear
|
||||
val isNotAFalseTap = !falsingManager.isFalseTap(LOW_PENALTY)
|
||||
shadeLogger.logSingleTapUpFalsingState(proximityIsNotNear, isNotAFalseTap)
|
||||
if (proximityIsNotNear && isNotAFalseTap) {
|
||||
shadeLogger.d("Single tap handled, requesting centralSurfaces.wakeUpIfDozing")
|
||||
centralSurfaces.wakeUpIfDozing(
|
||||
SystemClock.uptimeMillis(),
|
||||
notificationShadeWindowView,
|
||||
"PULSING_SINGLE_TAP")
|
||||
"PULSING_SINGLE_TAP"
|
||||
)
|
||||
}
|
||||
return true
|
||||
}
|
||||
shadeLogger.d("onSingleTapUp event ignored")
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) {
|
||||
buffer.log(TAG, LogLevel.VERBOSE, msg)
|
||||
}
|
||||
|
||||
fun d(@CompileTimeConstant msg: String) {
|
||||
buffer.log(TAG, LogLevel.DEBUG, msg)
|
||||
}
|
||||
|
||||
private inline fun log(
|
||||
logLevel: LogLevel,
|
||||
initializer: LogMessage.() -> Unit,
|
||||
@@ -123,4 +127,25 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) {
|
||||
"animatingQs=$long1"
|
||||
})
|
||||
}
|
||||
|
||||
fun logSingleTapUp(isDozing: Boolean, singleTapEnabled: Boolean, isNotDocked: Boolean) {
|
||||
log(LogLevel.DEBUG, {
|
||||
bool1 = isDozing
|
||||
bool2 = singleTapEnabled
|
||||
bool3 = isNotDocked
|
||||
}, {
|
||||
"PulsingGestureListener#onSingleTapUp all of this must true for single " +
|
||||
"tap to be detected: isDozing: $bool1, singleTapEnabled: $bool2, isNotDocked: $bool3"
|
||||
})
|
||||
}
|
||||
|
||||
fun logSingleTapUpFalsingState(proximityIsNotNear: Boolean, isNotFalseTap: Boolean) {
|
||||
log(LogLevel.DEBUG, {
|
||||
bool1 = proximityIsNotNear
|
||||
bool2 = isNotFalseTap
|
||||
}, {
|
||||
"PulsingGestureListener#onSingleTapUp all of this must true for single " +
|
||||
"tap to be detected: proximityIsNotNear: $bool1, isNotFalseTap: $bool2"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +114,8 @@ import com.android.systemui.util.Assert;
|
||||
import com.android.systemui.util.DumpUtilsKt;
|
||||
import com.android.systemui.util.LargeScreenUtils;
|
||||
|
||||
import com.google.errorprone.annotations.CompileTimeConstant;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.util.ArrayList;
|
||||
@@ -3693,6 +3695,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
|
||||
@ShadeViewRefactor(RefactorComponent.INPUT)
|
||||
void handleEmptySpaceClick(MotionEvent ev) {
|
||||
logEmptySpaceClick(ev, isBelowLastNotification(mInitialTouchX, mInitialTouchY),
|
||||
mStatusBarState, mTouchIsClick);
|
||||
switch (ev.getActionMasked()) {
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
final float touchSlop = getTouchSlop(ev);
|
||||
@@ -3704,12 +3708,34 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (mStatusBarState != StatusBarState.KEYGUARD && mTouchIsClick &&
|
||||
isBelowLastNotification(mInitialTouchX, mInitialTouchY)) {
|
||||
debugLog("handleEmptySpaceClick: touch event propagated further");
|
||||
mOnEmptySpaceClickListener.onEmptySpaceClicked(mInitialTouchX, mInitialTouchY);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
debugLog("handleEmptySpaceClick: MotionEvent ignored");
|
||||
}
|
||||
}
|
||||
|
||||
private void debugLog(@CompileTimeConstant String s) {
|
||||
if (mLogger == null) {
|
||||
return;
|
||||
}
|
||||
mLogger.d(s);
|
||||
}
|
||||
|
||||
private void logEmptySpaceClick(MotionEvent ev, boolean isTouchBelowLastNotification,
|
||||
int statusBarState, boolean touchIsClick) {
|
||||
if (mLogger == null) {
|
||||
return;
|
||||
}
|
||||
mLogger.logEmptySpaceClick(
|
||||
isTouchBelowLastNotification,
|
||||
statusBarState,
|
||||
touchIsClick,
|
||||
MotionEvent.actionToString(ev.getActionMasked()));
|
||||
}
|
||||
|
||||
@ShadeViewRefactor(RefactorComponent.INPUT)
|
||||
void initDownStates(MotionEvent ev) {
|
||||
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.android.systemui.statusbar.notification.stack
|
||||
|
||||
import com.android.systemui.log.dagger.NotificationHeadsUpLog
|
||||
import com.android.systemui.plugins.log.LogBuffer
|
||||
import com.android.systemui.plugins.log.LogLevel.DEBUG
|
||||
import com.android.systemui.plugins.log.LogLevel.INFO
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry
|
||||
import com.android.systemui.statusbar.notification.logKey
|
||||
@@ -10,6 +11,7 @@ import com.android.systemui.statusbar.notification.stack.NotificationStackScroll
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK
|
||||
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_HEADS_UP_OTHER
|
||||
import com.google.errorprone.annotations.CompileTimeConstant
|
||||
import javax.inject.Inject
|
||||
|
||||
class NotificationStackScrollLogger @Inject constructor(
|
||||
@@ -56,6 +58,25 @@ class NotificationStackScrollLogger @Inject constructor(
|
||||
"key: $str1 expected: $bool1 actual: $bool2"
|
||||
})
|
||||
}
|
||||
|
||||
fun d(@CompileTimeConstant msg: String) = buffer.log(TAG, DEBUG, msg)
|
||||
|
||||
fun logEmptySpaceClick(
|
||||
isBelowLastNotification: Boolean,
|
||||
statusBarState: Int,
|
||||
touchIsClick: Boolean,
|
||||
motionEventDesc: String
|
||||
) {
|
||||
buffer.log(TAG, DEBUG, {
|
||||
int1 = statusBarState
|
||||
bool1 = touchIsClick
|
||||
bool2 = isBelowLastNotification
|
||||
str1 = motionEventDesc
|
||||
}, {
|
||||
"handleEmptySpaceClick: statusBarState: $int1 isTouchAClick: $bool1 " +
|
||||
"isTouchBelowNotification: $bool2 motionEvent: $str1"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private const val TAG = "NotificationStackScroll"
|
||||
@@ -66,6 +66,8 @@ class PulsingGestureListenerTest : SysuiTestCase() {
|
||||
private lateinit var dumpManager: DumpManager
|
||||
@Mock
|
||||
private lateinit var statusBarStateController: StatusBarStateController
|
||||
@Mock
|
||||
private lateinit var shadeLogger: ShadeLogger
|
||||
|
||||
private lateinit var tunableCaptor: ArgumentCaptor<Tunable>
|
||||
private lateinit var underTest: PulsingGestureListener
|
||||
@@ -81,6 +83,7 @@ class PulsingGestureListenerTest : SysuiTestCase() {
|
||||
centralSurfaces,
|
||||
ambientDisplayConfiguration,
|
||||
statusBarStateController,
|
||||
shadeLogger,
|
||||
tunerService,
|
||||
dumpManager
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user