diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 73b9639498ee5..769bdf1c9ea02 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -4865,6 +4865,12 @@ public boolean validate(String value) { */ public static final String HEADS_UP_SNOOZE_LENGTH_MS = "heads_up_snooze_length_ms"; + /** + * Force heads up in all applications + * @hide + */ + public static final String HEADS_UP_FORCE_ALL = "heads_up_force_all"; + /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 25fa4d418c7f8..b44d8277a5c06 100755 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -197,6 +197,7 @@ public abstract class BaseStatusBar extends SystemUI implements // for heads up notifications protected HeadsUpManager mHeadsUpManager; + protected boolean mForceAllHeads; protected int mCurrentUserId = 0; final protected SparseArray mCurrentProfiles = new SparseArray(); @@ -365,6 +366,8 @@ public void observe() { CMSettings.System.HEADS_UP_BLACKLIST_VALUES), false, this); resolver.registerContentObserver(CMSettings.System.getUriFor( CMSettings.System.HEADS_UP_WHITELIST_VALUES), false, this); + resolver.registerContentObserver(Settings.System.getUriFor( + Settings.System.HEADS_UP_FORCE_ALL), false, this, UserHandle.USER_ALL); update(); } @@ -382,6 +385,8 @@ private void update() { CMSettings.System.HEADS_UP_BLACKLIST_VALUES); final String whiteString = CMSettings.System.getString(resolver, CMSettings.System.HEADS_UP_WHITELIST_VALUES); + mForceAllHeads = Settings.System.getIntForUser(resolver, + Settings.System.HEADS_UP_FORCE_ALL, 0, UserHandle.USER_CURRENT) == 1; splitAndAddToArrayList(mDndList, dndString, "\\|"); splitAndAddToArrayList(mBlacklist, blackString, "\\|"); splitAndAddToArrayList(mWhitelist, whiteString, "\\|"); @@ -2480,7 +2485,7 @@ protected boolean shouldInterrupt(Entry entry, StatusBarNotification sbn) { Notification notification = sbn.getNotification(); // some predicates to make the boolean logic legible - boolean whiteListed = isPackageWhitelisted(sbn.getPackageName()); + boolean whiteListed = mForceAllHeads || isPackageWhitelisted(sbn.getPackageName()); boolean isNoisy = (notification.defaults & Notification.DEFAULT_SOUND) != 0 || (notification.defaults & Notification.DEFAULT_VIBRATE) != 0 || notification.sound != null