Revert "Prevent restricted user from adding network through camera"
This reverts commit e48fe67ee491d7eb818ae66cf566642f0710f54b.
Reason for revert: see b/240986110, the generated CL caused duplicated CL and tests.
Change-Id: I191edde1875bbad561c0d6c9b5d63bcfc479c860
(cherry picked from commit 21cb00a6b58a09f66ed259130083974b395d0ea6)
Merged-In: I191edde1875bbad561c0d6c9b5d63bcfc479c860
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/service/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
index 1d5eaaf..019e689 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
@@ -6311,64 +6311,6 @@
}
/**
- * Verify that add or update networks is not allowed for camera app when
- * DISALLOW_CONFIG_WIFI user restriction is set.
- */
- @Test
- public void testAddOrUpdateNetworkIsNotAllowedForCameraDisallowConfigWifi() throws Exception {
- doReturn(AppOpsManager.MODE_ALLOWED).when(mAppOpsManager)
- .noteOp(AppOpsManager.OPSTR_CHANGE_WIFI_STATE, Process.myUid(), TEST_PACKAGE_NAME);
- when(mWifiPermissionsUtil.isSystem(anyString(), anyInt())).thenReturn(true);
- when(mWifiPermissionsUtil.checkCameraPermission(Binder.getCallingUid())).thenReturn(true);
- when(mWifiPermissionsUtil.isAdmin(Binder.getCallingUid(), TEST_PACKAGE_NAME))
- .thenReturn(false);
- when(mWifiConfigManager.addOrUpdateNetwork(any(), anyInt(), any(), eq(false))).thenReturn(
- new NetworkUpdateResult(0));
- when(mUserManager.hasUserRestrictionForUser(eq(UserManager.DISALLOW_CONFIG_WIFI),
- any())).thenReturn(true);
-
- WifiConfiguration config = WifiConfigurationTestUtil.createOpenNetwork();
- mLooper.startAutoDispatch();
- assertEquals(-1,
- mWifiServiceImpl.addOrUpdateNetwork(config, TEST_PACKAGE_NAME, mAttribution));
- mLooper.stopAutoDispatchAndIgnoreExceptions();
-
- verifyCheckChangePermission(TEST_PACKAGE_NAME);
- verify(mWifiConfigManager, never()).addOrUpdateNetwork(any(), anyInt(), any(), eq(false));
- verify(mWifiMetrics, never()).incrementNumAddOrUpdateNetworkCalls();
- }
-
- /**
- * Verify that add or update networks is not allowed for camera app when
- * DISALLOW_ADD_WIFI_CONFIG user restriction is set.
- */
- @Test
- public void testAddOrUpdateNetworkIsNotAllowedForCameraDisallowAddWifiConfig()
- throws Exception {
- assumeTrue(SdkLevel.isAtLeastT());
- doReturn(AppOpsManager.MODE_ALLOWED).when(mAppOpsManager)
- .noteOp(AppOpsManager.OPSTR_CHANGE_WIFI_STATE, Process.myUid(), TEST_PACKAGE_NAME);
- when(mWifiPermissionsUtil.isSystem(anyString(), anyInt())).thenReturn(true);
- when(mWifiPermissionsUtil.checkCameraPermission(Binder.getCallingUid())).thenReturn(true);
- when(mWifiPermissionsUtil.isAdmin(Binder.getCallingUid(), TEST_PACKAGE_NAME))
- .thenReturn(false);
- when(mWifiConfigManager.addOrUpdateNetwork(any(), anyInt(), any(), eq(false))).thenReturn(
- new NetworkUpdateResult(0));
- when(mUserManager.hasUserRestrictionForUser(eq(UserManager.DISALLOW_ADD_WIFI_CONFIG),
- any())).thenReturn(true);
-
- WifiConfiguration config = WifiConfigurationTestUtil.createOpenNetwork();
- mLooper.startAutoDispatch();
- assertEquals(-1,
- mWifiServiceImpl.addOrUpdateNetwork(config, TEST_PACKAGE_NAME, mAttribution));
- mLooper.stopAutoDispatchAndIgnoreExceptions();
-
- verifyCheckChangePermission(TEST_PACKAGE_NAME);
- verify(mWifiConfigManager, never()).addOrUpdateNetwork(any(), anyInt(), any(), eq(false));
- verify(mWifiMetrics, never()).incrementNumAddOrUpdateNetworkCalls();
- }
-
- /**
* Verify that add or update networks is allowed for settings app.
*/
@Test