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
diff --git a/src/com/android/settings/display/PeakRefreshRatePreferenceController.java b/src/com/android/settings/display/PeakRefreshRatePreferenceController.java
index 091ae32..10cab1c 100644
--- a/src/com/android/settings/display/PeakRefreshRatePreferenceController.java
+++ b/src/com/android/settings/display/PeakRefreshRatePreferenceController.java
@@ -27,7 +27,6 @@
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
import com.android.settings.R;
import com.android.settings.core.TogglePreferenceController;
@@ -45,7 +44,6 @@
@VisibleForTesting float mPeakRefreshRate;
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 final Handler mHandler;
@@ -59,7 +57,7 @@
public PeakRefreshRatePreferenceController(Context context, String key) {
super(context, key);
- mHandler = new Handler();
+ mHandler = new Handler(context.getMainLooper());
mDeviceConfigDisplaySettings = new DeviceConfigDisplaySettings();
mOnDeviceConfigChange =
new IDeviceConfigChange() {