Fix race condition crash

1 line fix
Lots of lines for test

Test: runtest systemui
Change-Id: I90b006b5d9c02025ecc600c2f10014a96cbf33f8
Fixes: 62573587
3 files changed