Remove unnecessary notification tracking

we don't need this whatsoever. We only play animations when the
notification is posted, and that's all we ever do. Animating all the
time while notifications are there is only annoying.
This commit is contained in:
Peter Cai 2023-04-29 11:25:08 -04:00
parent 635ed267bb
commit 883ace4eb2

View file

@ -39,7 +39,6 @@ public class NotificationService extends NotificationListenerService {
private static final String TAG = "SpotlightNotification";
private static final boolean DEBUG = true;
private ArrayList<Integer> mNotifications = new ArrayList<>();
private AnimationManager mAnimationManager;
@Override
@ -87,19 +86,7 @@ public class NotificationService extends NotificationListenerService {
&& !Arrays.asList(Constants.APPSTOIGNORE).contains(packageName)
&& !Arrays.asList(Constants.NOTIFSTOIGNORE).contains(packageName + ":" + packageChannelID)
&& (packageImportance >= NotificationManager.IMPORTANCE_DEFAULT || packageImportance == -1)) {
mNotifications.add(sbn.getId());
mAnimationManager.playNotifications();
}
}
@Override
public void onNotificationRemoved(StatusBarNotification sbn){
if (DEBUG) Log.d(TAG, "onNotificationRemoved: package:" + sbn.getPackageName() + " | channel id: " + sbn.getNotification().getChannelId() + " | id: " + sbn.getId());
if (mNotifications.contains(sbn.getId())) {
mNotifications.remove((Integer) sbn.getId());
}
if (mNotifications.isEmpty()) {
mAnimationManager.stopNotifications();
}
}
}