use ticker text as a criterion for heads up
Bug: 13208692 Change-Id: I83831c059cb4582b16ce877af58be9fb3a5bec8d
This commit is contained in:
@@ -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";
|
||||
@@ -128,6 +129,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;
|
||||
@@ -1219,11 +1221,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()
|
||||
|
||||
@@ -312,6 +312,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) {
|
||||
@@ -358,6 +360,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user