Disable Mac randomization setting for Passpoint networks
Mac randomization setting should be greyed out in the network details page for Passpoint networks. Bug: 129279500 Test: atest WifiPrivacyPreferenceControllerTest Change-Id: I4fc89ddbca839c4859f11f8fad212b3e0e4aa7ce
This commit is contained in:
@@ -140,6 +140,8 @@ public class WifiNetworkDetailsFragment extends DashboardFragment {
|
||||
context);
|
||||
privacyController.setWifiConfiguration(mAccessPoint.getConfig());
|
||||
privacyController.setIsEphemeral(mAccessPoint.isEphemeral());
|
||||
privacyController.setIsPasspoint(
|
||||
mAccessPoint.isPasspoint() || mAccessPoint.isPasspointConfig());
|
||||
controllers.add(privacyController);
|
||||
|
||||
return controllers;
|
||||
|
@@ -41,6 +41,7 @@ public class WifiPrivacyPreferenceController extends BasePreferenceController im
|
||||
private WifiConfiguration mWifiConfiguration;
|
||||
private WifiManager mWifiManager;
|
||||
private boolean mIsEphemeral = false;
|
||||
private boolean mIsPasspoint = false;
|
||||
|
||||
public WifiPrivacyPreferenceController(Context context) {
|
||||
super(context, KEY_WIFI_PRIVACY);
|
||||
@@ -56,6 +57,10 @@ public class WifiPrivacyPreferenceController extends BasePreferenceController im
|
||||
mIsEphemeral = isEphemeral;
|
||||
}
|
||||
|
||||
public void setIsPasspoint(boolean isPasspoint) {
|
||||
mIsPasspoint = isPasspoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getResources().getBoolean(
|
||||
@@ -71,7 +76,7 @@ public class WifiPrivacyPreferenceController extends BasePreferenceController im
|
||||
updateSummary(dropDownPreference, randomizationLevel);
|
||||
|
||||
// Makes preference not selectable, when this is a ephemeral network.
|
||||
if (mIsEphemeral) {
|
||||
if (mIsEphemeral || mIsPasspoint) {
|
||||
preference.setSelectable(false);
|
||||
dropDownPreference.setSummary(R.string.wifi_privacy_settings_ephemeral_summary);
|
||||
}
|
||||
|
@@ -109,4 +109,20 @@ public class WifiPrivacyPreferenceControllerTest {
|
||||
|
||||
assertThat(mDropDownPreference.isSelectable()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateState_isNotPasspointNetwork_shouldBeSelectable() {
|
||||
mPreferenceController.setIsPasspoint(false);
|
||||
mPreferenceController.updateState(mDropDownPreference);
|
||||
|
||||
assertThat(mDropDownPreference.isSelectable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateState_isPasspointNetwork_shouldNotSelectable() {
|
||||
mPreferenceController.setIsPasspoint(true);
|
||||
mPreferenceController.updateState(mDropDownPreference);
|
||||
|
||||
assertThat(mDropDownPreference.isSelectable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user