Quick affordances crash fix for secondary users.
This CL fixes a few issues that are making lock screen customization and lock screen shortcuts unavailable for secondary users. The attached bug occurs because we're querying state off the main thread. The first part of the CL modifies our content provider to move its querying onto the main thread while blocking the calling thread (which is a background thread). After fixing that, several problems emerged. When we query for affordances, we iterate through each affordance configuration and check its "picker state". For the camera and flashlight affordances, this was problematic. The camera affordance had a complex dependnecy chain that ended up relying on DevicePolicyManager which was not being set until after the CoreStartable for CoreSurfacesImpl ran its start() method, which doesn't happen at all for secondary users. I worked around that issue by simplifying the use-case in the camera affordance to just directly check whether the device has camera hardware. If an admin doesn't allow it, I presume that opening the camera app will fail. The flashlight affordance triggered a broadcast to be sent for FLASHLIGHT_CHANGED. The problem is that this is a protected broadcast designed to prevent non-framework apps from sending it; which also means that our secondary user process does not have the necessary security permission to send it, causing the SystemUI process to crash. I removed the broadcast sending. This was not needed by the flashlight affordance or by the quick setting or by the smart space "turn off flashlight" link. Also, the unit test for the controller passes. Fix: 265245824 Test: unit tests still pass, some were updated to pass Test: manully verified the wallpaper picker loads and shows all affordance options for both primary and secondary users Test: manually verified that selecting any of the affordance options in wallpaper picker produces fully working experiences for the lock screen shortcuts (tested all on both primary and secondary user) Test: manually verified that flashlight toggles on and off correctly from the lock screen shortcut, smart space, and quick settings tile, for primary and secondary users alike Change-Id: Ifb2b47e7d521c67378b2c64f6f32f863319a5b5d
Loading
Please register or sign in to comment