Process queuedWork on main thread and add logging

- The queued work processing thread might be sleeping while the main
  thread is waiting for it to do work. Hence process the work in the main
  thread.
- Carefully add logging so that slowness can be tracked.
- Fix usage of the wrong lock (sWork instead of sLock).
- Increase the time of the delay between apply and write to make
  possible side-effects more visible

Test: SharedPrefencesTest, looked at logging
Bug: 30662828
Change-Id: Ie8a5d531e180dacec29c947ba0b59b170facf782
2 files changed