diff options
author | Roshan Pius <rpius@google.com> | 2019-01-07 16:10:48 -0800 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2019-01-08 07:38:07 -0800 |
commit | 187f81d630dfa77a56e4651b225bf26c826bd49f (patch) | |
tree | 7b20801e65375001e1d958e683945b84fc927d45 /tests/wifitests/src/com/android/server/wifi/rtt | |
parent | e52bfec84a81968b6005b66b9d96f6a737c4bbd0 (diff) | |
download | android_frameworks_opt_net_wifi-187f81d630dfa77a56e4651b225bf26c826bd49f.tar.gz android_frameworks_opt_net_wifi-187f81d630dfa77a56e4651b225bf26c826bd49f.tar.bz2 android_frameworks_opt_net_wifi-187f81d630dfa77a56e4651b225bf26c826bd49f.zip |
WifiPermissionsUtil: Check location mode for current fg user
a) Use the WifiPermissionsUtil.isLocationModeEnabled() for all location
mode checks in the wifi stack.
b) Check the current fg user's location mode instead of the system user (0).
Bug: 121336053
Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I9c20b5f5f0c11abbf6e6bba2bbfd5ff4dd6df22c
Diffstat (limited to 'tests/wifitests/src/com/android/server/wifi/rtt')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/rtt/RttServiceImplTest.java | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/rtt/RttServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/rtt/RttServiceImplTest.java index 11e80f06f..2f380c7ba 100644 --- a/tests/wifitests/src/com/android/server/wifi/rtt/RttServiceImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/rtt/RttServiceImplTest.java @@ -131,9 +131,6 @@ public class RttServiceImplTest { public ActivityManager mockActivityManager; @Mock - public LocationManager mockLocationManager; - - @Mock public Clock mockClock; @Mock @@ -198,7 +195,6 @@ public class RttServiceImplTest { eq(Settings.Global.WIFI_RTT_BACKGROUND_EXEC_GAP_MS), anyLong())) .thenReturn(BACKGROUND_PROCESS_EXEC_GAP_MS); - when(mockLocationManager.isLocationEnabled()).thenReturn(true); when(mockContext.getSystemService(Context.ALARM_SERVICE)) .thenReturn(mAlarmManager.getAlarmManager()); mInOrder = inOrder(mAlarmManager.getAlarmManager(), mockContext); @@ -210,6 +206,7 @@ public class RttServiceImplTest { when(mockPermissionUtil.checkCallersLocationPermission(eq(mPackageName), anyInt())).thenReturn(true); + when(mockPermissionUtil.isLocationModeEnabled()).thenReturn(true); when(mockNative.isReady()).thenReturn(true); when(mockNative.rangeRequest(anyInt(), any(RangingRequest.class), anyBoolean())).thenReturn( true); @@ -220,8 +217,6 @@ public class RttServiceImplTest { when(mockContext.getSystemServiceName(PowerManager.class)).thenReturn( Context.POWER_SERVICE); when(mockContext.getSystemService(PowerManager.class)).thenReturn(mMockPowerManager); - when(mockContext.getSystemService(Context.LOCATION_SERVICE)).thenReturn( - mockLocationManager); doAnswer(mBinderLinkToDeathCounter).when(mockIbinder).linkToDeath(any(), anyInt()); doAnswer(mBinderUnlinkToDeathCounter).when(mockIbinder).unlinkToDeath(any(), anyInt()); @@ -1351,7 +1346,7 @@ public class RttServiceImplTest { } else if (failureMode == FAILURE_MODE_ENABLE_DOZE) { simulatePowerStateChangeDoze(true); } else if (failureMode == FAILURE_MODE_DISABLE_LOCATIONING) { - when(mockLocationManager.isLocationEnabled()).thenReturn(false); + when(mockPermissionUtil.isLocationModeEnabled()).thenReturn(false); simulateLocationModeChange(); } mMockLooper.dispatchAll(); @@ -1379,7 +1374,7 @@ public class RttServiceImplTest { } else if (failureMode == FAILURE_MODE_ENABLE_DOZE) { simulatePowerStateChangeDoze(false); } else if (failureMode == FAILURE_MODE_DISABLE_LOCATIONING) { - when(mockLocationManager.isLocationEnabled()).thenReturn(true); + when(mockPermissionUtil.isLocationModeEnabled()).thenReturn(true); simulateLocationModeChange(); } mMockLooper.dispatchAll(); |