Reland: Android: Replace ConcurrentHashMap usage with manual lock.
ConcurrentHashMap has a bug on L.
* Also adds a checkstyle check to prevent future uses.
* Also adds @AnyThread / @MainThread to all public methods
Reason for reland:
* Now synchronizing map iterators
Bug: 905903
Change-Id: Id7788a4707329a5e441cc010e1fb297668510aef
Reviewed-on: https://chromium-review.googlesource.com/c/1409725
Reviewed-by: Tibor Goldschwendt <tiborg@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#622699}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b7225829975f5a97b986f51cd4c2df74bd237271
diff --git a/checkstyle/chromium-style-5.0.xml b/checkstyle/chromium-style-5.0.xml
index 03d7bcf..cd32e9d 100644
--- a/checkstyle/chromium-style-5.0.xml
+++ b/checkstyle/chromium-style-5.0.xml
@@ -126,5 +126,12 @@
<property name="ignoreComments" value="true"/>
<property name="message" value="Use ContextUtils.getAppSharedPreferences() instead to access app-wide SharedPreferences."/>
</module>
+ <module name="RegexpSinglelineJava">
+ <property name="id" value="ConcurrentHashMapCheck"/>
+ <property name="severity" value="error"/>
+ <property name="format" value="ConcurrentHashMap"/>
+ <property name="ignoreComments" value="true"/>
+ <property name="message" value="ConcurrentHashMap has a bug on some Android versions. Use Collections.synchronizedMap() instead (crbug.com/905903)."/>
+ </module>
</module>
</module>