From cc083922b9871f1ca522972f1bafc8060a55e32e Mon Sep 17 00:00:00 2001 From: Ecco Park Date: Fri, 5 Apr 2019 16:50:19 -0700 Subject: Passpoint: allow Carrier Provisioning App to remove Passpoint profile. Whenever sim is inserted/deleted, the app needs to add/remove the profiles for the carrier. Bug: 130053265 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: I3c232c7f3d6404669a0b4594f845b72710eae909 Signed-off-by: Ecco Park --- .../com/android/server/wifi/WifiServiceImplTest.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java index dff73a9a3..ca5366b30 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java @@ -2582,28 +2582,31 @@ public class WifiServiceImplTest { /** * Verify that the call to removePasspointConfiguration is not redirected to specific API - * syncRemovePasspointConfig when the caller doesn't have NETWORK_SETTINGS permission. + * syncRemovePasspointConfig when the caller doesn't have NETWORK_SETTINGS and + * NETWORK_CARRIER_PROVISIONING permission. */ @Test(expected = SecurityException.class) public void testRemovePasspointConfigurationWithOutPermissions() { - when(mContext.checkCallingOrSelfPermission( - eq(android.Manifest.permission.NETWORK_SETTINGS))).thenReturn( - PackageManager.PERMISSION_DENIED); + when(mWifiPermissionsUtil.checkNetworkSettingsPermission(anyInt())).thenReturn(false); + when(mWifiPermissionsUtil.checkNetworkCarrierProvisioningPermission(anyInt())).thenReturn( + false); mWifiServiceImpl.removePasspointConfiguration(null, null); } /** * Verify that the call to removePasspointConfiguration for apps targeting below Q SDK will - * return false if the caller doesn't have NETWORK_SETTINGS permission. + * return false if the caller doesn't have NETWORK_SETTINGS and NETWORK_CARRIER_PROVISIONING + * permission. */ @Test public void testRemovePasspointConfigurationForAppsTargetingBelowQSDK() { - when(mContext.checkCallingOrSelfPermission( - eq(android.Manifest.permission.NETWORK_SETTINGS))).thenReturn( - PackageManager.PERMISSION_DENIED); + when(mWifiPermissionsUtil.checkNetworkSettingsPermission(anyInt())).thenReturn(false); + when(mWifiPermissionsUtil.checkNetworkCarrierProvisioningPermission(anyInt())).thenReturn( + false); when(mWifiPermissionsUtil.isTargetSdkLessThan(isNull(), eq(Build.VERSION_CODES.Q))).thenReturn(true); + assertFalse(mWifiServiceImpl.removePasspointConfiguration(null, null)); } @@ -3382,6 +3385,7 @@ public class WifiServiceImplTest { when(mContext.checkPermission(eq(android.Manifest.permission.NETWORK_SETTINGS), anyInt(), anyInt())).thenReturn(PackageManager.PERMISSION_GRANTED); + when(mWifiPermissionsUtil.checkNetworkSettingsPermission(anyInt())).thenReturn(true); final String fqdn = "example.com"; WifiConfiguration network = WifiConfigurationTestUtil.createOpenNetwork(); PasspointConfiguration config = new PasspointConfiguration(); -- cgit v1.2.3