Use a one-off thread to load launch params
It isn't possible to reuse LazyTaskWriterThread in PersisterQueue.
Code in that thread needs to obtain the WM lock, while it is possible
for getLaunchParams() to wait for the loading task with the WM lock held
in a different thread. That's a recipe for deadlocks.
It is also unsafe to use other shared background threads, because we
don't control what they do in them either.
That means we have to use a new thread to load launch params. There are
two options in front of us:
1. Create a thread every time we need to load launch params, and tear it
down after the loading is done.
2. Introduce a long-standing thread to load launch params. In this case
it is also optional to move all writing of launch params to this
thread.
I chose #1 because I don't think loading launch params is frequent
enough to introduce a new long-standing thread in system_server.
Bug: 365983567
Test: atest LaunchParamsPersisterTests
Test: Settings launches at correct location after reboot.
Flag: EXEMPT bug fix
Change-Id: I613ba79b03db1b6ec25596d5a0cdbf03d65ce9d9
2 files changed