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

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

Merge "use ticker text as a criterion for heads up"

parents 1489b09b 22ae46ef
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ public abstract class BaseStatusBar extends SystemUI implements
    // scores above this threshold should be displayed in heads up mode.
    protected static final int INTERRUPTION_THRESHOLD = 11;
    protected static final String SETTING_HEADS_UP = "heads_up_enabled";
    protected static final String SETTING_HEADS_UP_TICKER = "ticker_gets_heads_up";

    // Should match the value in PhoneWindowManager
    public static final String SYSTEM_DIALOG_REASON_RECENT_APPS = "recentapps";
@@ -131,6 +132,7 @@ public abstract class BaseStatusBar extends SystemUI implements
    protected int mLayoutDirection = -1; // invalid
    private Locale mLocale;
    protected boolean mUseHeadsUp = false;
    protected boolean mHeadsUpTicker = false;

    protected IDreamManager mDreamManager;
    PowerManager mPowerManager;
@@ -1261,11 +1263,12 @@ public abstract class BaseStatusBar extends SystemUI implements
                || notification.vibrate != null;
        boolean isHighPriority = sbn.getScore() >= INTERRUPTION_THRESHOLD;
        boolean isFullscreen = notification.fullScreenIntent != null;
        boolean hasTicker = mHeadsUpTicker && !TextUtils.isEmpty(notification.tickerText);
        boolean isAllowed = notification.extras.getInt(Notification.EXTRA_AS_HEADS_UP,
                Notification.HEADS_UP_ALLOWED) != Notification.HEADS_UP_NEVER;

        final KeyguardTouchDelegate keyguard = KeyguardTouchDelegate.getInstance(mContext);
        boolean interrupt = (isFullscreen || (isHighPriority && isNoisy))
        boolean interrupt = (isFullscreen || (isHighPriority && (isNoisy || hasTicker)))
                && isAllowed
                && mPowerManager.isScreenOn()
                && !keyguard.isShowingAndNotHidden()
+5 −0
Original line number Diff line number Diff line
@@ -314,6 +314,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
            boolean wasUsing = mUseHeadsUp;
            mUseHeadsUp = ENABLE_HEADS_UP && 0 != Settings.Global.getInt(
                    mContext.getContentResolver(), SETTING_HEADS_UP, 0);
            mHeadsUpTicker = mUseHeadsUp && 0 != Settings.Global.getInt(
                    mContext.getContentResolver(), SETTING_HEADS_UP_TICKER, 0);
            Log.d(TAG, "heads up is " + (mUseHeadsUp ? "enabled" : "disabled"));
            if (wasUsing != mUseHeadsUp) {
                if (!mUseHeadsUp) {
@@ -375,6 +377,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
            mContext.getContentResolver().registerContentObserver(
                    Settings.Global.getUriFor(SETTING_HEADS_UP), true,
                    mHeadsUpObserver);
            mContext.getContentResolver().registerContentObserver(
                    Settings.Global.getUriFor(SETTING_HEADS_UP_TICKER), true,
                    mHeadsUpObserver);
        }
    }