Update Wi-Fi configs restrictions
* Update isNetworkLockedDown in WifiUtils to check the profile owner if the device is an organization-owned managed profile device. * Update the logic to check if a Wi-Fi network can be forgotten (for both the device owner and profile owner of an organization-owned device). Bug: 150197944 Bug: 153605361 Test: manual testing make RunSettingsRoboTests -j ROBOTEST_FILTER=WifiDetailPreferenceController2Test make RunSettingsRoboTests -j ROBOTEST_FILTER=WifiUtilsTest Manual Testing Steps A. Provision TestDPC in 'Device Owner' mode. - Create a Wi-Fi config in TestDPC. - Enable 'DO created Wi-Fi configs are modifiable only by DO'. - Go to Settings and verify that the network created cannot be modified and the 'Forget' button is not displayed. B. Provision TestDPC in 'Profile Owner of an organization-owned managed profile' mode. - Create a Wi-Fi config in the work profile instance of TestDPC. - Enable 'DO created Wi-Fi configs are modifiable only by DO'. - Go to Settings and verify that the network created cannot be modified and the 'Forget' button is not displayed. C. Provision CtsVerifier in 'Device Owner' mode. - Go to 'Device owner tests' > 'Wifi configuration lockdown'. - Create a Wi-Fi config then follow the instructions. Change-Id: Ie3c71113441a3aca62563310ad0e53d89fa04226
This commit is contained in:
@@ -491,7 +491,7 @@ public class WifiSettings2 extends RestrictedSettingsFragment
|
||||
|
||||
// "forget" for normal saved network. And "disconnect" for ephemeral network because it
|
||||
// could only be disconnected and be put in blacklists so it won't be used again.
|
||||
if (mSelectedWifiEntry.canForget()) {
|
||||
if (canForgetNetwork()) {
|
||||
menu.add(Menu.NONE, MENU_ID_FORGET, 0 /* order */, R.string.forget);
|
||||
}
|
||||
|
||||
@@ -507,6 +507,11 @@ public class WifiSettings2 extends RestrictedSettingsFragment
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canForgetNetwork() {
|
||||
return mSelectedWifiEntry.canForget() && !WifiUtils.isNetworkLockedDown(getActivity(),
|
||||
mSelectedWifiEntry.getWifiConfiguration());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
Reference in New Issue
Block a user