Fix regression in getSharedPreferences performance

Only do access checks if there's a cache miss. If there's
a cache hit then those checks have necessarily already
passed once so we don't need to repeatedly do them
on every access.

Before:
timeCachedGetSharedPreferences_mean=126084

After:
timeCachedGetSharedPreferences_mean=362

Test: ran perf test
Change-Id: I51f0186f8e66c05ea0e5a457930377d1460dea17
2 files changed