Migrate to TwoStatePreference
SwitchPreference and SwitchPreferenceCompat are both TwoStatePreference. Using TwoStatePreference in Java will helps migration in the future. Bug: 306771414 Test: manual - check Settings pages Change-Id: I84e1d7b09451106797c2b23d127855c6976678ca
This commit is contained in:
@@ -21,7 +21,7 @@ import android.os.SystemProperties;
|
||||
import android.view.ThreadedRenderer;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -54,13 +54,13 @@ public class HardwareLayersUpdatesPreferenceController extends DeveloperOptionsP
|
||||
public void updateState(Preference preference) {
|
||||
final boolean isEnabled = SystemProperties.getBoolean(
|
||||
ThreadedRenderer.DEBUG_SHOW_LAYERS_UPDATES_PROPERTY, false /* default */);
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
((TwoStatePreference) mPreference).setChecked(isEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
SystemProperties.set(ThreadedRenderer.DEBUG_SHOW_LAYERS_UPDATES_PROPERTY, null);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user