Merge "Use ACCESS_WIFI_STATE when clearing wifi blacklist"

This commit is contained in:
Treehugger Robot
2020-11-12 05:36:38 +00:00
committed by Gerrit Code Review

View File

@@ -16,6 +16,7 @@
package android.net.cts.util; package android.net.cts.util;
import static android.Manifest.permission.ACCESS_WIFI_STATE;
import static android.Manifest.permission.NETWORK_SETTINGS; import static android.Manifest.permission.NETWORK_SETTINGS;
import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC; import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET; import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
@@ -331,7 +332,7 @@ public final class CtsNetUtils {
* to them. * to them.
*/ */
private void clearWifiBlacklist() { private void clearWifiBlacklist() {
runAsShell(NETWORK_SETTINGS, () -> { runAsShell(NETWORK_SETTINGS, ACCESS_WIFI_STATE, () -> {
for (WifiConfiguration cfg : mWifiManager.getConfiguredNetworks()) { for (WifiConfiguration cfg : mWifiManager.getConfiguredNetworks()) {
assertTrue(mWifiManager.enableNetwork(cfg.networkId, false /* attemptConnect */)); assertTrue(mWifiManager.enableNetwork(cfg.networkId, false /* attemptConnect */));
} }