summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java22
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java24
2 files changed, 22 insertions, 24 deletions
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index 5ec611aa2..30fd29514 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -72,7 +72,6 @@ import android.net.wifi.hotspot2.PasspointConfiguration;
import android.os.AsyncTask;
import android.os.BatteryStats;
import android.os.Binder;
-import android.os.Build;
import android.os.Bundle;
import android.os.HandlerThread;
import android.os.IBinder;
@@ -184,7 +183,7 @@ public class WifiServiceImpl extends IWifiManager.Stub {
*/
private AsyncChannel mClientModeImplChannel;
- private final boolean mPermissionReviewRequired;
+ private final boolean mWirelessConsentRequired;
private final FrameworkFacade mFrameworkFacade;
private WifiPermissionsUtil mWifiPermissionsUtil;
@@ -469,9 +468,8 @@ public class WifiServiceImpl extends IWifiManager.Stub {
mWifiController = mWifiInjector.getWifiController();
mWifiBackupRestore = mWifiInjector.getWifiBackupRestore();
mWifiApConfigStore = mWifiInjector.getWifiApConfigStore();
- mPermissionReviewRequired = Build.PERMISSIONS_REVIEW_REQUIRED
- || context.getResources().getBoolean(
- com.android.internal.R.bool.config_permissionReviewRequired);
+ mWirelessConsentRequired = context.getResources().getBoolean(
+ com.android.internal.R.bool.config_wirelessConsentRequired);
mWifiPermissionsUtil = mWifiInjector.getWifiPermissionsUtil();
mLog = mWifiInjector.makeLog(TAG);
mFrameworkFacade = wifiInjector.getFrameworkFacade();
@@ -779,20 +777,20 @@ public class WifiServiceImpl extends IWifiManager.Stub {
/**
* Check if the caller must still pass permission check or if the caller is exempted
- * from the consent UI via the MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED check.
+ * from the consent UI via the MANAGE_WIFI_WHEN_WIRELESS_CONSENT_REQUIRED check.
*
* Commands from some callers may be exempted from triggering the consent UI when
- * enabling wifi. This exemption is checked via the MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED
+ * enabling wifi. This exemption is checked via the MANAGE_WIFI_WHEN_WIRELESS_CONSENT_REQUIRED
* and allows calls to skip the consent UI where it may otherwise be required.
*
* @hide
*/
- private boolean checkWifiPermissionWhenPermissionReviewRequired() {
- if (!mPermissionReviewRequired) {
+ private boolean checkWifiPermissionWhenWirelessConsentRequired() {
+ if (!mWirelessConsentRequired) {
return false;
}
int result = mContext.checkCallingPermission(
- android.Manifest.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED);
+ android.Manifest.permission.MANAGE_WIFI_WHEN_WIRELESS_CONSENT_REQUIRED);
return result == PackageManager.PERMISSION_GRANTED;
}
@@ -846,7 +844,7 @@ public class WifiServiceImpl extends IWifiManager.Stub {
}
- if (mPermissionReviewRequired) {
+ if (mWirelessConsentRequired) {
final int wiFiEnabledState = getWifiEnabledState();
if (enable) {
if (wiFiEnabledState == WifiManager.WIFI_STATE_DISABLING
@@ -2430,7 +2428,7 @@ public class WifiServiceImpl extends IWifiManager.Stub {
private boolean startConsentUi(String packageName,
int callingUid, String intentAction) throws RemoteException {
if (UserHandle.getAppId(callingUid) == Process.SYSTEM_UID
- || checkWifiPermissionWhenPermissionReviewRequired()) {
+ || checkWifiPermissionWhenWirelessConsentRequired()) {
return false;
}
try {
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
index f96c6943d..addaf354b 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
@@ -549,7 +549,7 @@ public class WifiServiceImplTest {
when(mSettingsStore.handleWifiToggled(eq(true))).thenReturn(true);
when(mSettingsStore.isAirplaneModeOn()).thenReturn(false);
when(mContext.checkCallingPermission(
- eq(android.Manifest.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED)))
+ eq(android.Manifest.permission.MANAGE_WIFI_WHEN_WIRELESS_CONSENT_REQUIRED)))
.thenReturn(PackageManager.PERMISSION_GRANTED);
assertTrue(mWifiServiceImpl.setWifiEnabled(TEST_PACKAGE_NAME, true));
@@ -569,7 +569,7 @@ public class WifiServiceImplTest {
when(mSettingsStore.handleWifiToggled(eq(true))).thenReturn(true);
when(mSettingsStore.isAirplaneModeOn()).thenReturn(false);
when(mContext.checkCallingPermission(
- eq(android.Manifest.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED)))
+ eq(android.Manifest.permission.MANAGE_WIFI_WHEN_WIRELESS_CONSENT_REQUIRED)))
.thenReturn(PackageManager.PERMISSION_DENIED);
when(mPackageManager.getApplicationInfoAsUser(
anyString(), anyInt(), anyInt()))
@@ -619,7 +619,7 @@ public class WifiServiceImplTest {
when(mSettingsStore.handleWifiToggled(eq(true))).thenReturn(true);
when(mSettingsStore.isAirplaneModeOn()).thenReturn(false);
when(mContext.checkCallingPermission(
- eq(android.Manifest.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED)))
+ eq(android.Manifest.permission.MANAGE_WIFI_WHEN_WIRELESS_CONSENT_REQUIRED)))
.thenReturn(PackageManager.PERMISSION_DENIED);
when(mPackageManager.getApplicationInfoAsUser(
anyString(), anyInt(), anyInt()))
@@ -675,8 +675,8 @@ public class WifiServiceImplTest {
}
/**
- * Verify that wifi can be disabled without consent UI popup when permission
- * review is required but got permission granted.
+ * Verify that wifi can be disabled without consent UI popup when wireless
+ * consnet is required but got permission granted.
*/
@Test
public void testSetWifiDisabledSuccessWhenPermissionReviewRequiredAndPermissionGranted()
@@ -688,7 +688,7 @@ public class WifiServiceImplTest {
when(mSettingsStore.isAirplaneModeOn()).thenReturn(false);
when(mClientModeImpl.syncGetWifiState()).thenReturn(WIFI_STATE_ENABLED);
when(mContext.checkCallingPermission(
- eq(android.Manifest.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED)))
+ eq(android.Manifest.permission.MANAGE_WIFI_WHEN_WIRELESS_CONSENT_REQUIRED)))
.thenReturn(PackageManager.PERMISSION_GRANTED);
assertTrue(mWifiServiceImpl.setWifiEnabled(TEST_PACKAGE_NAME, false));
@@ -696,11 +696,11 @@ public class WifiServiceImplTest {
}
/**
- * Verify that wifi is not disabled but got consent UI popup when permission
- * review is required but do not have permission.
+ * Verify that wifi is not disabled but got consent UI popup when wireless
+ * consent is required but do not have permission.
*/
@Test
- public void testSetWifiDisabledConsentUiWhenPermissionReviewRequiredAndPermissionDenied()
+ public void testSetWifiDisabledConsentUiWhenPermissionDenied()
throws Exception {
// Set PermissionReviewRequired to true explicitly
when(mResources.getBoolean(anyInt())).thenReturn(true);
@@ -709,7 +709,7 @@ public class WifiServiceImplTest {
when(mSettingsStore.isAirplaneModeOn()).thenReturn(false);
when(mClientModeImpl.syncGetWifiState()).thenReturn(WIFI_STATE_ENABLED);
when(mContext.checkCallingPermission(
- eq(android.Manifest.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED)))
+ eq(android.Manifest.permission.MANAGE_WIFI_WHEN_WIRELESS_CONSENT_REQUIRED)))
.thenReturn(PackageManager.PERMISSION_DENIED);
when(mPackageManager.getApplicationInfoAsUser(
anyString(), anyInt(), anyInt()))
@@ -740,7 +740,7 @@ public class WifiServiceImplTest {
when(mSettingsStore.isAirplaneModeOn()).thenReturn(false);
when(mClientModeImpl.syncGetWifiState()).thenReturn(WIFI_STATE_ENABLED);
when(mContext.checkCallingPermission(
- eq(android.Manifest.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED)))
+ eq(android.Manifest.permission.MANAGE_WIFI_WHEN_WIRELESS_CONSENT_REQUIRED)))
.thenReturn(PackageManager.PERMISSION_GRANTED);
assertTrue(mWifiServiceImpl.setWifiEnabled(TEST_PACKAGE_NAME, false));
@@ -763,7 +763,7 @@ public class WifiServiceImplTest {
when(mSettingsStore.isAirplaneModeOn()).thenReturn(false);
when(mClientModeImpl.syncGetWifiState()).thenReturn(WIFI_STATE_ENABLED);
when(mContext.checkCallingPermission(
- eq(android.Manifest.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED)))
+ eq(android.Manifest.permission.MANAGE_WIFI_WHEN_WIRELESS_CONSENT_REQUIRED)))
.thenReturn(PackageManager.PERMISSION_DENIED);
when(mPackageManager.getApplicationInfoAsUser(
anyString(), anyInt(), anyInt()))