Merge "Fix pref availability for search" into nyc-dev

am: 8eaa3de931

* commit '8eaa3de9317eb21855db43ed276b90ca48ad1d28':
  Fix pref availability for search

Change-Id: I777450a2531d9c817d6ff76068b6ac7c02fcb782
This commit is contained in:
Jason Monk
2016-05-27 17:09:56 +00:00
committed by android-build-merger

View File

@@ -53,6 +53,7 @@ import android.os.Handler;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.os.IBinder; import android.os.IBinder;
import android.os.INetworkManagementService; import android.os.INetworkManagementService;
import android.os.Looper;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.os.UserHandle; import android.os.UserHandle;
@@ -1071,18 +1072,15 @@ public final class Utils extends com.android.settingslib.Utils {
} }
public static List<String> getNonIndexable(int xml, Context context) { public static List<String> getNonIndexable(int xml, Context context) {
HandlerThread thread = new HandlerThread("Index_" + xml); if (Looper.myLooper() == null) {
thread.start(); // Hack to make sure Preferences can initialize. Prefs expect a looper, but
// don't actually use it for the basic stuff here.
Looper.prepare();
}
final List<String> ret = new ArrayList<>(); final List<String> ret = new ArrayList<>();
new Handler(thread.getLooper()).post(new Runnable() { PreferenceManager manager = new PreferenceManager(context);
@Override PreferenceScreen screen = manager.inflateFromResource(context, xml, null);
public void run() { checkPrefs(screen, ret);
PreferenceManager manager = new PreferenceManager(context);
PreferenceScreen screen = manager.inflateFromResource(context, xml, null);
checkPrefs(screen, ret);
}
});
thread.quitSafely();
return ret; return ret;
} }