Skip to content
Commit e6395dd7 authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Fix race condition in TileServices

TileServices#getTileWrapper created a TileServiceManager (that triggered
the binding of TileService through a Handler) and after populated the
maps with the respective tokens. As one of the keys is the
TileServiceManager, this had to do after creating it.

This created the situation that in certain cases, the binding would
happen before all the maps were populated (in particular mTokenMap but
sometimes mServices).

By decoupling the binding triggering from TileServiceManager constructor
into a separate method in TileServiceManager we can guarantee that by
the time the service is bound, the maps are populated. Also added some
guards to make sure that this method has been called and the tile has
been added.

The new method is called after populating the maps, and it would not
make sense for the TileService to be bound if the maps are not
populated.

Test: atest TileServiceMaanger TileLifecycleManager TileServicesTest
Test: atest CtsAppTestCases:android.app.cts.TileServiceTest (approx 50
times)
Test: test TileServiceTest ActiveTileServiceTest
Test: Development tiles and adding Grayscale tile work perfectly
Fixes: 124735442
Fixes: 129684780
Fixes: 130796699

Change-Id: Ie3c7277756c74551ba2e6b3e88dad4a98aeafc96
parent fad62e74
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment