Fix race condition in PackageManager.
When Google Play installs 2 apps concurrently (e.g. personal and work profile) PackageManager can hit a race condition when connection to media container has not yet been established but the MCS_BOUND event is triggered from MCS_UNBIND. Detailed step by step scenario: 1. package1 comes in 2. INIT_COPY (initiate bind, add pending install) 3. onServiceConnected triggers (MSC_BOUND) 4. MSC_BOUND, process pending package and schedule MSC_UNBIND 5. MSC_UNBIND is triggered once the package is verified 6. service is diconnected 7. package2 comes in 8. INIT_COPY (initiate bind, add pending install) 9. MSC_UNBIND scheduled at step 4 10. MSC_UNBIND sees that there is a pending package, schedules MSC_BIND 11. MSC_BIND arrives before service is connected and we fail. Solution: do not fail if we wait for connection. Bug: 21849046 Change-Id: I39928e1efc81ba64e45c622cc08cb786801d6569
Loading
Please register or sign in to comment