Prevent Android from causing AndroidSyncSettings use on background thread
AndroidSyncSettings registers a listener that is called by the Android system on a background thread. Before this CL, the listener directly modified the state of the class when notified. Because AndroidSyncSettings is also used from another thread (UI), this required it to be implemented in a thread-safe manner. In this CL, we modify the listener to rather post the update to the UI thread, one step towards having this class be used from a single thread. As a bonus, objects that in turn observe AndroidSyncSettings will now only be notified on the UI thread, which solves the linked bug. Cleaning up the observers so they don't post to the UI thread themselves is left for the next CL. We also take the time to brush up MockSyncContentResolverDelegate, namely simplify its notification logic and use a global lock for the class. Bug: 1028568 Change-Id: Iac820125bc37796eade94b503b8e0983b171108f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2415150Reviewed-by:Friedrich [CET] <fhorschig@chromium.org> Reviewed-by:
Marc Treib <treib@chromium.org> Commit-Queue: Victor Vianna <victorvianna@google.com> Cr-Commit-Position: refs/heads/master@{#808289}
Showing
This diff is collapsed.
Please register or sign in to comment