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:
@@ -20,7 +20,7 @@ import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
@@ -60,7 +60,7 @@ public class WifiNonPersistentMacRandomizationPreferenceController
|
||||
NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, 0) == 1) {
|
||||
enabled = true;
|
||||
}
|
||||
((SwitchPreference) mPreference).setChecked(enabled);
|
||||
((TwoStatePreference) mPreference).setChecked(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,6 +68,6 @@ public class WifiNonPersistentMacRandomizationPreferenceController
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
NON_PERSISTENT_MAC_RANDOMIZATION_FEATURE_FLAG, 0);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
((TwoStatePreference) mPreference).setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user