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

Commit c62635ec authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed an issue where the falsing classifier wasn't used

Because of a refactor, the falsing classifier wasn't properly
used when double tapping.
In addition did we never do the same falsing check for the expand
button and the reply affordance which it now does as well.

Change-Id: Ib9ae4ab71e7abd73cb9f32a37c4ce2dc055f585b
Fixes: 68149445
Test: add media notification, double tap it / the expand affordance / the expand button
parent 01d52240
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;
@@ -173,12 +172,12 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
    private int mOverrideTint;
    private float mOverrideAmount;
    private boolean mShadowHidden;
    private boolean mWasActivatedOnDown;
    /**
     * Similar to mDimmed but is also true if it's not dimmable but should be
     */
    private boolean mNeedsDimming;
    private int mDimmedAlpha;
    private boolean mBlockNextTouch;

    public ActivatableNotificationView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -204,7 +203,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
            } else {
                makeInactive(true /* animate */);
            }
        }, this::performClick, this::handleSlideBack, mFalsingManager::onNotificationDoubleTap);
        }, super::performClick, this::handleSlideBack, mFalsingManager::onNotificationDoubleTap);
    }

    @Override
@@ -241,10 +240,16 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (mNeedsDimming && !mActivated && ev.getActionMasked() == MotionEvent.ACTION_DOWN
        if (mNeedsDimming && ev.getActionMasked() == MotionEvent.ACTION_DOWN
                && disallowSingleClick(ev) && !isTouchExplorationEnabled()) {
            if (!mActivated) {
                return true;
            } else if (!mDoubleTapHelper.isWithinDoubleTapSlop(ev)) {
                mBlockNextTouch = true;
                makeInactive(true /* animate */);
                return true;
            }
        }
        return super.onInterceptTouchEvent(ev);
    }

@@ -263,10 +268,11 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        boolean result;
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
            mWasActivatedOnDown = mActivated;
        if (mBlockNextTouch) {
            mBlockNextTouch = false;
            return false;
        }
        if ((mNeedsDimming && !mActivated) && !isTouchExplorationEnabled() && isInteractive()) {
        if (mNeedsDimming && !isTouchExplorationEnabled() && isInteractive()) {
            boolean wasActivated = mActivated;
            result = handleTouchEventDimmed(event);
            if (wasActivated && result && event.getAction() == MotionEvent.ACTION_UP) {
@@ -312,7 +318,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView

    @Override
    public boolean performClick() {
        if (mWasActivatedOnDown || !mNeedsDimming || isTouchExplorationEnabled()) {
        if (!mNeedsDimming || isTouchExplorationEnabled()) {
            return super.performClick();
        }
        return false;
+1 −1
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ public class DoubleTapHelper {
                && Math.abs(event.getY() - mDownY) < mTouchSlop;
    }

    private boolean isWithinDoubleTapSlop(MotionEvent event) {
    public boolean isWithinDoubleTapSlop(MotionEvent event) {
        if (!mActivated) {
            // If we're not activated there's no double tap slop to satisfy.
            return true;