summaryrefslogtreecommitdiffstats
path: root/tests/wifitests/src/com
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-09-19 07:34:36 -0700
committerRoshan Pius <rpius@google.com>2019-09-20 14:00:04 +0000
commit4d27cab6de2984871ab38d22e13f7677f95a3341 (patch)
tree2440d2beffa38fd59d3671e5d771fb36ffa970f5 /tests/wifitests/src/com
parentc9d68061749a93378f575199798f676a2b5c37a8 (diff)
downloadandroid_frameworks_opt_net_wifi-4d27cab6de2984871ab38d22e13f7677f95a3341.tar.gz
android_frameworks_opt_net_wifi-4d27cab6de2984871ab38d22e13f7677f95a3341.tar.bz2
android_frameworks_opt_net_wifi-4d27cab6de2984871ab38d22e13f7677f95a3341.zip
Fix a bunch of multi-user API calls
To handle multi-user scenarios, pass in the corresponding app's user id to fetch app info. Bug: 140895783 Test: atest com.android.server.wifi Test: Ran presubmit ACTS tests Change-Id: I400bad75510b064ad405fae07f56671d2c211178 Merged-In: I400bad75510b064ad405fae07f56671d2c211178 (cherry-picked from a1bbebf25cb7b4e33a7b5abaa6ee6402de95ebc9)
Diffstat (limited to 'tests/wifitests/src/com')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java3
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java5
3 files changed, 9 insertions, 5 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java
index 968527a8d..63cc8bf60 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java
@@ -173,7 +173,8 @@ public class WifiNetworkFactoryTest {
.thenReturn(mConnectivityManager);
when(mPackageManager.getNameForUid(TEST_UID_1)).thenReturn(TEST_PACKAGE_NAME_1);
when(mPackageManager.getNameForUid(TEST_UID_2)).thenReturn(TEST_PACKAGE_NAME_2);
- when(mPackageManager.getApplicationInfo(any(), anyInt())).thenReturn(new ApplicationInfo());
+ when(mPackageManager.getApplicationInfoAsUser(any(), anyInt(), anyInt()))
+ .thenReturn(new ApplicationInfo());
when(mPackageManager.getApplicationLabel(any())).thenReturn(TEST_APP_NAME);
when(mActivityManager.getPackageImportance(TEST_PACKAGE_NAME_1))
.thenReturn(IMPORTANCE_FOREGROUND_SERVICE);
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
index ae4da66d6..612fdf575 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
@@ -150,10 +150,12 @@ public class WifiNetworkSuggestionsManagerTest {
when(mContext.getApplicationInfo()).thenReturn(ourAppInfo);
// test app info
ApplicationInfo appInfO1 = new ApplicationInfo();
- when(mPackageManager.getApplicationInfo(TEST_PACKAGE_1, 0)).thenReturn(appInfO1);
+ when(mPackageManager.getApplicationInfoAsUser(eq(TEST_PACKAGE_1), eq(0), anyInt()))
+ .thenReturn(appInfO1);
when(mPackageManager.getApplicationLabel(appInfO1)).thenReturn(TEST_APP_NAME_1);
ApplicationInfo appInfO2 = new ApplicationInfo();
- when(mPackageManager.getApplicationInfo(TEST_PACKAGE_2, 0)).thenReturn(appInfO2);
+ when(mPackageManager.getApplicationInfoAsUser(eq(TEST_PACKAGE_2), eq(0), anyInt()))
+ .thenReturn(appInfO2);
when(mPackageManager.getApplicationLabel(appInfO2)).thenReturn(TEST_APP_NAME_2);
mWifiNetworkSuggestionsManager =
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
index 9702d2ba6..9a3bd75be 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
@@ -349,7 +349,8 @@ public class WifiServiceImplTest {
when(mContext.getResources()).thenReturn(mResources);
when(mContext.getContentResolver()).thenReturn(mContentResolver);
when(mContext.getPackageManager()).thenReturn(mPackageManager);
- when(mPackageManager.getApplicationInfo(any(), anyInt())).thenReturn(mApplicationInfo);
+ when(mPackageManager.getApplicationInfoAsUser(any(), anyInt(), anyInt()))
+ .thenReturn(mApplicationInfo);
when(mWifiInjector.getWifiApConfigStore()).thenReturn(mWifiApConfigStore);
doNothing().when(mFrameworkFacade).registerContentObserver(eq(mContext), any(),
anyBoolean(), any());
@@ -2658,7 +2659,7 @@ public class WifiServiceImplTest {
PackageManager pm = mock(PackageManager.class);
when(pm.hasSystemFeature(PackageManager.FEATURE_WIFI_PASSPOINT)).thenReturn(true);
when(mContext.getPackageManager()).thenReturn(pm);
- when(pm.getApplicationInfo(any(), anyInt())).thenReturn(mApplicationInfo);
+ when(pm.getApplicationInfoAsUser(any(), anyInt(), anyInt())).thenReturn(mApplicationInfo);
when(mWifiPermissionsUtil.isTargetSdkLessThan(anyString(),
eq(Build.VERSION_CODES.Q), anyInt())).thenReturn(true);