Make NotificationDataManager thread safe.

Adding synchronize blocks when accessing internal list and maps
for write and read operation.
Simplified copying of visible notifications.

Test: atest CarNotificationUnitTests
Bug: 291870877
bug: 296618427
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a3dd050ef122cba69070d65f6b4d3e9d2c735c99)
Merged-In: I6ae619ba3dab23ad6e3488fdb180668d8759a411
Change-Id: I6ae619ba3dab23ad6e3488fdb180668d8759a411
1 file changed