Avoid accumulation of user state persist requests
This CL tackles the problem which arises that arises from frequent association changes for a given user. Until now, every association change allocates a map of previously used ids, which it holds until the current user state is written to storage. Unfortunately, frequent association changes can lead to a significant pileup of persist requests, leading to out-of-memory errors and an unresponsive system. It does not help that the requests to write out the user state are handled by the singleton background thread, which is shared across all system services. This CL does not solve this particular issue, and so it remains a future work item. This CL introduces a dedicated PersistUserStateHandler, which differs from the current handler in two ways: 1. It only ever accepts one persist request per user at a time. This prevents the aforementioned request pileup and OOM errors. 2. It reads the previously used ids and the changed associations at the time of writing out the state instead of the time of request arrival. This does not change the intended behavior, and comes with the advantage of not having to allocate Runnables. Test: atest CtsCompanionDeviceManagerCoreTestCases Test: atest CtsCompanionDeviceManagerUiAutomationTestCases Change-Id: I9aaad5a25fc4c09fcd9808a84d8ba2ce7962bfc5
Loading
Please register or sign in to comment