Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 642b8d4d authored by Shunta Sato's avatar Shunta Sato Committed by Julia Reynolds
Browse files

Make RankingHelper$Record.groups thread-safe

Symptom:
System crash is happened due to NPE at RankingHelper.writeXml.

Root cause:
RankingHelper$Record.groups.values() returned null. Record.groups
is an ArrayMap and this is not thread-safe. When multiple clients
call NotificationManager#createNotificationChannelGroup and
deleteNotificationChannelGroup at a same time, Record.groups is
changed by multiple threads simultaneously. As a result, this
ArrayMap object gets broken.

Solution:
Use ConcurrentHashMap instead of ArrayMap.

Test: runtest systemui-notification, test app
Bug: 62557189
Author: Tetsutoki Shiozawa <tetsutoki.shiozawa@sony.com>
Change-Id: I2261dbd1ace4915695528595b9d14d68e5bec55d
parent d27d5d9e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.ConcurrentHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -1186,6 +1187,6 @@ public class RankingHelper implements RankingConfig {
        boolean showBadge = DEFAULT_SHOW_BADGE;

        ArrayMap<String, NotificationChannel> channels = new ArrayMap<>();
        ArrayMap<String, NotificationChannelGroup> groups = new ArrayMap<>();
        Map<String, NotificationChannelGroup> groups = new ConcurrentHashMap<>();
   }
}