Fix a race between requesting/loading/writing SharedPreferences.

Part of the race existed before, but it was made much worse with
apply().

Corresponding CTS test is Icc6e638a6a

Change-Id: Ic5cfa467fb7f1859cb7b44d417412219c0621965
1 file changed