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

Commit 6d15a364 authored by Chris Wren's avatar Chris Wren
Browse files

use ONGOING as the signal not to auto-hide heads up

instead of INSISTENT or NO_CLEAR
required some disambiguation in places where ONGOING is already used.

Bug: 10412149
Change-Id: Iea7d698846c76a464cae511a3a8e3908b114edfe
parent e03f4e1f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -348,7 +348,8 @@ public abstract class BaseStatusBar extends SystemUI implements

    protected View updateNotificationVetoButton(View row, StatusBarNotification n) {
        View vetoButton = row.findViewById(R.id.veto);
        if (n.isClearable()) {
        if (n.isClearable() || (mInterruptingNotificationEntry != null
                && mInterruptingNotificationEntry.row == row)) {
            final String _pkg = n.getPackageName();
            final String _tag = n.getTag();
            final int _id = n.getId();
@@ -437,7 +438,6 @@ public abstract class BaseStatusBar extends SystemUI implements
    }

    public void onHeadsUpDismissed() {
        mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
    }

    @Override
+16 −14
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ import java.util.ArrayList;
public class PhoneStatusBar extends BaseStatusBar {
    static final String TAG = "PhoneStatusBar";
    public static final boolean DEBUG = BaseStatusBar.DEBUG;
    public static final boolean SPEW = DEBUG;
    public static final boolean SPEW = false;
    public static final boolean DUMPTRUCK = true; // extra dumpsys info
    public static final boolean DEBUG_GESTURES = false;

@@ -911,9 +911,9 @@ public class PhoneStatusBar extends BaseStatusBar {

    @Override
    public void resetHeadsUpDecayTimer() {
        mHandler.removeMessages(MSG_HIDE_HEADS_UP);
        if (mUseHeadsUp && mHeadsUpNotificationDecay > 0
                && !mHeadsUpNotificationView.isInsistent()) {
                && mHeadsUpNotificationView.isClearable()) {
            mHandler.removeMessages(MSG_HIDE_HEADS_UP);
            mHandler.sendEmptyMessageDelayed(MSG_HIDE_HEADS_UP, mHeadsUpNotificationDecay);
        }
    }
@@ -1066,7 +1066,7 @@ public class PhoneStatusBar extends BaseStatusBar {
        if (!mShowCarrierInPanel) return;
        // The idea here is to only show the carrier label when there is enough room to see it,
        // i.e. when there aren't enough notifications to fill the panel.
        if (DEBUG) {
        if (SPEW) {
            Log.d(TAG, String.format("pileh=%d scrollh=%d carrierh=%d",
                    mPile.getHeight(), mScrollView.getHeight(), mCarrierLabelHeight));
        }
@@ -1110,7 +1110,7 @@ public class PhoneStatusBar extends BaseStatusBar {

        final boolean clearable = any && mNotificationData.hasClearableItems();

        if (DEBUG) {
        if (SPEW) {
            Log.d(TAG, "setAreThereNotifications: N=" + mNotificationData.size()
                    + " any=" + any + " clearable=" + clearable);
        }
@@ -2295,7 +2295,7 @@ public class PhoneStatusBar extends BaseStatusBar {

    @Override
    public void updateExpandedViewPos(int thingy) {
        if (DEBUG) Log.v(TAG, "updateExpandedViewPos");
        if (SPEW) Log.v(TAG, "updateExpandedViewPos");

        // on larger devices, the notification panel is propped open a bit
        mNotificationPanel.setMinimumHeight(
@@ -2524,7 +2524,8 @@ public class PhoneStatusBar extends BaseStatusBar {

    public void onHeadsUpDismissed() {
        if (mInterruptingNotificationEntry == null) return;

        mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
        if (mHeadsUpNotificationView.isClearable()) {
            try {
                mBarService.onNotificationClear(
                        mInterruptingNotificationEntry.notification.getPackageName(),
@@ -2534,6 +2535,7 @@ public class PhoneStatusBar extends BaseStatusBar {
                // oh well
            }
        }
    }

    /**
     * Reload some of our resources when the configuration changes.
+4 −4
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.systemui.statusbar.NotificationData;
public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.Callback, ExpandHelper.Callback {
    private static final String TAG = "HeadsUpNotificationView";
    private static final boolean DEBUG = false;
    private static final boolean SPEW = DEBUG;

    Rect mTmpRect = new Rect();

@@ -88,13 +89,12 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
        return true;
    }

    public boolean isInsistent() {
        return mHeadsUp != null
                && (mHeadsUp.notification.getNotification().flags & Notification.FLAG_INSISTENT) != 0;
    public boolean isClearable() {
        return mHeadsUp == null || mHeadsUp.notification.isClearable();
    }

    public void setMargin(int notificationPanelMarginPx) {
        if (DEBUG) Log.v(TAG, "setMargin() " + notificationPanelMarginPx);
        if (SPEW) Log.v(TAG, "setMargin() " + notificationPanelMarginPx);
        if (mContentSlider != null) {
            FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mContentSlider.getLayoutParams();
            lp.setMarginStart(notificationPanelMarginPx);