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

Commit acea0743 authored by Chris Wren's avatar Chris Wren Committed by Android (Google) Code Review
Browse files

Merge "Don't let the heads up close too quickly."

parents 8f6afec2 930eccaf
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -146,6 +146,9 @@
     before the app can interrupt again. -->
    <integer name="heads_up_default_snooze_length_ms">60000</integer>

    <!-- Minimum display time for a heads up notification, in milliseconds. -->
    <integer name="heads_up_notification_minimum_time">3000</integer>

    <!-- milliseconds before the heads up notification accepts touches. -->
    <integer name="heads_up_sensitivity_delay">700</integer>

+24 −36
Original line number Diff line number Diff line
@@ -127,7 +127,6 @@ public abstract class BaseStatusBar extends SystemUI implements
    protected static final int MSG_SHOW_HEADS_UP = 1028;
    protected static final int MSG_HIDE_HEADS_UP = 1029;
    protected static final int MSG_ESCALATE_HEADS_UP = 1030;
    protected static final int MSG_DECAY_HEADS_UP = 1031;

    protected static final boolean ENABLE_HEADS_UP = true;
    // scores above this threshold should be displayed in heads up mode.
@@ -1153,7 +1152,7 @@ public abstract class BaseStatusBar extends SystemUI implements
        // Do nothing
    }

    public abstract void resetHeadsUpDecayTimer();
    public abstract void scheduleHeadsUpDecay(long delay);

    public abstract void scheduleHeadsUpOpen();

