diff options
author | Roshan Pius <rpius@google.com> | 2018-04-26 21:22:32 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-04-26 21:22:32 +0000 |
commit | 5d028baa92b741ffcf82363c6983c208482d3f29 (patch) | |
tree | cf732ac6f6397b156f56cd33c7e9da4b8e1b8e82 /service | |
parent | 7daee3fabb13a50a788fb2eb7aaec1f9ebc62efc (diff) | |
parent | 0a8b73a22306e8644d4ca3afdb42f9d94a9efc8d (diff) |
Merge "ScanRequestProxy: Bypass scan throttling for setup wizard" into pi-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/ScanRequestProxy.java | 9 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/util/WifiPermissionsUtil.java | 9 |
2 files changed, 15 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/ScanRequestProxy.java b/service/java/com/android/server/wifi/ScanRequestProxy.java index b9e48ea56..646fa5858 100644 --- a/service/java/com/android/server/wifi/ScanRequestProxy.java +++ b/service/java/com/android/server/wifi/ScanRequestProxy.java @@ -349,9 +349,12 @@ public class ScanRequestProxy { sendScanResultFailureBroadcastToPackage(packageName); return false; } - boolean fromSettings = mWifiPermissionsUtil.checkNetworkSettingsPermission(callingUid); + boolean fromSettingsOrSetupWizard = + mWifiPermissionsUtil.checkNetworkSettingsPermission(callingUid) + || mWifiPermissionsUtil.checkNetworkSetupWizardPermission(callingUid); // Check and throttle scan request from apps without NETWORK_SETTINGS permission. - if (!fromSettings && shouldScanRequestBeThrottledForApp(callingUid, packageName)) { + if (!fromSettingsOrSetupWizard + && shouldScanRequestBeThrottledForApp(callingUid, packageName)) { Log.i(TAG, "Scan request from " + packageName + " throttled"); sendScanResultFailureBroadcastToPackage(packageName); return false; @@ -362,7 +365,7 @@ public class ScanRequestProxy { // Create the scan settings. WifiScanner.ScanSettings settings = new WifiScanner.ScanSettings(); // Scan requests from apps with network settings will be of high accuracy type. - if (fromSettings) { + if (fromSettingsOrSetupWizard) { settings.type = WifiScanner.TYPE_HIGH_ACCURACY; } // always do full scans diff --git a/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java b/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java index 3d838645d..cf43eb36f 100644 --- a/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java +++ b/service/java/com/android/server/wifi/util/WifiPermissionsUtil.java @@ -287,4 +287,13 @@ public class WifiPermissionsUtil { android.Manifest.permission.NETWORK_SETTINGS, uid) == PackageManager.PERMISSION_GRANTED; } + + /** + * Returns true if the |uid| holds NETWORK_SETUP_WIZARD permission. + */ + public boolean checkNetworkSetupWizardPermission(int uid) { + return mWifiPermissionsWrapper.getUidPermission( + android.Manifest.permission.NETWORK_SETUP_WIZARD, uid) + == PackageManager.PERMISSION_GRANTED; + } } |