Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dcd012b2 authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Wakeup display on taps before entering true AoD

In this transition state, the device is not technically
pulsing, but it is Dozing. The primary difference
is that the display state is the display is still ON
(not DISPLAY_STATE_DOZE) and the DozeSensor wake gestures
aren't registered yet.

Because isPulsing=false during this transition, instead of checking
isPulsing, check isDozing instead. Only touches when the display
is ON get sent through the NotificationShadeWindowViewController =>
PulsingGestureListener, so the DozeSensors will still handle the
wakeups that aren't fake AoD2 (including both pulsing + transition
period).

This CL:
 -  updates the PulsingGestureListener to only check
    the falsing manager on the ACTION_UP event of the single tap
    and double tap gesture. The FalsingManager only works if checked
    right after the action occurred. Previously, we'd check double
    taps on the double tap's ACTION_DOWN.
  - allows the FalsingManager to analyze taps from the NotificationPanel
    while Dozing, as to include the taps when the device is
    transitioning to AoD. When the device enters the display state DOZE,
    taps will no longer be sent to the NotificationPanel.
  - removes the vibration when DOZING that goes along with the falsing manager's
    feedback when an additional tap is required. if the device is
    dozing, its likely the device may be in the pocket so there's no
    reason to buzz.
Test: manual
  1. Enable AoD
  2. Power off display
  3. Tap display right after power off
  4. Observe: device wakes up to LS
Test: manual
  1. Disable AoD
  2. Send a delayed (5000ms) high-priority notification
  3. Screen off
  4. When the notification shows, tap the screen
  5. Observe: device wakes up to LS
Test: atest PulsingGestureListenerTest NotificationPanelViewControllerTest
Fixes: 246722709
Bug: 244659326
Bug: 242125976

Change-Id: I1330f2c87482d8bc743a61d652d245fd9b4c69a0
parent da9ab025
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -147,10 +147,10 @@ public interface FalsingManager {
    }

    /**
     * Listener that is alerted when a double tap is required to confirm a single tap.
     * Listener that is alerted when an additional tap is required to confirm a single tap.
     **/
    interface FalsingTapListener {
        void onDoubleTapRequired();
        void onAdditionalTapRequired();
    }

    /** Passed to {@link FalsingManager#onProximityEvent}. */
+2 −2
Original line number Diff line number Diff line
@@ -291,7 +291,7 @@ public class BrightLineFalsingManager implements FalsingManager {
                        FalsingClassifier.Result.falsed(
                                0, getClass().getSimpleName(), "bad history"));
                logDebug("False Single Tap: true (bad history)");
                mFalsingTapListeners.forEach(FalsingTapListener::onDoubleTapRequired);
                mFalsingTapListeners.forEach(FalsingTapListener::onAdditionalTapRequired);
                return true;
            } else {
                mPriorResults = getPassedResult(0.1);
@@ -321,7 +321,7 @@ public class BrightLineFalsingManager implements FalsingManager {
                mHistoryTracker.falseBelief(),
                mHistoryTracker.falseConfidence());
        mPriorResults = Collections.singleton(result);
        logDebug("False Double Tap: " + result.isFalse());
        logDebug("False Double Tap: " + result.isFalse() + " reason=" + result.getReason());
        return result.isFalse();
    }

+1 −3
Original line number Diff line number Diff line
@@ -303,9 +303,7 @@ class FalsingCollectorImpl implements FalsingCollector {

    @Override
    public void onTouchEvent(MotionEvent ev) {
        if (!mKeyguardStateController.isShowing()
                || (mStatusBarStateController.isDozing()
                    && !mStatusBarStateController.isPulsing())) {
        if (!mKeyguardStateController.isShowing()) {
            avoidGesture();
            return;
        }
+15 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_Q
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
import static com.android.systemui.statusbar.StatusBarState.SHADE;
import static com.android.systemui.statusbar.StatusBarState.SHADE_LOCKED;
import static com.android.systemui.statusbar.VibratorHelper.TOUCH_VIBRATION_ATTRIBUTES;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_ALL;
import static com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_FOLD_TO_AOD;
import static com.android.systemui.statusbar.phone.panelstate.PanelExpansionStateManagerKt.STATE_CLOSED;
@@ -62,6 +63,7 @@ import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.os.Bundle;
import android.os.Handler;
import android.os.PowerManager;
import android.os.Process;
import android.os.Trace;
import android.os.UserManager;
import android.os.VibrationEffect;
@@ -236,6 +238,9 @@ public final class NotificationPanelViewController extends PanelViewController {
    private static final boolean SPEW_LOGCAT = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.VERBOSE);
    private static final boolean DEBUG_DRAWABLE = false;

    private static final VibrationEffect ADDITIONAL_TAP_REQUIRED_VIBRATION_EFFECT =
            VibrationEffect.get(VibrationEffect.EFFECT_STRENGTH_MEDIUM, false);

    /**
     * The parallax amount of the quick settings translation when dragging down the panel
     */
@@ -682,14 +687,22 @@ public final class NotificationPanelViewController extends PanelViewController {

    private final FalsingTapListener mFalsingTapListener = new FalsingTapListener() {
        @Override
        public void onDoubleTapRequired() {
        public void onAdditionalTapRequired() {
            if (mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED) {
                mTapAgainViewController.show();
            } else {
                mKeyguardIndicationController.showTransientIndication(
                        R.string.notification_tap_again);
            }
            mVibratorHelper.vibrate(VibrationEffect.EFFECT_STRENGTH_MEDIUM);

            if (!mStatusBarStateController.isDozing()) {
                mVibratorHelper.vibrate(
                        Process.myUid(),
                        mView.getContext().getPackageName(),
                        ADDITIONAL_TAP_REQUIRED_VIBRATION_EFFECT,
                        "falsing-additional-tap-required",
                        TOUCH_VIBRATION_ATTRIBUTES);
            }
        }
    };

+4 −3
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public class NotificationShadeWindowViewController {
    private final AmbientState mAmbientState;
    private final PulsingGestureListener mPulsingGestureListener;

    private GestureDetector mGestureDetector;
    private GestureDetector mPulsingWakeupGestureHandler;
    private View mBrightnessMirror;
    private boolean mTouchActive;
    private boolean mTouchCancelled;
@@ -149,7 +149,8 @@ public class NotificationShadeWindowViewController {
    /** Inflates the {@link R.layout#status_bar_expanded} layout and sets it up. */
    public void setupExpandedStatusBar() {
        mStackScrollLayout = mView.findViewById(R.id.notification_stack_scroller);
        mGestureDetector = new GestureDetector(mView.getContext(), mPulsingGestureListener);
        mPulsingWakeupGestureHandler = new GestureDetector(mView.getContext(),
                mPulsingGestureListener);

        mView.setInteractionEventHandler(new NotificationShadeWindowView.InteractionEventHandler() {
            @Override
@@ -196,7 +197,7 @@ public class NotificationShadeWindowViewController {
                }

                mFalsingCollector.onTouchEvent(ev);
                mGestureDetector.onTouchEvent(ev);
                mPulsingWakeupGestureHandler.onTouchEvent(ev);
                mStatusBarKeyguardViewManager.onTouch(ev);
                if (mBrightnessMirror != null
                        && mBrightnessMirror.getVisibility() == View.VISIBLE) {
Loading