Fix the bug of showing the "Smooth display" item in the search result.
The controller can't be created when Settings Search gets the non-indexable keys. So Settings Search can't get the correct value from it. The controller creates the Handler without the parameter in constructor and causes the exception. It should use the main Looper of Context as the parameter to create the Handler. Fixes: 160179400 Test: run robotest and observe the search result Change-Id: I6f9bf6de087ae776e8d531ff59d28966aee96b7b
This commit is contained in:
@@ -27,7 +27,6 @@ import android.view.Display;
|
|||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceScreen;
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.preference.SwitchPreference;
|
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.TogglePreferenceController;
|
import com.android.settings.core.TogglePreferenceController;
|
||||||
@@ -45,7 +44,6 @@ public class PeakRefreshRatePreferenceController extends TogglePreferenceControl
|
|||||||
@VisibleForTesting float mPeakRefreshRate;
|
@VisibleForTesting float mPeakRefreshRate;
|
||||||
|
|
||||||
private static final String TAG = "RefreshRatePrefCtr";
|
private static final String TAG = "RefreshRatePrefCtr";
|
||||||
private static final String KEY_PEAK_REFRESH_RATE_DEFAULT = "peak_refresh_rate_default";
|
|
||||||
private static final float INVALIDATE_REFRESH_RATE = -1f;
|
private static final float INVALIDATE_REFRESH_RATE = -1f;
|
||||||
|
|
||||||
private final Handler mHandler;
|
private final Handler mHandler;
|
||||||
@@ -59,7 +57,7 @@ public class PeakRefreshRatePreferenceController extends TogglePreferenceControl
|
|||||||
|
|
||||||
public PeakRefreshRatePreferenceController(Context context, String key) {
|
public PeakRefreshRatePreferenceController(Context context, String key) {
|
||||||
super(context, key);
|
super(context, key);
|
||||||
mHandler = new Handler();
|
mHandler = new Handler(context.getMainLooper());
|
||||||
mDeviceConfigDisplaySettings = new DeviceConfigDisplaySettings();
|
mDeviceConfigDisplaySettings = new DeviceConfigDisplaySettings();
|
||||||
mOnDeviceConfigChange =
|
mOnDeviceConfigChange =
|
||||||
new IDeviceConfigChange() {
|
new IDeviceConfigChange() {
|
||||||
|
Reference in New Issue
Block a user