Fix the Wi-Fi detailed settings un-editable issue.
- The WifiEntry info might not be ready in early stage. (ex: WifiEntry#canSetPrivacy()) - The Wi-Fi detailed setting listens to the WifiEntry callback to refresh the preferences, it should first update the preference status to be editable or not, and then display preferences to the UI. - The privicy preference should be able to set back to selectable when WifiEntry#canSetPrivicy() change from false to true. Bug: 170148009 Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiNetworkDetailsFragment2Test make RunSettingsRoboTests ROBOTEST_FILTER=WifiPrivacyPreferenceController2Test Change-Id: I48ca060e6b468232f19c82e9de0ce4fce39cba7f Merged-In: I567b2b80163631a01d165c0ac5c0aba392e014ef
This commit is contained in:
@@ -69,12 +69,13 @@ public class WifiPrivacyPreferenceController2 extends BasePreferenceController i
|
||||
public void updateState(Preference preference) {
|
||||
final DropDownPreference dropDownPreference = (DropDownPreference) preference;
|
||||
final int randomizationLevel = getRandomizationValue();
|
||||
final boolean isSelectable = mWifiEntry.canSetPrivacy();
|
||||
preference.setSelectable(isSelectable);
|
||||
dropDownPreference.setValue(Integer.toString(randomizationLevel));
|
||||
updateSummary(dropDownPreference, randomizationLevel);
|
||||
|
||||
// Makes preference not selectable, when this is a ephemeral network.
|
||||
if (!mWifiEntry.canSetPrivacy()) {
|
||||
preference.setSelectable(false);
|
||||
// If the preference cannot be selectable, display a temporary network in the summary.
|
||||
if (!isSelectable) {
|
||||
dropDownPreference.setSummary(R.string.wifi_privacy_settings_ephemeral_summary);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user