aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMakoto Onuki <omakoto@google.com>2016-05-12 22:48:20 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-05-12 22:48:20 +0000
commita342b060f643948c2491c9fd6db4ec07b9f4981c (patch)
treebe1c4ba0b87775288f746eeb6e7cfd7b27340554
parent843b77de175fe038f025e6eb33a579eff944cb36 (diff)
parent3f2a995bfc639b1b7295e98cd129f46c0d692ddc (diff)
downloadContactsProvider-a342b060f643948c2491c9fd6db4ec07b9f4981c.tar.gz
Merge "Disable strict mode check on shared preferences to avoid logspam" into nyc-dev
am: 3f2a995bfc * commit '3f2a995bfc639b1b7295e98cd129f46c0d692ddc': Disable strict mode check on shared preferences to avoid logspam Change-Id: I24bd13221e9e210416105c6c436f00f7a653443f
-rw-r--r--src/com/android/providers/contacts/FastScrollingIndexCache.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/providers/contacts/FastScrollingIndexCache.java b/src/com/android/providers/contacts/FastScrollingIndexCache.java
index 7a5d82da..99da602b 100644
--- a/src/com/android/providers/contacts/FastScrollingIndexCache.java
+++ b/src/com/android/providers/contacts/FastScrollingIndexCache.java
@@ -21,6 +21,7 @@ import android.content.SharedPreferences;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
+import android.os.StrictMode;
import android.preference.PreferenceManager;
import android.provider.ContactsContract.Contacts;
import android.text.TextUtils;
@@ -89,8 +90,13 @@ public class FastScrollingIndexCache {
public static FastScrollingIndexCache getInstance(Context context) {
if (sSingleton == null) {
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- sSingleton = new FastScrollingIndexCache(prefs);
+ final StrictMode.ThreadPolicy old = StrictMode.allowThreadDiskReads();
+ try {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ sSingleton = new FastScrollingIndexCache(prefs);
+ } finally {
+ StrictMode.setThreadPolicy(old);
+ }
}
return sSingleton;
}