Fix pref availability for search
Change-Id: Ic080e131c6c751456b22d370aade77748d912b6b Fixes: 28987828
This commit is contained in:
@@ -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;
|
||||||
@@ -1067,18 +1068,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() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
PreferenceManager manager = new PreferenceManager(context);
|
PreferenceManager manager = new PreferenceManager(context);
|
||||||
PreferenceScreen screen = manager.inflateFromResource(context, xml, null);
|
PreferenceScreen screen = manager.inflateFromResource(context, xml, null);
|
||||||
checkPrefs(screen, ret);
|
checkPrefs(screen, ret);
|
||||||
}
|
|
||||||
});
|
|
||||||
thread.quitSafely();
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user