@@ -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?
0 commit comments