prevent concurrency issues during LocationManager init
systemReady() was returning before the LocationManagerService was actually ready. Applications making LocationManager transactions during their startup could possibly hit a race condition with the yet-uninitialised LocationManagerService. To guarantee that LocationManagerService is actually ready before returning from systemReady(), we simply do the startup work on the thread that called systemReady(), rather than spin up a secondary thread to do the work asynchronously. LocationWorkerHandler still needs a thread to do its work on, so rather than have it run on the secondary thread that was previously used for systemReady()'s work, we create a HandlerThread for it. Additionally, LocationManagerService.init() really needed to grab lock for some of the things it was doing. I moved all of the code that could benefit from mutex protection to a single section of systemReady() and wrapped it up with a lock while I was at it. Bug: 7723944 Change-Id: I51d480e2781622c3a14769c3a2019a2407dcfd8a
Loading
Please register or sign in to comment