Use synchronize instead of Assert.isMainThread

DemoModeController tried to make sure adding callbacks always happened
on the main thread. But it's breaking some tests if it somehow gets
instantiated (lazily, by Dagger) on a background thread.

It should be fine to just use a couple of locks and call it a day, but
eventually it'd be better to fix that dagger problem...

Test: atest SystemUITests
Fixes: 170122983
Change-Id: Ieff52b268aec4194e932823353c739c1e0641acc
1 file changed