diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java index bff841b1ee5..cd6e5629c4c 100644 --- a/src/com/android/settings/search/Index.java +++ b/src/com/android/settings/search/Index.java @@ -217,20 +217,20 @@ public class Index { */ public static Index getInstance(Context context) { if (sInstance == null) { - sInstance = new Index(context.getApplicationContext(), BASE_AUTHORITY); + synchronized (Index.class) { + if (sInstance == null) { + sInstance = new Index(context.getApplicationContext(), BASE_AUTHORITY); + } + } } return sInstance; } - public Index(Context context, String baseAuthority) { + private Index(Context context, String baseAuthority) { mContext = context; mBaseAuthority = baseAuthority; } - public void setContext(Context context) { - mContext = context; - } - public boolean isAvailable() { return mIsAvailable.get(); }