Merge "Analyze Falsing on Expanded Notif Shade." into sc-dev
This commit is contained in:
@@ -38,8 +38,10 @@ public abstract class Classifier {
|
||||
public static final int BOUNCER_UNLOCK = 8;
|
||||
public static final int PULSE_EXPAND = 9;
|
||||
public static final int BRIGHTNESS_SLIDER = 10;
|
||||
public static final int UDFPS_AUTHENTICATION = 11;
|
||||
public static final int DISABLED_UDFPS_AFFORDANCE = 12;
|
||||
public static final int SHADE_DRAG = 11;
|
||||
public static final int QS_COLLAPSE = 12;
|
||||
public static final int UDFPS_AUTHENTICATION = 13;
|
||||
public static final int DISABLED_UDFPS_AFFORDANCE = 14;
|
||||
|
||||
@IntDef({
|
||||
QUICK_SETTINGS,
|
||||
@@ -53,6 +55,9 @@ public abstract class Classifier {
|
||||
BOUNCER_UNLOCK,
|
||||
PULSE_EXPAND,
|
||||
BRIGHTNESS_SLIDER,
|
||||
SHADE_DRAG,
|
||||
QS_COLLAPSE,
|
||||
BRIGHTNESS_SLIDER,
|
||||
UDFPS_AUTHENTICATION,
|
||||
DISABLED_UDFPS_AFFORDANCE
|
||||
})
|
||||
|
||||
@@ -22,6 +22,9 @@ import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHT
|
||||
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHTLINE_FALSING_DISTANCE_VELOCITY_TO_DISTANCE;
|
||||
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHTLINE_FALSING_DISTANCE_VERTICAL_FLING_THRESHOLD_IN;
|
||||
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHTLINE_FALSING_DISTANCE_VERTICAL_SWIPE_THRESHOLD_IN;
|
||||
import static com.android.systemui.classifier.Classifier.BRIGHTNESS_SLIDER;
|
||||
import static com.android.systemui.classifier.Classifier.QS_COLLAPSE;
|
||||
import static com.android.systemui.classifier.Classifier.SHADE_DRAG;
|
||||
|
||||
import android.provider.DeviceConfig;
|
||||
import android.view.MotionEvent;
|
||||
@@ -148,7 +151,9 @@ class DistanceClassifier extends FalsingClassifier {
|
||||
Result calculateFalsingResult(
|
||||
@Classifier.InteractionType int interactionType,
|
||||
double historyBelief, double historyConfidence) {
|
||||
if (interactionType == Classifier.BRIGHTNESS_SLIDER
|
||||
if (interactionType == BRIGHTNESS_SLIDER
|
||||
|| interactionType == SHADE_DRAG
|
||||
|| interactionType == QS_COLLAPSE
|
||||
|| interactionType == Classifier.UDFPS_AUTHENTICATION
|
||||
|| interactionType == Classifier.DISABLED_UDFPS_AFFORDANCE) {
|
||||
return Result.passed(0);
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.systemui.classifier;
|
||||
|
||||
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHTLINE_FALSING_PROXIMITY_PERCENT_COVERED_THRESHOLD;
|
||||
import static com.android.systemui.classifier.Classifier.BRIGHTNESS_SLIDER;
|
||||
import static com.android.systemui.classifier.Classifier.QS_COLLAPSE;
|
||||
import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS;
|
||||
|
||||
import android.provider.DeviceConfig;
|
||||
@@ -116,7 +117,8 @@ class ProximityClassifier extends FalsingClassifier {
|
||||
Result calculateFalsingResult(
|
||||
@Classifier.InteractionType int interactionType,
|
||||
double historyBelief, double historyConfidence) {
|
||||
if (interactionType == QUICK_SETTINGS || interactionType == BRIGHTNESS_SLIDER) {
|
||||
if (interactionType == QUICK_SETTINGS || interactionType == BRIGHTNESS_SLIDER
|
||||
|| interactionType == QS_COLLAPSE) {
|
||||
return Result.passed(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,10 @@ import static com.android.systemui.classifier.Classifier.LEFT_AFFORDANCE;
|
||||
import static com.android.systemui.classifier.Classifier.NOTIFICATION_DISMISS;
|
||||
import static com.android.systemui.classifier.Classifier.NOTIFICATION_DRAG_DOWN;
|
||||
import static com.android.systemui.classifier.Classifier.PULSE_EXPAND;
|
||||
import static com.android.systemui.classifier.Classifier.QS_COLLAPSE;
|
||||
import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS;
|
||||
import static com.android.systemui.classifier.Classifier.RIGHT_AFFORDANCE;
|
||||
import static com.android.systemui.classifier.Classifier.SHADE_DRAG;
|
||||
import static com.android.systemui.classifier.Classifier.UNLOCK;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -77,6 +79,12 @@ public class TypeClassifier extends FalsingClassifier {
|
||||
case RIGHT_AFFORDANCE: // Swiping from the bottom right corner for camera or similar.
|
||||
wrongDirection = right || !up;
|
||||
break;
|
||||
case SHADE_DRAG:
|
||||
wrongDirection = !vertical;
|
||||
break;
|
||||
case QS_COLLAPSE:
|
||||
wrongDirection = !vertical || !up;
|
||||
break;
|
||||
default:
|
||||
wrongDirection = true;
|
||||
break;
|
||||
|
||||
@@ -21,6 +21,7 @@ import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHT
|
||||
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHTLINE_FALSING_ZIGZAG_Y_PRIMARY_DEVIANCE;
|
||||
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHTLINE_FALSING_ZIGZAG_Y_SECONDARY_DEVIANCE;
|
||||
import static com.android.systemui.classifier.Classifier.BRIGHTNESS_SLIDER;
|
||||
import static com.android.systemui.classifier.Classifier.SHADE_DRAG;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.provider.DeviceConfig;
|
||||
@@ -88,7 +89,7 @@ class ZigZagClassifier extends FalsingClassifier {
|
||||
Result calculateFalsingResult(
|
||||
@Classifier.InteractionType int interactionType,
|
||||
double historyBelief, double historyConfidence) {
|
||||
if (interactionType == BRIGHTNESS_SLIDER) {
|
||||
if (interactionType == BRIGHTNESS_SLIDER || interactionType == SHADE_DRAG) {
|
||||
return Result.passed(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -142,9 +142,9 @@ public class DragDownHelper implements Gefingerpoken {
|
||||
}
|
||||
return true;
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (!mFalsingManager.isUnlockingDisabled() && !isFalseTouch()
|
||||
&& mDragDownCallback.onDraggedDown(mStartingChild,
|
||||
(int) (y - mInitialTouchY))) {
|
||||
if (!mFalsingManager.isUnlockingDisabled() && mDragDownCallback.canDragDown()
|
||||
&& !isFalseTouch()) {
|
||||
mDragDownCallback.onDraggedDown(mStartingChild, (int) (y - mInitialTouchY));
|
||||
if (mStartingChild == null) {
|
||||
cancelExpansion();
|
||||
} else {
|
||||
@@ -263,7 +263,10 @@ public class DragDownHelper implements Gefingerpoken {
|
||||
/**
|
||||
* @return true if the interaction is accepted, false if it should be cancelled
|
||||
*/
|
||||
boolean onDraggedDown(View startingChild, int dragLengthY);
|
||||
boolean canDragDown();
|
||||
|
||||
/** Call when a view has been dragged. */
|
||||
void onDraggedDown(View startingChild, int dragLengthY);
|
||||
void onDragDownReset();
|
||||
|
||||
/**
|
||||
|
||||
@@ -5499,9 +5499,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
@ShadeViewRefactor(RefactorComponent.INPUT)
|
||||
private final DragDownCallback mDragDownCallback = new DragDownCallback() {
|
||||
|
||||
@Override
|
||||
public boolean canDragDown() {
|
||||
return mStatusBarState == StatusBarState.KEYGUARD
|
||||
&& (mController.hasActiveNotifications() || mKeyguardMediaControllorVisible)
|
||||
|| mController.isInLockedDownShade();
|
||||
}
|
||||
|
||||
/* Only ever called as a consequence of a lockscreen expansion gesture. */
|
||||
@Override
|
||||
public boolean onDraggedDown(View startingChild, int dragLengthY) {
|
||||
public void onDraggedDown(View startingChild, int dragLengthY) {
|
||||
boolean canDragDown =
|
||||
mController.hasActiveNotifications() || mKeyguardMediaControllorVisible;
|
||||
if (mStatusBarState == StatusBarState.KEYGUARD && canDragDown) {
|
||||
@@ -5519,16 +5526,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
row.onExpandedByGesture(true /* drag down is always an open */);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (mController.isInLockedDownShade()) {
|
||||
mStatusbarStateController.setLeaveOpenOnKeyguardHide(true);
|
||||
mStatusBar.dismissKeyguardThenExecute(() -> false /* dismissAction */,
|
||||
null /* cancelRunnable */, false /* afterKeyguardGone */);
|
||||
return true;
|
||||
} else {
|
||||
// abort gesture.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,10 +59,12 @@ import com.android.systemui.ExpandHelper;
|
||||
import com.android.systemui.Gefingerpoken;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.SwipeHelper;
|
||||
import com.android.systemui.classifier.Classifier;
|
||||
import com.android.systemui.classifier.FalsingCollector;
|
||||
import com.android.systemui.colorextraction.SysuiColorExtractor;
|
||||
import com.android.systemui.dagger.qualifiers.Main;
|
||||
import com.android.systemui.media.KeyguardMediaController;
|
||||
import com.android.systemui.plugins.FalsingManager;
|
||||
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
|
||||
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.OnMenuEventListener;
|
||||
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
|
||||
@@ -143,6 +145,7 @@ public class NotificationStackScrollLayoutController {
|
||||
private final ZenModeController mZenModeController;
|
||||
private final MetricsLogger mMetricsLogger;
|
||||
private final FalsingCollector mFalsingCollector;
|
||||
private final FalsingManager mFalsingManager;
|
||||
private final Resources mResources;
|
||||
private final NotificationSwipeHelper.Builder mNotificationSwipeHelperBuilder;
|
||||
private final ScrimController mScrimController;
|
||||
@@ -556,6 +559,7 @@ public class NotificationStackScrollLayoutController {
|
||||
NotificationLockscreenUserManager lockscreenUserManager,
|
||||
MetricsLogger metricsLogger,
|
||||
FalsingCollector falsingCollector,
|
||||
FalsingManager falsingManager,
|
||||
@Main Resources resources,
|
||||
NotificationSwipeHelper.Builder notificationSwipeHelperBuilder,
|
||||
StatusBar statusBar,
|
||||
@@ -589,6 +593,7 @@ public class NotificationStackScrollLayoutController {
|
||||
mLockscreenUserManager = lockscreenUserManager;
|
||||
mMetricsLogger = metricsLogger;
|
||||
mFalsingCollector = falsingCollector;
|
||||
mFalsingManager = falsingManager;
|
||||
mResources = resources;
|
||||
mNotificationSwipeHelperBuilder = notificationSwipeHelperBuilder;
|
||||
mStatusBar = statusBar;
|
||||
@@ -1614,6 +1619,9 @@ public class NotificationStackScrollLayoutController {
|
||||
}
|
||||
}
|
||||
if (ev.getActionMasked() == MotionEvent.ACTION_UP) {
|
||||
// Ensure the falsing manager records the touch. we don't do anything with it
|
||||
// at the moment.
|
||||
mFalsingManager.isFalseTouch(Classifier.SHADE_DRAG);
|
||||
mView.setCheckForLeaveBehind(true);
|
||||
}
|
||||
traceJankOnTouchEvent(ev.getActionMasked(), scrollerWantsIt);
|
||||
|
||||
@@ -24,6 +24,7 @@ import static androidx.constraintlayout.widget.ConstraintSet.START;
|
||||
|
||||
import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE;
|
||||
import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_QS_EXPAND_COLLAPSE;
|
||||
import static com.android.systemui.classifier.Classifier.QS_COLLAPSE;
|
||||
import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS;
|
||||
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
|
||||
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_ALL;
|
||||
@@ -1450,11 +1451,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
case MotionEvent.ACTION_UP:
|
||||
trackMovement(event);
|
||||
if (mQsTracking) {
|
||||
flingQsWithCurrentVelocity(y,
|
||||
event.getActionMasked() == MotionEvent.ACTION_CANCEL);
|
||||
mQsTracking = false;
|
||||
}
|
||||
mQsTracking = false;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@@ -1526,10 +1523,17 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
|
||||
private void flingQsWithCurrentVelocity(float y, boolean isCancelMotionEvent) {
|
||||
float vel = getCurrentQSVelocity();
|
||||
final boolean expandsQs = flingExpandsQs(vel);
|
||||
boolean expandsQs = flingExpandsQs(vel);
|
||||
if (expandsQs) {
|
||||
logQsSwipeDown(y);
|
||||
if (mFalsingManager.isUnlockingDisabled() || isFalseTouch(QUICK_SETTINGS)) {
|
||||
expandsQs = false;
|
||||
} else {
|
||||
logQsSwipeDown(y);
|
||||
}
|
||||
} else if (vel < 0) {
|
||||
mFalsingManager.isFalseTouch(QS_COLLAPSE);
|
||||
}
|
||||
|
||||
flingSettings(vel, expandsQs && !isCancelMotionEvent ? FLING_EXPAND : FLING_COLLAPSE);
|
||||
}
|
||||
|
||||
@@ -1545,9 +1549,6 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
}
|
||||
|
||||
private boolean flingExpandsQs(float vel) {
|
||||
if (mFalsingManager.isUnlockingDisabled() || isFalseTouch(QUICK_SETTINGS)) {
|
||||
return false;
|
||||
}
|
||||
if (Math.abs(vel) < mFlingAnimationUtils.getMinVelocityPxPerSecond()) {
|
||||
return getQsExpansionFraction() > 0.5f;
|
||||
} else {
|
||||
@@ -1556,9 +1557,6 @@ public class NotificationPanelViewController extends PanelViewController {
|
||||
}
|
||||
|
||||
private boolean isFalseTouch(@Classifier.InteractionType int interactionType) {
|
||||
if (!mKeyguardAffordanceHelperCallback.needsAntiFalsing()) {
|
||||
return false;
|
||||
}
|
||||
if (mFalsingManager.isClassifierEnabled()) {
|
||||
return mFalsingManager.isFalseTouch(interactionType);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone;
|
||||
|
||||
import static com.android.internal.jank.InteractionJankMonitor.CUJ_NOTIFICATION_SHADE_EXPAND_COLLAPSE;
|
||||
import static com.android.systemui.classifier.Classifier.BOUNCER_UNLOCK;
|
||||
import static com.android.systemui.classifier.Classifier.GENERIC;
|
||||
import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS;
|
||||
import static com.android.systemui.classifier.Classifier.UNLOCK;
|
||||
|
||||
@@ -430,9 +431,9 @@ public abstract class PanelViewController {
|
||||
mLockscreenGestureLogger.write(MetricsEvent.ACTION_LS_UNLOCK, heightDp, velocityDp);
|
||||
mLockscreenGestureLogger.log(LockscreenUiEvent.LOCKSCREEN_UNLOCK);
|
||||
}
|
||||
@Classifier.InteractionType int interactionType = vel > 0
|
||||
? QUICK_SETTINGS : (
|
||||
mKeyguardStateController.canDismissLockScreen()
|
||||
@Classifier.InteractionType int interactionType = vel == 0 ? GENERIC
|
||||
: vel > 0 ? QUICK_SETTINGS
|
||||
: (mKeyguardStateController.canDismissLockScreen()
|
||||
? UNLOCK : BOUNCER_UNLOCK);
|
||||
|
||||
fling(vel, expand, isFalseTouch(x, y, interactionType));
|
||||
|
||||
@@ -1825,7 +1825,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
}
|
||||
|
||||
public boolean isFalsingThresholdNeeded() {
|
||||
return mStatusBarStateController.getState() == StatusBarState.KEYGUARD;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.internal.statusbar.IStatusBarService;
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
import com.android.systemui.classifier.FalsingCollectorFake;
|
||||
import com.android.systemui.classifier.FalsingManagerFake;
|
||||
import com.android.systemui.colorextraction.SysuiColorExtractor;
|
||||
import com.android.systemui.media.KeyguardMediaController;
|
||||
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
|
||||
@@ -160,6 +161,7 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase {
|
||||
mNotificationLockscreenUserManager,
|
||||
mMetricsLogger,
|
||||
new FalsingCollectorFake(),
|
||||
new FalsingManagerFake(),
|
||||
mResources,
|
||||
mNotificationSwipeHelperBuilder,
|
||||
mStatusBar,
|
||||
|
||||
Reference in New Issue
Block a user