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

Commit 6183d129 authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed that music notifications were not clickable on lockscreen

On the lockscreen we were unintentionally disabling single clicks
on the media buttons while we only wanted to disallow it for the
notification header. This is now fixed by explicitly checking if
we are clicking on the notification header.

Bug: 26325096
Change-Id: I044f25ac3216b98c7769c31d09d19f801a437194
parent 3bdbf28b
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -335,4 +335,11 @@ public class NotificationHeaderView extends LinearLayout {
    public boolean hasOverlappingRendering() {
    public boolean hasOverlappingRendering() {
        return false;
        return false;
    }
    }

    public boolean isInTouchRect(float x, float y) {
        if (mExpandClickListener == null) {
            return false;
        }
        return mTouchListener.isInside(x, y);
    }
}
}
+15 −10
Original line number Original line Diff line number Diff line
@@ -176,26 +176,31 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
    };
    };


    @Override
    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (mDimmed && !mActivated) {
        if (mDimmed && !mActivated
            return handleTouchEventDimmed(event);
                && ev.getActionMasked() == MotionEvent.ACTION_DOWN && disallowSingleClick(ev)) {
        } else {
            return true;
            return super.dispatchTouchEvent(event);
        }
        return super.onInterceptTouchEvent(ev);
    }
    }

    protected boolean disallowSingleClick(MotionEvent ev) {
        return false;
    }
    }


    @Override
    @Override
    public boolean onTouchEvent(MotionEvent event) {
    public boolean onTouchEvent(MotionEvent event) {
        boolean result;
        boolean result;
        if (mDimmed && mActivated) {
        if (mDimmed) {
            boolean wasActivated = mActivated;
            result = handleTouchEventDimmed(event);
            result = handleTouchEventDimmed(event);
        } else {
            if (wasActivated && result && event.getAction() == MotionEvent.ACTION_UP) {
            result = super.onTouchEvent(event);
        }
        if (mActivated && result && event.getAction() == MotionEvent.ACTION_UP) {
                mFalsingManager.onNotificationDoubleTap();
                mFalsingManager.onNotificationDoubleTap();
                removeCallbacks(mTapTimeoutRunnable);
                removeCallbacks(mTapTimeoutRunnable);
            }
            }
        } else {
            result = super.onTouchEvent(event);
        }
        return result;
        return result;
    }
    }


+13 −0
Original line number Original line Diff line number Diff line
@@ -25,8 +25,10 @@ import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Build;
import android.service.notification.StatusBarNotification;
import android.service.notification.StatusBarNotification;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.NotificationHeaderView;
import android.view.NotificationHeaderView;
import android.view.View;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.ViewStub;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Chronometer;
import android.widget.Chronometer;
@@ -1113,6 +1115,17 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        mLoggingKey = key;
        mLoggingKey = key;
    }
    }


    @Override
    protected boolean disallowSingleClick(MotionEvent event) {
        float x = event.getX();
        float y = event.getY();
        NotificationHeaderView header = getNotificationHeader();
        if (header != null) {
            return header.isInTouchRect(x, y);
        }
        return super.disallowSingleClick(event);
    }

    private void logExpansionEvent(boolean userAction, boolean wasExpanded) {
    private void logExpansionEvent(boolean userAction, boolean wasExpanded) {
        final boolean nowExpanded = isExpanded();
        final boolean nowExpanded = isExpanded();
        if (wasExpanded != nowExpanded && mLogger != null) {
        if (wasExpanded != nowExpanded && mLogger != null) {