Skip to content

Commit 46a1a70

Browse files
committed
Revert "HeadsUp: Add heads up blacklist options. (1/2)"
This reverts commit f147075.
1 parent 391ba00 commit 46a1a70

5 files changed

Lines changed: 21 additions & 60 deletions

File tree

core/java/android/provider/Settings.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,19 +3252,12 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
32523252
*/
32533253
public static final String HEADS_UP_NOTIFICATION = "heads_up_enabled";
32543254

3255-
/**
3256-
* Which applications to disable heads up notifications in
3257-
*
3258-
* @hide
3259-
*/
3260-
public static final String HEADS_UP_CUSTOM_VALUES = "heads_up_custom_values";
3261-
32623255
/**
32633256
* Which applications to disable heads up notifications for
32643257
*
32653258
* @hide
32663259
*/
3267-
public static final String HEADS_UP_BLACKLIST_VALUES = "heads_up_blacklist_values";
3260+
public static final String HEADS_UP_CUSTOM_VALUES = "heads_up_custom_values";
32683261

32693262
/**
32703263
* Quick Settings Panel Dynamic Tiles

packages/SettingsProvider/res/values/defaults.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,6 @@
225225
<!-- Default value of Settings.System.QUICK_SETTINGS_RIBBON_TILES -->
226226
<string name="def_quick_settings_ribbon_tiles"></string>
227227

228-
<!-- Default DnD values of Settings.System.HEADS_UP_NOTIFICATION -->
229-
<string name="def_heads_up_notification_dnd_values"></string>
230-
231-
<!-- Default Blacklist values of Settings.System.HEADS_UP_NOTIFICATION -->
232-
<string name="def_heads_up_notification_blacklist_values"></string>
228+
<!-- Default values of Settings.System.HEADS_UP_NOTIFICATION -->
229+
<string name="def_heads_up_notification_values"></string>
233230
</resources>

packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,14 +2068,11 @@ private void loadRibbonSetting(SQLiteStatement stmt) {
20682068
}
20692069

20702070
private void loadHeadsUpSetting(SQLiteStatement stmt) {
2071-
String dndValues = mContext.getResources()
2072-
.getString(R.string.def_heads_up_notification_dnd_values);
2073-
String blackListValues = mContext.getResources()
2074-
.getString(R.string.def_heads_up_notification_blacklist_values);
2075-
if (!TextUtils.isEmpty(dndValues)) {
2071+
String headsUpValues = mContext.getResources()
2072+
.getString(R.string.def_heads_up_notification_values);
2073+
if (!TextUtils.isEmpty(headsUpValues)) {
20762074
loadSetting(stmt, Settings.System.HEADS_UP_NOTIFICATION, "0");
2077-
loadSetting(stmt, Settings.System.HEADS_UP_CUSTOM_VALUES, dndValues);
2078-
loadSetting(stmt, Settings.System.HEADS_UP_BLACKLIST_VALUES, blackListValues);
2075+
loadSetting(stmt, Settings.System.HEADS_UP_CUSTOM_VALUES, headsUpValues);
20792076
}
20802077
}
20812078

packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,6 @@ public abstract class BaseStatusBar extends SystemUI implements
187187

188188
private RecentsComponent mRecents;
189189

190-
private ArrayList<String> mDndList;
191-
private ArrayList<String> mBlacklist;
192-
193190
protected int mLayoutDirection = -1; // invalid
194191
private Locale mLocale;
195192
protected boolean mUseHeadsUp = false;
@@ -245,7 +242,7 @@ public void run() {
245242
private boolean mDeviceProvisioned = false;
246243
private int mAutoCollapseBehaviour;
247244
private int mCustomRecent;
248-
protected int mExpandedDesktopStyle = 0;
245+
private int mExpandedDesktopStyle = 0;
249246

250247
final int CUSTOM_RECENT_ID = 2; // ID for custom recent current is slim
251248

@@ -317,12 +314,6 @@ public SettingsObserver(Handler handler) {
317314

318315
public void observe() {
319316
ContentResolver resolver = mContext.getContentResolver();
320-
resolver.registerContentObserver(
321-
Settings.System.getUriFor(Settings.System.HEADS_UP_CUSTOM_VALUES),
322-
false, this);
323-
resolver.registerContentObserver(
324-
Settings.System.getUriFor(Settings.System.HEADS_UP_BLACKLIST_VALUES),
325-
false, this);
326317
resolver.registerContentObserver(Settings.System.getUriFor(
327318
Settings.System.STATUS_BAR_COLLAPSE_ON_DISMISS), false, this);
328319
resolver.registerContentObserver(Settings.System.getUriFor(
@@ -351,12 +342,6 @@ private void update() {
351342
mExpandedDesktopStyle = Settings.System.getIntForUser(mContext.getContentResolver(),
352343
Settings.System.EXPANDED_DESKTOP_STYLE, 0, UserHandle.USER_CURRENT);
353344
}
354-
final String dndString = Settings.System.getString(mContext.getContentResolver(),
355-
Settings.System.HEADS_UP_CUSTOM_VALUES);
356-
final String blackString = Settings.System.getString(mContext.getContentResolver(),
357-
Settings.System.HEADS_UP_BLACKLIST_VALUES);
358-
splitAndAddToArrayList(mDndList, dndString, "\\|");
359-
splitAndAddToArrayList(mBlacklist, blackString, "\\|");
360345
}
361346
};
362347

@@ -421,9 +406,6 @@ public void start() {
421406
ServiceManager.checkService(DreamService.DREAM_SERVICE));
422407
mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
423408

424-
mDndList = new ArrayList<String>();
425-
mBlacklist = new ArrayList<String>();
426-
427409
mNotificationManager = INotificationManager.Stub.asInterface(
428410
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
429411

@@ -1772,11 +1754,6 @@ protected void notifyHeadsUpScreenOn(boolean screenOn) {
17721754
protected boolean shouldInterrupt(StatusBarNotification sbn) {
17731755
Notification notification = sbn.getNotification();
17741756

1775-
// check if notification from the package is blacklisted first
1776-
if (isPackageBlacklisted(sbn.getPackageName())) {
1777-
return false;
1778-
}
1779-
17801757
// some predicates to make the boolean logic legible
17811758
boolean isNoisy = (notification.defaults & Notification.DEFAULT_SOUND) != 0
17821759
|| (notification.defaults & Notification.DEFAULT_VIBRATE) != 0
@@ -1833,23 +1810,22 @@ private String getTopLevelPackage() {
18331810
}
18341811

18351812
private boolean isPackageInDnd(String packageName) {
1836-
return mDndList.contains(packageName);
1837-
}
1813+
final String baseString = Settings.System.getString(mContext.getContentResolver(),
1814+
Settings.System.HEADS_UP_CUSTOM_VALUES);
18381815

1839-
private boolean isPackageBlacklisted(String packageName) {
1840-
return mBlacklist.contains(packageName);
1841-
}
1842-
1843-
private void splitAndAddToArrayList(ArrayList<String> arrayList,
1844-
String baseString, String separator) {
1845-
// clear first
1846-
arrayList.clear();
18471816
if (baseString != null) {
1848-
final String[] array = TextUtils.split(baseString, separator);
1817+
final String[] array = TextUtils.split(baseString, "\\|");
18491818
for (String item : array) {
1850-
arrayList.add(item.trim());
1819+
if (TextUtils.isEmpty(item)) {
1820+
continue;
1821+
}
1822+
if (TextUtils.equals(item, packageName)) {
1823+
return true;
1824+
}
18511825
}
18521826
}
1827+
1828+
return false;
18531829
}
18541830

18551831
// Q: What kinds of notifications should show during setup?

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ public void onChange(boolean selfChange) {
708708
boolean wasUsing = mUseHeadsUp;
709709
mUseHeadsUp = ENABLE_HEADS_UP && Settings.System.getIntForUser(
710710
mContext.getContentResolver(),
711-
Settings.System.HEADS_UP_NOTIFICATION, 0, UserHandle.USER_CURRENT) == 1;
711+
Settings.System.HEADS_UP_NOTIFICATION, 0, UserHandle.USER_CURRENT) == 1;;
712712
Log.d(TAG, "heads up is " + (mUseHeadsUp ? "enabled" : "disabled"));
713713
if (wasUsing != mUseHeadsUp) {
714714
if (!mUseHeadsUp) {
@@ -1706,9 +1706,7 @@ public void resetHeadsUpDecayTimer() {
17061706

17071707
final boolean sbVisible = (mSystemUiVisibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0
17081708
|| (mStatusBarMode & View.STATUS_BAR_TRANSIENT) != 0;
1709-
final boolean userForcedExpandedDesktop =
1710-
mExpandedDesktopStyle == 1 || mExpandedDesktopStyle == 2;
1711-
if (!sbVisible && !userForcedExpandedDesktop) {
1709+
if (!sbVisible) {
17121710
mHandler.removeMessages(MSG_HIDE_HEADS_UP);
17131711
mHandler.sendEmptyMessageDelayed(MSG_HIDE_HEADS_UP, 700);
17141712
} else {

0 commit comments

Comments
 (0)