diff options
4 files changed, 12 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/AvailableNetworkNotifier.java b/service/java/com/android/server/wifi/AvailableNetworkNotifier.java index bf89bd8bf..add8e023f 100644 --- a/service/java/com/android/server/wifi/AvailableNetworkNotifier.java +++ b/service/java/com/android/server/wifi/AvailableNetworkNotifier.java @@ -260,7 +260,8 @@ public class AvailableNetworkNotifier { private boolean isControllerEnabled() { return mSettingEnabled && !UserManager.get(mContext) - .hasUserRestriction(UserManager.DISALLOW_CONFIG_WIFI, UserHandle.CURRENT); + // TODO (b/142234604): This will not work on multi-user device scenarios. + .hasUserRestriction(UserManager.DISALLOW_CONFIG_WIFI, UserHandle.CURRENT_OR_SELF); } /** diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 379aa1be6..d324a3191 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -5425,7 +5425,8 @@ public class ClientModeImpl extends StateMachine { intent.putExtra(WifiManager.EXTRA_WIFI_CREDENTIAL_SSID, config.SSID); intent.putExtra(WifiManager.EXTRA_WIFI_CREDENTIAL_EVENT_TYPE, wifiCredentialEventType); - mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT, + // TODO (b/142234604): This will not work on multi-user device scenarios. + mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT_OR_SELF, android.Manifest.permission.RECEIVE_WIFI_CREDENTIAL_CHANGE); } } diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java b/service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java index 137d9fa19..b9afb0bac 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java @@ -789,7 +789,8 @@ public class PasspointProvisioner { // Verify that the intent will resolve to an activity if (intent.resolveActivity(mContext.getPackageManager()) != null) { - mContext.startActivityAsUser(intent, UserHandle.CURRENT); + // TODO (b/142234604): This will not work on multi-user device scenarios. + mContext.startActivityAsUser(intent, UserHandle.CURRENT_OR_SELF); invokeProvisioningCallback(PROVISIONING_STATUS, ProvisioningCallback.OSU_STATUS_WAITING_FOR_REDIRECT_RESPONSE); changeState(STATE_WAITING_FOR_REDIRECT_RESPONSE); diff --git a/tests/wifitests/src/com/android/server/wifi/OpenNetworkNotifierTest.java b/tests/wifitests/src/com/android/server/wifi/OpenNetworkNotifierTest.java index 86c1b8ab9..3021c1991 100644 --- a/tests/wifitests/src/com/android/server/wifi/OpenNetworkNotifierTest.java +++ b/tests/wifitests/src/com/android/server/wifi/OpenNetworkNotifierTest.java @@ -458,7 +458,9 @@ public class OpenNetworkNotifierTest extends WifiBaseTest { /** Verifies that {@link UserManager#DISALLOW_CONFIG_WIFI} disables the feature. */ @Test public void userHasDisallowConfigWifiRestriction_notificationNotDisplayed() { - when(mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_WIFI, UserHandle.CURRENT)) + // TODO (b/142234604): This will not work on multi-user device scenarios. + when(mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_WIFI, + UserHandle.CURRENT_OR_SELF)) .thenReturn(true); mNotificationController.handleScanResults(mOpenNetworks); @@ -477,7 +479,9 @@ public class OpenNetworkNotifierTest extends WifiBaseTest { ConnectToNetworkNotificationAndActionCount.NOTIFICATION_RECOMMEND_NETWORK); verify(mNotificationManager).notify(anyInt(), any()); - when(mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_WIFI, UserHandle.CURRENT)) + // TODO (b/142234604): This will not work on multi-user device scenarios. + when(mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_WIFI, + UserHandle.CURRENT_OR_SELF)) .thenReturn(true); mNotificationController.handleScanResults(mOpenNetworks); |