DataConnection fix race condition due to mApnSetting
The race condition occurs when DataConnection calls clearSettings on the
DC thread while the main thread calls toStringSimple on the main thread.
DC#clearSettings sets mApnSetting to null, and toStringSimple calls
getNetworkCapabilities, which checks whether mApnSetting is null or not.
Fix the race condition by making both clearSettings and toStringSimple
synchronized, so mApnSetting will be set to null and toStringSimple will
run afterwards instead of at the same time.
Test: atest DataConnectionTest
(cherry picked from commit 1b3b48271e132ba1033500bfe53f79da02c6afc1)
(cherry picked from commit eb6f5ab90dd177963f0ce6ec0783a753743b9505)
1 file changed