summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-10-08 21:06:34 -0700
committerRoshan Pius <rpius@google.com>2019-10-09 07:00:33 -0700
commit04bcdded86079da0715b1a7bfa2f6cbfc933b62f (patch)
treeae4098ab5c2bdc5bb202ea7c7f3887c57c38affb /tests
parent2499ea816b41c78a9f9e6f6f306134e16589efac (diff)
WifiStack: Use UserHandle.CURRENT_OR_SELF temporarily
Until, the core platform team provides a mechanism for wifi (& other mainline modules to get signature permissions), use CURRENT_OR_SELF instead of CURRENT. CURRENT_OR_SELF is a workaround that will allow the privileged APK to send broadcasts to its own user (i.e primary user) even if the APK does not have INTERACT_ACROSS_USERS_FULL. Note: a) CURRENT_OR_SELF is @hide field. So, we will need to get rid of this eventually. b) Will not work for multi-user scenarios (i.e if any of these operations are initiated by a secondary user). Bug: 142234604 Test: Able to provision R2 passpoint profile, crash no longer seen Test: atest com.android.server.wifi Change-Id: I551f6584b9de8fee433027b31cf52b8eadb30ae8
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/OpenNetworkNotifierTest.java8
1 files changed, 6 insertions, 2 deletions
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);