Skip to content

Commit d8d6868

Browse files
committed
No longer need synchronizing for housekeeping
1 parent eace63a commit d8d6868

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

com.unity.mobile.notifications/Runtime/Android/Plugins/com/unity/androidnotifications/UnityNotificationManager.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public class UnityNotificationManager extends BroadcastReceiver {
4040
private static HashMap<Integer, Notification> mScheduledNotifications = new HashMap();
4141
private static HashSet<Integer> mVisibleNotifications = new HashSet<>();
4242
private static int mSentSinceLastHousekeeping = 0;
43-
private static boolean mPerformingHousekeeping = false;
4443

4544
public Context mContext = null;
4645
protected Activity mActivity = null;
@@ -393,25 +392,7 @@ private static synchronized void triggerHousekeeping(Context context, Set<String
393392
final Set<String> notificationIds = ids;
394393
if (mUnityNotificationManager != null) {
395394
mUnityNotificationManager.mBackgroundThread.enqueueTask(() -> {
396-
try {
397-
// when scheduling lots of notifications at once we can have more than one housekeeping thread running
398-
// synchronize them and chain to happen one after the other
399-
synchronized (UnityNotificationManager.class) {
400-
while (mPerformingHousekeeping) {
401-
UnityNotificationManager.class.wait();
402-
}
403-
mPerformingHousekeeping = true;
404-
}
405-
406-
performNotificationHousekeeping(context, notificationIds);
407-
} catch (InterruptedException e) {
408-
Log.e(TAG_UNITY, "Notification housekeeping interrupted");
409-
} finally {
410-
synchronized (UnityNotificationManager.class) {
411-
mPerformingHousekeeping = false;
412-
UnityNotificationManager.class.notify();
413-
}
414-
}
395+
performNotificationHousekeeping(context, notificationIds);
415396
});
416397
}
417398
}

0 commit comments

Comments
 (0)