Use apply method instead of commit method for SharedPreferences.

The commit method updates the SharedPreferences object in memory, then
synchronously writes to storage, which can slow things down a bit. The apply
method on the other hand updates the object in memory but then writes to
storage asynchronously, which makes the method return faster. The user notices
no difference except that it's slightly faster.

This patch switches from using commit to using apply for SharedPreferences.

Change-Id: Ib3cb39f0905f87804eafb946db06c70a965f1bb3
Merge "Use apply method instead of commit method for SharedPreferences."