summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java11
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java1
2 files changed, 9 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index f09218ab9..82851b238 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -5808,12 +5808,17 @@ public class ClientModeImpl extends StateMachine {
private void broadcastWifiCredentialChanged(int wifiCredentialEventType,
WifiConfiguration config) {
Intent intent = new Intent(WifiManager.WIFI_CREDENTIAL_CHANGED_ACTION);
- if (config != null && config.SSID != null) {
+ if (config != null && config.SSID != null && mWifiPermissionsUtil.isLocationModeEnabled()) {
intent.putExtra(WifiManager.EXTRA_WIFI_CREDENTIAL_SSID, config.SSID);
}
intent.putExtra(WifiManager.EXTRA_WIFI_CREDENTIAL_EVENT_TYPE, wifiCredentialEventType);
- mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT,
- android.Manifest.permission.RECEIVE_WIFI_CREDENTIAL_CHANGE);
+ mContext.createContextAsUser(UserHandle.CURRENT, 0)
+ .sendBroadcastWithMultiplePermissions(
+ intent,
+ new String[]{
+ android.Manifest.permission.RECEIVE_WIFI_CREDENTIAL_CHANGE,
+ android.Manifest.permission.ACCESS_FINE_LOCATION,
+ });
}
void handleGsmAuthRequest(SimAuthRequestData requestData) {
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
index 58f5b1ccc..11ee5cd7c 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -521,6 +521,7 @@ public class ClientModeImplTest extends WifiBaseTest {
RssiUtilTest.RSSI_THRESHOLDS);
mResources.setInteger(R.integer.config_wifiPollRssiIntervalMilliseconds, 3000);
when(mContext.getResources()).thenReturn(mResources);
+ when(mContext.createContextAsUser(any(), anyInt())).thenReturn(mContext);
when(mFrameworkFacade.getIntegerSetting(mContext,
Settings.Global.WIFI_FREQUENCY_BAND,