Allow disk writes on main thread in SharedPrefs

waitToFinish is called when the main thread enters the stopped state. At
this time we need to make sure to flush all shared preferences to the disk.

Usually this is not problem as they were asyncronously persisted. In
rare circumstances it can happen that the shared preferences are not
flushed yet.

Disk writes on main thread are quicker then waiting for the background
thread to do the write for this thread. Hence it is ok to write on the
main thread here.

Test: android.content.cts.SharedPreferencesTest
Change-Id: Ice8c0425a60005d1e4b150fa74e55e753dead6b8
1 file changed