@@ -1353,8 +1352,7 @@ public abstract class BaseStatusBar extends SystemUI implements

        PendingIntent contentIntent = sbn.getNotification().contentIntent;
        if (contentIntent != null) {
            final View.OnClickListener listener = makeClicker(contentIntent, sbn.getKey(),
                    isHeadsUp);
            final View.OnClickListener listener = makeClicker(contentIntent, sbn.getKey());
            row.setOnClickListener(listener);
        } else {
            row.setOnClickListener(null);
@@ -1515,20 +1513,17 @@ public abstract class BaseStatusBar extends SystemUI implements
        return true;
    }

    public NotificationClicker makeClicker(PendingIntent intent, String notificationKey,
            boolean forHun) {
        return new NotificationClicker(intent, notificationKey, forHun);
    public NotificationClicker makeClicker(PendingIntent intent, String notificationKey) {
        return new NotificationClicker(intent, notificationKey);
    }

    protected class NotificationClicker implements View.OnClickListener {
        private PendingIntent mIntent;
        private final String mNotificationKey;
        private boolean mIsHeadsUp;

        public NotificationClicker(PendingIntent intent, String notificationKey, boolean forHun) {
        public NotificationClicker(PendingIntent intent, String notificationKey) {
            mIntent = intent;
            mNotificationKey = notificationKey;
            mIsHeadsUp = forHun;
        }

        public void onClick(final View v) {
@@ -1541,12 +1536,12 @@ public abstract class BaseStatusBar extends SystemUI implements
                            mCurrentUserId);
            dismissKeyguardThenExecute(new OnDismissAction() {
                public boolean onDismiss() {
                    if (mIsHeadsUp) {
                    if (mNotificationKey.equals(mHeadsUpNotificationView.getKey())) {
                        // Release the HUN notification to the shade.
                        //
                        // In most cases, when FLAG_AUTO_CANCEL is set, the notification will
                        // become canceled shortly by NoMan, but we can't assume that.
                        mHeadsUpNotificationView.releaseAndClose();
                        mHeadsUpNotificationView.releaseImmediately();
                    }
                    new Thread() {
                        @Override
@@ -1893,7 +1888,7 @@ public abstract class BaseStatusBar extends SystemUI implements
                        && oldPublicContentView.getLayoutId() == publicContentView.getLayoutId());

        final boolean shouldInterrupt = shouldInterrupt(notification);
        final boolean alertAgain = alertAgain(oldEntry, n);
        final boolean alertAgain = shouldInterrupt && alertAgain(oldEntry, n);
        boolean updateSuccessful = false;
        if (contentsUnchanged && bigContentsUnchanged && headsUpContentsUnchanged
                && publicUnchanged) {
@@ -1916,14 +1911,12 @@ public abstract class BaseStatusBar extends SystemUI implements
                }

                if (wasHeadsUp) {
                    if (shouldInterrupt) {
                    // Release may hang on to the views for a bit, so we should always update them.
                    updateHeadsUpViews(oldEntry, notification);
                        if (alertAgain) {
                            resetHeadsUpDecayTimer();
                        }
                    } else {
                    mHeadsUpNotificationView.updateNotification(oldEntry, alertAgain);
                    if (!shouldInterrupt) {
                        // we updated the notification above, so release to build a new shade entry
                        mHeadsUpNotificationView.releaseAndClose();
                        mHeadsUpNotificationView.release();
                        return;
                    }
                } else {
@@ -1946,23 +1939,19 @@ public abstract class BaseStatusBar extends SystemUI implements
        if (!updateSuccessful) {
            if (DEBUG) Log.d(TAG, "not reusing notification for key: " + key);
            if (wasHeadsUp) {
                if (shouldInterrupt) {
                if (DEBUG) Log.d(TAG, "rebuilding heads up for key: " + key);
                Entry newEntry = new Entry(notification, null);
                ViewGroup holder = mHeadsUpNotificationView.getHolder();
                if (inflateViewsForHeadsUp(newEntry, holder)) {
                        mHeadsUpNotificationView.showNotification(newEntry);
                        if (alertAgain) {
                            resetHeadsUpDecayTimer();
                        }
                    mHeadsUpNotificationView.updateNotification(newEntry, alertAgain);
                } else {
                    Log.w(TAG, "Couldn't create new updated headsup for package "
                            + contentView.getPackage());
                }
                } else {
                if (!shouldInterrupt) {
                    if (DEBUG) Log.d(TAG, "releasing heads up for key: " + key);
                    oldEntry.notification = notification;
                    mHeadsUpNotificationView.releaseAndClose();
                    mHeadsUpNotificationView.release();
                    return;
                }
            } else {
@@ -2032,8 +2021,7 @@ public abstract class BaseStatusBar extends SystemUI implements
        // update the contentIntent
        final PendingIntent contentIntent = notification.getNotification().contentIntent;
        if (contentIntent != null) {
            final View.OnClickListener listener = makeClicker(contentIntent, notification.getKey(),
                    isHeadsUp);
            final View.OnClickListener listener = makeClicker(contentIntent, notification.getKey());
            entry.row.setOnClickListener(listener);
        } else {
            entry.row.setOnClickListener(null);
+36 −45
Original line number Diff line number Diff line
@@ -361,7 +361,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                if (!mUseHeadsUp) {
                    Log.d(TAG, "dismissing any existing heads up notification on disable event");
                    setHeadsUpVisibility(false);
                    mHeadsUpNotificationView.release();
                    mHeadsUpNotificationView.releaseImmediately();
                    removeHeadsUpView();
                } else {
                    addHeadsUpView();
@@ -1212,33 +1212,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        setAreThereNotifications();
    }

    @Override
    public void resetHeadsUpDecayTimer() {
        mHandler.removeMessages(MSG_DECAY_HEADS_UP);
        if (mUseHeadsUp && mHeadsUpNotificationDecay > 0
                && mHeadsUpNotificationView.isClearable()) {
            mHandler.sendEmptyMessageDelayed(MSG_DECAY_HEADS_UP, mHeadsUpNotificationDecay);
        }
    }

    @Override
    public void scheduleHeadsUpOpen() {
        mHandler.removeMessages(MSG_SHOW_HEADS_UP);
        mHandler.sendEmptyMessage(MSG_SHOW_HEADS_UP);
    }

    @Override
    public void scheduleHeadsUpClose() {
        mHandler.removeMessages(MSG_HIDE_HEADS_UP);
        mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
    }

    @Override
    public void scheduleHeadsUpEscalation() {
        mHandler.removeMessages(MSG_ESCALATE_HEADS_UP);
        mHandler.sendEmptyMessage(MSG_ESCALATE_HEADS_UP);
    }

    @Override
    protected void updateNotificationRanking(RankingMap ranking) {
        mNotificationData.updateRanking(ranking);
@@ -1247,9 +1220,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,

    @Override
    public void removeNotification(String key, RankingMap ranking) {
        if (ENABLE_HEADS_UP && mHeadsUpNotificationView.getEntry() != null
                && key.equals(mHeadsUpNotificationView.getEntry().notification.getKey())) {
            mHeadsUpNotificationView.clear();
        if (ENABLE_HEADS_UP) {
            mHeadsUpNotificationView.removeNotification(key);
        }

        StatusBarNotification old = removeNotificationViews(key, ranking);
@@ -1870,16 +1842,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                case MSG_SHOW_HEADS_UP:
                    setHeadsUpVisibility(true);
                    break;
                case MSG_DECAY_HEADS_UP:
                    mHeadsUpNotificationView.release();
                    setHeadsUpVisibility(false);
                    break;
                case MSG_HIDE_HEADS_UP:
                    mHeadsUpNotificationView.release();
                    setHeadsUpVisibility(false);
                    break;
                case MSG_ESCALATE_HEADS_UP:
                    escalateHeadsUp();
                case MSG_HIDE_HEADS_UP:
                    mHeadsUpNotificationView.releaseImmediately();
                    setHeadsUpVisibility(false);
                    break;
                case MSG_LAUNCH_TRANSITION_TIMEOUT:
@@ -1889,11 +1855,41 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        }
    }

    @Override
    public void scheduleHeadsUpDecay(long delay) {
        mHandler.removeMessages(MSG_HIDE_HEADS_UP);
        if (mHeadsUpNotificationView.isClearable()) {
            mHandler.sendEmptyMessageDelayed(MSG_HIDE_HEADS_UP, delay);
        }
    }

    @Override
    public void scheduleHeadsUpOpen() {
        mHandler.removeMessages(MSG_HIDE_HEADS_UP);
        mHandler.removeMessages(MSG_SHOW_HEADS_UP);
        mHandler.sendEmptyMessage(MSG_SHOW_HEADS_UP);
    }

    @Override
    public void scheduleHeadsUpClose() {
        mHandler.removeMessages(MSG_HIDE_HEADS_UP);
        if (mHeadsUpNotificationView.getVisibility() != View.GONE) {
            mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
        }
    }

    @Override
    public void scheduleHeadsUpEscalation() {
        mHandler.removeMessages(MSG_HIDE_HEADS_UP);
        mHandler.removeMessages(MSG_ESCALATE_HEADS_UP);
        mHandler.sendEmptyMessage(MSG_ESCALATE_HEADS_UP);
    }

    /**  if the interrupting notification had a fullscreen intent, fire it now.  */
    private void escalateHeadsUp() {
        if (mHeadsUpNotificationView.getEntry() != null) {
            final StatusBarNotification sbn = mHeadsUpNotificationView.getEntry().notification;
            mHeadsUpNotificationView.release();
            mHeadsUpNotificationView.releaseImmediately();
            final Notification notification = sbn.getNotification();
            if (notification.fullScreenIntent != null) {
                if (DEBUG)
@@ -2734,10 +2730,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        mHeadsUpNotificationView.setVisibility(vis ? View.VISIBLE : View.GONE);
    }

    public void onHeadsUpDismissed() {
        mHeadsUpNotificationView.dismiss();
    }

    /**
     * Reload some of our resources when the configuration changes.
     *
@@ -2772,7 +2764,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,

        mEdgeBorder = res.getDimensionPixelSize(R.dimen.status_bar_edge_ignore);

        mHeadsUpNotificationDecay = res.getInteger(R.integer.heads_up_notification_decay);
        mRowMinHeight =  res.getDimensionPixelSize(R.dimen.notification_min_height);
        mRowMaxHeight =  res.getDimensionPixelSize(R.dimen.notification_max_height);

+172 −72
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ import android.graphics.Rect;
import android.os.SystemClock;
import android.provider.Settings;
import android.util.ArrayMap;
import android.graphics.Outline;
import android.graphics.Rect;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
@@ -36,6 +39,7 @@ import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityEvent;
import android.widget.FrameLayout;

import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.ExpandHelper;
import com.android.systemui.Gefingerpoken;
import com.android.systemui.R;
@@ -58,6 +62,9 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
    Rect mTmpRect = new Rect();
    int[] mTmpTwoArray = new int[2];

    private final int mHeadsUpNotificationDecay;
    private final int mMinimumDisplayTime;

    private final int mTouchSensitivityDelay;
    private final float mMaxAlpha = 1f;
    private final ArrayMap<String, Long> mSnoozedPackages;
@@ -68,6 +75,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.

    private PhoneStatusBar mBar;

    private long mLingerUntilMs;
    private long mStartTouchTime;
    private ViewGroup mContentHolder;
    private int mSnoozeLengthMs;
@@ -76,6 +84,14 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
    private NotificationData.Entry mHeadsUp;
    private int mUser;
    private String mMostRecentPackageName;
    private boolean mTouched;
    private Clock mClock;

    public static class Clock {
        public long currentTimeMillis() {
            return SystemClock.elapsedRealtime();
        }
    }

    public HeadsUpNotificationView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
@@ -89,6 +105,24 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
        mSnoozedPackages = new ArrayMap<>();
        mDefaultSnoozeLengthMs = resources.getInteger(R.integer.heads_up_default_snooze_length_ms);
        mSnoozeLengthMs = mDefaultSnoozeLengthMs;
        mMinimumDisplayTime = resources.getInteger(R.integer.heads_up_notification_minimum_time);
        mHeadsUpNotificationDecay = resources.getInteger(R.integer.heads_up_notification_decay);
        mClock = new Clock();
    }

    @VisibleForTesting
    public HeadsUpNotificationView(Context context, Clock clock, SwipeHelper swipeHelper,
            EdgeSwipeHelper edgeSwipeHelper, int headsUpNotificationDecay, int minimumDisplayTime,
            int touchSensitivityDelay, int snoozeLength) {
        super(context, null);
        mClock = clock;
        mSwipeHelper = swipeHelper;
        mEdgeSwipeHelper = edgeSwipeHelper;
        mMinimumDisplayTime = minimumDisplayTime;
        mHeadsUpNotificationDecay = headsUpNotificationDecay;
        mTouchSensitivityDelay = touchSensitivityDelay;
        mSnoozedPackages = new ArrayMap<>();
        mDefaultSnoozeLengthMs = snoozeLength;
    }

    public void updateResources() {
@@ -104,32 +138,62 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
        mBar = bar;
    }

    public PhoneStatusBar getBar() {
        return mBar;
    }

    public ViewGroup getHolder() {
        return mContentHolder;
    }

    public boolean showNotification(NotificationData.Entry headsUp) {
        if (mHeadsUp != null && headsUp != null && !mHeadsUp.key.equals(headsUp.key)) {
    /**
     * Called when posting a new notification to the heads up.
     */
    public void showNotification(NotificationData.Entry headsUp) {
        if (DEBUG) Log.v(TAG, "showNotification");
        if (mHeadsUp != null) {
            // bump any previous heads up back to the shade
            release();
            releaseImmediately();
        }
        mTouched = false;
        updateNotification(headsUp, true);
        mLingerUntilMs = mClock.currentTimeMillis() + mMinimumDisplayTime;
    }

    /**
     * Called when updating or posting a notification to the heads up.
     */
    public void updateNotification(NotificationData.Entry headsUp, boolean alert) {
        if (DEBUG) Log.v(TAG, "updateNotification");

        if (alert) {
            mBar.scheduleHeadsUpDecay(mHeadsUpNotificationDecay);
        }
        invalidate();

        if (mHeadsUp == headsUp) {
            // This is an in-place update.  Noting more to do.
            return;
        }

        mHeadsUp = headsUp;

        if (mContentHolder != null) {
            mContentHolder.removeAllViews();
        }

        if (mHeadsUp != null) {
            mMostRecentPackageName = mHeadsUp.notification.getPackageName();
            if (mHeadsUp.row != null) {  // only null in tests
                mHeadsUp.row.setSystemExpanded(true);
                mHeadsUp.row.setSensitive(false);
                mHeadsUp.row.setHeadsUp(true);
                mHeadsUp.row.setHideSensitive(
                        false, false /* animated */, 0 /* delay */, 0 /* duration */);
            if (mContentHolder == null) {
                // too soon!
                return false;
            }

            mStartTouchTime = SystemClock.elapsedRealtime() + mTouchSensitivityDelay;
            if (mContentHolder != null) {  // only null in tests and before we are attached to a window
                mContentHolder.setX(0);
                mContentHolder.setVisibility(View.VISIBLE);
                mContentHolder.setAlpha(mMaxAlpha);
@@ -137,55 +201,76 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
                sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);

                mSwipeHelper.snapChild(mContentHolder, 1f);
            mStartTouchTime = SystemClock.elapsedRealtime() + mTouchSensitivityDelay;
            }

            mHeadsUp.setInterruption();

            // 2. Animate mHeadsUpNotificationView in
            // Make sure the heads up window is open.
            mBar.scheduleHeadsUpOpen();

            // 3. Set alarm to age the notification off
            mBar.resetHeadsUpDecayTimer();
        }
        return true;
    }

    @Override
    protected void onVisibilityChanged(View changedView, int visibility) {
        super.onVisibilityChanged(changedView, visibility);
        if (changedView.getVisibility() == VISIBLE) {
            sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
    /**
     * Possibly enter the lingering state by delaying the closing of the window.
     *
     * @return true if the notification has entered the lingering state.
     */
    private boolean startLingering(boolean removed) {
        final long now = mClock.currentTimeMillis();
        if (!mTouched && mHeadsUp != null && now < mLingerUntilMs) {
            if (removed) {
                mHeadsUp = null;
            }
            mBar.scheduleHeadsUpDecay(mLingerUntilMs - now);
            return true;
        }

    public boolean isShowing(String key) {
        return mHeadsUp != null && mHeadsUp.key.equals(key);
        return false;
    }

    /** Discard the Heads Up notification. */
    public void clear() {
    /**
     * React to the removal of the notification in the heads up.
     */
    public void removeNotification(String key) {
        if (DEBUG) Log.v(TAG, "remove");
        if (mHeadsUp == null || !mHeadsUp.key.equals(key)) {
            return;
        }
        if (!startLingering(/* removed */ true)) {
            mHeadsUp = null;
        mBar.scheduleHeadsUpClose();
            releaseImmediately();
        }
    }

    /** Respond to dismissal of the Heads Up window. */
    public void dismiss() {
        if (mHeadsUp == null) return;
        if (mHeadsUp.notification.isClearable()) {
            mBar.onNotificationClear(mHeadsUp.notification);
        } else {
            release();
    /**
     * Ask for any current Heads Up notification to be pushed down into the shade.
     */
    public void release() {
        if (DEBUG) Log.v(TAG, "release");
        if (!startLingering(/* removed */ false)) {
            releaseImmediately();
        }
        mHeadsUp = null;
        mBar.scheduleHeadsUpClose();
    }

    /** Push any current Heads Up notification down into the shade. */
    public void release() {
    /**
     * Push any current Heads Up notification down into the shade.
     */
    public void releaseImmediately() {
        if (DEBUG) Log.v(TAG, "releaseImmediately");
        if (mHeadsUp != null) {
            mBar.displayNotificationFromHeadsUp(mHeadsUp.notification);
        }
        mHeadsUp = null;
        mBar.scheduleHeadsUpClose();
    }

    @Override
    protected void onVisibilityChanged(View changedView, int visibility) {
        super.onVisibilityChanged(changedView, visibility);
        if (DEBUG) Log.v(TAG, "onVisibilityChanged: " + visibility);
        if (changedView.getVisibility() == VISIBLE) {
            mStartTouchTime = mClock.currentTimeMillis() + mTouchSensitivityDelay;
            sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        }
    }

    public boolean isSnoozed(String packageName) {
@@ -206,16 +291,15 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
            mSnoozedPackages.put(snoozeKey(mMostRecentPackageName, mUser),
                    SystemClock.elapsedRealtime() + mSnoozeLengthMs);
        }
        releaseAndClose();
        releaseImmediately();
    }

    private static String snoozeKey(String packageName, int user) {
        return user + "," + packageName;
    }

    public void releaseAndClose() {
        release();
        mBar.scheduleHeadsUpClose();
    public boolean isShowing(String key) {
        return mHeadsUp != null && mHeadsUp.key.equals(key);
    }

    public NotificationData.Entry getEntry() {
@@ -248,7 +332,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
        float touchSlop = viewConfiguration.getScaledTouchSlop();
        mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, getContext());
        mSwipeHelper.setMaxSwipeProgress(mMaxAlpha);
        mEdgeSwipeHelper = new EdgeSwipeHelper(touchSlop);
        mEdgeSwipeHelper = new EdgeSwipeHelper(this, touchSlop);

        int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
        int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_max_height);
@@ -282,6 +366,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
        getViewTreeObserver().addOnComputeInternalInsetsListener(this);
    }


    @Override
    protected void onDetachedFromWindow() {
        mContext.getContentResolver().unregisterContentObserver(mSettingsObserver);
@@ -290,11 +375,13 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (DEBUG) Log.v(TAG, "onInterceptTouchEvent()");
        if (SystemClock.elapsedRealtime() < mStartTouchTime) {
        if (mClock.currentTimeMillis() < mStartTouchTime) {
            return true;
        }
        mTouched = true;
        return mEdgeSwipeHelper.onInterceptTouchEvent(ev)
                || mSwipeHelper.onInterceptTouchEvent(ev)
                || mHeadsUp == null // lingering
                || super.onInterceptTouchEvent(ev);
    }

@@ -316,12 +403,17 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        if (SystemClock.elapsedRealtime() < mStartTouchTime) {
        if (mClock.currentTimeMillis() < mStartTouchTime) {
            return false;
        }
        mBar.resetHeadsUpDecayTimer();

        final boolean wasRemoved = mHeadsUp == null;
        if (!wasRemoved) {
            mBar.scheduleHeadsUpDecay(mHeadsUpNotificationDecay);
        }
        return mEdgeSwipeHelper.onTouchEvent(ev)
                || mSwipeHelper.onTouchEvent(ev)
                || wasRemoved
                || super.onTouchEvent(ev);
    }

@@ -390,7 +482,11 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
    @Override
    public void onChildDismissed(View v) {
        Log.v(TAG, "User swiped heads up to dismiss");
        mBar.onHeadsUpDismissed();
        if (mHeadsUp != null && mHeadsUp.notification.isClearable()) {
            mBar.onNotificationClear(mHeadsUp.notification);
            mHeadsUp = null;
        }
        releaseImmediately();
    }

    @Override
@@ -448,6 +544,8 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
        pw.println("HeadsUpNotificationView state:");
        pw.print("  mTouchSensitivityDelay="); pw.println(mTouchSensitivityDelay);
        pw.print("  mSnoozeLengthMs="); pw.println(mSnoozeLengthMs);
        pw.print("  mLingerUntilMs="); pw.println(mLingerUntilMs);
        pw.print("  mTouched="); pw.println(mTouched);
        pw.print("  mMostRecentPackageName="); pw.println(mMostRecentPackageName);
        pw.print("  mStartTouchTime="); pw.println(mStartTouchTime);
        pw.print("  now="); pw.println(SystemClock.elapsedRealtime());
@@ -465,14 +563,16 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
        }
    }

    private class EdgeSwipeHelper implements Gefingerpoken {
    public static class EdgeSwipeHelper implements Gefingerpoken {
        private static final boolean DEBUG_EDGE_SWIPE = false;
        private final float mTouchSlop;
        private final HeadsUpNotificationView mHeadsUpView;
        private boolean mConsuming;
        private float mFirstY;
        private float mFirstX;

        public EdgeSwipeHelper(float touchSlop) {
        public EdgeSwipeHelper(HeadsUpNotificationView headsUpView, float touchSlop) {
            mHeadsUpView = headsUpView;
            mTouchSlop = touchSlop;
        }

@@ -492,10 +592,10 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
                    final float daX = Math.abs(ev.getX() - mFirstX);
                    final float daY = Math.abs(dY);
                    if (!mConsuming && daX < daY && daY > mTouchSlop) {
                        snooze();
                        mHeadsUpView.snooze();
                        if (dY > 0) {
                            if (DEBUG_EDGE_SWIPE) Log.d(TAG, "found an open");
                            mBar.animateExpandNotificationsPanel();
                            mHeadsUpView.getBar().animateExpandNotificationsPanel();
                        }
                        mConsuming = true;
                    }
+1 −1
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ public class TvStatusBar extends BaseStatusBar {
    }

    @Override
    public void resetHeadsUpDecayTimer() {
    public void scheduleHeadsUpDecay(long delay) {
    }

    @Override
Loading