WifiScanner: Disallow scans when location is off
Don't allow system apps to request scans (using internal
WifiScanner) when location is turned off. We should however
process any scan requests from wifi service
(holding NETWORK_STACK) permissions for connectivity purposes.
While there, also refactored the code performing permission checks.
Note: The public WifiManager.startScan() has more stringent
permission checks that already include the location status check. So,
any requests from wifi service are already sanitized before being sent
to wifi scanner service.
Bug: 113542524
Test: Unit tests
Test: Ensured that the device is still able to connect to wifi networks,
see scan results in settings page when location is turned off.
Change-Id: I41a118feb232c51003c0644130019b14513d8088
2 files changed