Restrict WifiDialogActivity
- Don't show WifiDialogActivity if user has DISALLOW_ADD_WIFI_CONFIG Fix: 299931761 Bug: 314867581 Flag: None Test: manual test with TestDPC atest -c SettingsRoboTests:WifiDialogActivityTest Change-Id: Icbb8f45922ded163208976be9c2816060dcf09f1
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.settings.wifi;
|
||||
|
||||
import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
|
||||
import static android.Manifest.permission.ACCESS_FINE_LOCATION;
|
||||
import static android.os.UserManager.DISALLOW_ADD_WIFI_CONFIG;
|
||||
import static android.os.UserManager.DISALLOW_CONFIG_WIFI;
|
||||
|
||||
import static com.android.settings.wifi.WifiDialogActivity.REQUEST_CODE_WIFI_DPP_ENROLLEE_QR_CODE_SCANNER;
|
||||
@@ -50,7 +51,6 @@ import com.android.wifitrackerlib.WifiEntry;
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -58,7 +58,6 @@ import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.Robolectric;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
@Ignore("b/314867581")
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class WifiDialogActivityTest {
|
||||
|
||||
@@ -242,6 +241,20 @@ public class WifiDialogActivityTest {
|
||||
assertThat(mActivity.isConfigWifiAllowed()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAddWifiConfigAllowed_hasNoUserRestriction_returnTrue() {
|
||||
when(mUserManager.hasUserRestriction(DISALLOW_ADD_WIFI_CONFIG)).thenReturn(false);
|
||||
|
||||
assertThat(mActivity.isAddWifiConfigAllowed()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAddWifiConfigAllowed_hasUserRestriction_returnFalse() {
|
||||
when(mUserManager.hasUserRestriction(DISALLOW_ADD_WIFI_CONFIG)).thenReturn(true);
|
||||
|
||||
assertThat(mActivity.isAddWifiConfigAllowed()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasPermissionForResult_noCallingPackage_returnFalse() {
|
||||
when(mActivity.getCallingPackage()).thenReturn(null);
|
||||
|
Reference in New Issue
Block a user