Fix adding wifi configuration issue
- The Wi-Fi Enterprise Restrictions add a new UserManager.DISALLOW_ADD_WIFI_CONFIG restriction from T. - When a user requests to add Wi-Fi configuration, Settings will reject the request if the user is not allowed. - The above restriction need to be retrieved in advance so that the user's request will not be rejected. - See the result screenshot in b/224459753#comment8 Bug: 224459753 Test: manual test make RunSettingsRoboTests ROBOTEST_FILTER=AddAppNetworksActivity Change-Id: I2dfb6b9946dd9dbd4eb8bf0f6549ac5cb4466f17
This commit is contained in:
@@ -39,15 +39,14 @@ public class AddAppNetworksActivityTest {
|
||||
@Mock
|
||||
private IActivityManager mIActivityManager;
|
||||
|
||||
private AddAppNetworksActivity mActivity;
|
||||
private FakeAddAppNetworksActivity mActivity;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
mActivity = Robolectric.buildActivity(AddAppNetworksActivity.class).create().get();
|
||||
mActivity = Robolectric.buildActivity(FakeAddAppNetworksActivity.class).create().get();
|
||||
mActivity.mActivityManager = mIActivityManager;
|
||||
mActivity.mIsAddWifiConfigAllow = true;
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -92,4 +91,13 @@ public class AddAppNetworksActivityTest {
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
private static class FakeAddAppNetworksActivity extends AddAppNetworksActivity {
|
||||
boolean mIsAddWifiConfigAllow = true;
|
||||
|
||||
@Override
|
||||
boolean isAddWifiConfigAllow() {
|
||||
return mIsAddWifiConfigAllow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user