summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-10-04 07:48:17 -0700
committerRoshan Pius <rpius@google.com>2019-10-04 10:19:07 -0700
commita47cc7c259c0f2bcd7c6c2e3db5d96884c8dde9e (patch)
treed93d872038d1d5a0288242c7036189a1b85a1cc0 /tests
parentceed935eba94b88225dd7f5c80a9ad20842820ef (diff)
FrameworkFacade: Migrate uid importance check to public API
Bug: 141941797 Test: atest com.android.server.wifi Change-Id: I0f7fbaf8a5c9e148f4ed42165a98e8146ed1b00f
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiLockManagerTest.java30
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java8
2 files changed, 19 insertions, 19 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiLockManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiLockManagerTest.java
index ad1c2e505..396a85306 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiLockManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiLockManagerTest.java
@@ -669,7 +669,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
public void testForegroundAppAcquireLowLatencyScreenOn() throws Exception {
// Set screen on, and app foreground
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
acquireWifiLockSuccessful(WifiManager.WIFI_MODE_FULL_LOW_LATENCY, "",
mBinder, mWorkSource);
@@ -687,7 +687,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
public void testForegroundAppAcquireLowLatencyScreenOff() throws Exception {
// Set screen off, and app is foreground
mWifiLockManager.handleScreenStateChanged(false);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
assertTrue(mWifiLockManager.acquireWifiLock(WifiManager.WIFI_MODE_FULL_LOW_LATENCY,
"", mBinder, mWorkSource));
@@ -703,7 +703,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
public void testBackgroundAppAcquireLowLatencyScreenOn() throws Exception {
// Set screen on, and app is background
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(false);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(false);
assertTrue(mWifiLockManager.acquireWifiLock(WifiManager.WIFI_MODE_FULL_LOW_LATENCY,
"", mBinder, mWorkSource));
@@ -719,7 +719,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
public void testLatencyLockAcquireCauseLlEnableNew() throws Exception {
// Set screen on, and app foreground
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
when(mClientModeImpl.setLowLatencyMode(anyBoolean())).thenReturn(true);
when(mWifiNative.getSupportedFeatureSet(INTERFACE_NAME))
.thenReturn((long) WifiManager.WIFI_FEATURE_LOW_LATENCY);
@@ -739,7 +739,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
public void testLatencyLockAcquireCauseLL_enableLegacy() throws Exception {
// Set screen on, and app foreground
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
when(mWifiNative.getSupportedFeatureSet(INTERFACE_NAME))
.thenReturn((long) WifiManager.WIFI_FEATURE_TX_POWER_LIMIT);
@@ -758,7 +758,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
public void testLatencyLockReleaseCauseLlDisable() throws Exception {
// Set screen on, and app foreground
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
when(mWifiNative.getSupportedFeatureSet(INTERFACE_NAME))
.thenReturn((long) WifiManager.WIFI_FEATURE_LOW_LATENCY);
@@ -792,7 +792,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
// Set screen on, and app is foreground
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
when(mWifiNative.getSupportedFeatureSet(INTERFACE_NAME))
.thenReturn((long) WifiManager.WIFI_FEATURE_LOW_LATENCY);
@@ -821,7 +821,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
// Set screen on, and app is foreground
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
when(mWifiNative.getSupportedFeatureSet(INTERFACE_NAME))
.thenReturn((long) WifiManager.WIFI_FEATURE_LOW_LATENCY);
@@ -847,7 +847,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
public void testLatencyLockGoScreenOff() throws Exception {
// Set screen on, app foreground
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
when(mWifiNative.getSupportedFeatureSet(INTERFACE_NAME))
.thenReturn((long) WifiManager.WIFI_FEATURE_LOW_LATENCY);
@@ -881,7 +881,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
public void testLatencyLockGoBackground() throws Exception {
// Initially, set screen on, app foreground
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
when(mWifiNative.getSupportedFeatureSet(INTERFACE_NAME))
.thenReturn((long) WifiManager.WIFI_FEATURE_LOW_LATENCY);
@@ -920,7 +920,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
public void testLatencyLockGoForeground() throws Exception {
// Initially, set screen on, and app background
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(false);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(false);
when(mWifiNative.getSupportedFeatureSet(INTERFACE_NAME))
.thenReturn((long) WifiManager.WIFI_FEATURE_LOW_LATENCY);
// Make sure setLowLatencyMode() is successful
@@ -959,7 +959,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
public void testLatencyHiPerfLocks() throws Exception {
// Initially, set screen on, and app background
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(false);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(false);
when(mWifiNative.getSupportedFeatureSet(INTERFACE_NAME))
.thenReturn((long) WifiManager.WIFI_FEATURE_LOW_LATENCY);
mWifiLockManager.updateWifiClientConnected(true);
@@ -1070,7 +1070,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
when(mClientModeImpl.setLowLatencyMode(anyBoolean())).thenReturn(true);
when(mClientModeImpl.setPowerSave(anyBoolean())).thenReturn(true);
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
when(mWifiNative.getSupportedFeatureSet(INTERFACE_NAME))
.thenReturn((long) WifiManager.WIFI_FEATURE_LOW_LATENCY);
@@ -1246,7 +1246,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
public void testAcquireLockWhileConnectedDisconnect() throws Exception {
// Set screen on, and app foreground
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
acquireWifiLockSuccessful(WifiManager.WIFI_MODE_FULL_LOW_LATENCY, "", mBinder, mWorkSource);
mWifiLockManager.updateWifiClientConnected(false);
@@ -1314,7 +1314,7 @@ public class WifiLockManagerTest extends WifiBaseTest {
// Set condition for activation of low-latency (except connection to AP)
mWifiLockManager.handleScreenStateChanged(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
when(mWifiNative.getSupportedFeatureSet(INTERFACE_NAME))
.thenReturn((long) WifiManager.WIFI_FEATURE_LOW_LATENCY);
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
index 60c266972..6f33a45f4 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
@@ -1417,7 +1417,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
private void registerLOHSRequestFull() {
// allow test to proceed without a permission check failure
when(mWifiPermissionsUtil.isLocationModeEnabled()).thenReturn(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
when(mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING))
.thenReturn(false);
int result = mWifiServiceImpl.startLocalOnlyHotspot(mLohsCallback, TEST_PACKAGE_NAME);
@@ -1475,7 +1475,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
public void testStartLocalOnlyHotspotFailsIfRequestorNotForegroundApp() throws Exception {
when(mWifiPermissionsUtil.isLocationModeEnabled()).thenReturn(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(false);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(false);
int result = mWifiServiceImpl.startLocalOnlyHotspot(mLohsCallback, TEST_PACKAGE_NAME);
assertEquals(LocalOnlyHotspotCallback.ERROR_INCOMPATIBLE_MODE, result);
}
@@ -1512,7 +1512,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
mWifiServiceImpl.updateInterfaceIpState(WIFI_IFACE_NAME, IFACE_IP_MODE_TETHERED);
when(mWifiPermissionsUtil.isLocationModeEnabled()).thenReturn(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
mLooper.dispatchAll();
int returnCode = mWifiServiceImpl.startLocalOnlyHotspot(mLohsCallback, TEST_PACKAGE_NAME);
assertEquals(ERROR_INCOMPATIBLE_MODE, returnCode);
@@ -1524,7 +1524,7 @@ public class WifiServiceImplTest extends WifiBaseTest {
@Test
public void testHotspotDoesNotStartWhenTetheringDisallowed() throws Exception {
when(mWifiPermissionsUtil.isLocationModeEnabled()).thenReturn(true);
- when(mFrameworkFacade.isAppForeground(anyInt())).thenReturn(true);
+ when(mFrameworkFacade.isAppForeground(any(), anyInt())).thenReturn(true);
when(mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING))
.thenReturn(true);
int returnCode = mWifiServiceImpl.startLocalOnlyHotspot(mLohsCallback, TEST_PACKAGE_NAME);