Merge "Fix quickly toggling airplane mode on then off could leave Wifi disabled" into rvc-dev
diff --git a/libs/WifiTrackerLib/res/values-ar/strings.xml b/libs/WifiTrackerLib/res/values-ar/strings.xml
index 477cabc..ef0f107 100644
--- a/libs/WifiTrackerLib/res/values-ar/strings.xml
+++ b/libs/WifiTrackerLib/res/values-ar/strings.xml
@@ -25,7 +25,7 @@
<string name="wifi_check_password_try_again" msgid="2643230209986217827">"يُرجى التحقق من كلمة المرور وإعادة المحاولة"</string>
<string name="wifi_disabled_network_failure" msgid="6506742207778007439">"تعذّرت تهيئة عنوان IP"</string>
<string name="wifi_disabled_generic" msgid="8307050327779256414">"غير مفعّلة"</string>
- <string name="wifi_ap_unable_to_handle_new_sta" msgid="6552198761671428871">"نقطة الدخول ممتلئة مؤقتًا"</string>
+ <string name="wifi_ap_unable_to_handle_new_sta" msgid="6552198761671428871">"نقطة الوصول ممتلئة مؤقتًا"</string>
<string name="wifi_disconnected" msgid="3720926757662831062">"غير متصلة"</string>
<string name="wifi_remembered" msgid="5126903736498678708">"تم الحفظ"</string>
<string name="wifi_metered_label" msgid="1362621600006544014">"تفرض تكلفة استخدام"</string>
diff --git a/libs/WifiTrackerLib/res/values-gl/strings.xml b/libs/WifiTrackerLib/res/values-gl/strings.xml
index c9a6c3f..d4a8c0e 100644
--- a/libs/WifiTrackerLib/res/values-gl/strings.xml
+++ b/libs/WifiTrackerLib/res/values-gl/strings.xml
@@ -33,7 +33,7 @@
<string name="connected_via_app" msgid="1818040967936972127">"Wifi conectada a través de <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="available_via_app" msgid="9110324040292242769">"Dispoñible a través de <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="connected_via_network_scorer" msgid="209764314005159012">"Wifi conectada automaticamente a través de: <xliff:g id="NAME">%1$s</xliff:g>"</string>
- <string name="connected_via_network_scorer_default" msgid="3084818437004202462">"Conectada automaticamente a través dun provedor de valoración de rede"</string>
+ <string name="connected_via_network_scorer_default" msgid="3084818437004202462">"Conectada automaticamente a través dun provedor de valoración de redes"</string>
<string name="wifi_limited_connection" msgid="3646701342701276239">"Pouca conexión"</string>
<string name="private_dns_broken" msgid="2212227512243587416">"Non se puido acceder ao servidor DNS privado"</string>
<string name="wifi_connected_no_internet" msgid="7273909077465731259">"Non hai conexión a Internet"</string>
diff --git a/metrics_pdd_hook.py b/metrics_pdd_hook.py
index 093f2cd..fa85855 100755
--- a/metrics_pdd_hook.py
+++ b/metrics_pdd_hook.py
@@ -38,7 +38,7 @@
def is_commit_msg_valid(commit_msg):
for line in commit_msg.splitlines():
line = line.strip().lower()
- if line.startswith('updated-pdd') and 'true' in line:
+ if line.startswith('updated-pdd'):
return True
return False
@@ -65,11 +65,16 @@
return 0
print('This commit has changed {metrics_file}.'.format(metrics_file=metrics_file))
- print('Please update the Wifi Metrics Privacy Design Doc (PDD) at go/wifi-metrics-pdd')
+ print('If this change added/changed/removed metrics collected from the device,')
+ print('please update the Wifi Metrics Privacy Design Doc (PDD) at go/wifi-metrics-pdd')
print('and acknowledge you have done so by adding this line to your commit message:')
print()
print('Updated-PDD: TRUE')
print()
+ print('Otherwise, please explain why the PDD does not need to be updated:')
+ print()
+ print('Updated-PDD: Not applicable - reformatted file')
+ print()
print('Please reach out to the OWNERS for more information about the Wifi Metrics PDD.')
return 1
diff --git a/service/java/com/android/server/wifi/DeviceConfigFacade.java b/service/java/com/android/server/wifi/DeviceConfigFacade.java
index 0e43a08..0b70770 100644
--- a/service/java/com/android/server/wifi/DeviceConfigFacade.java
+++ b/service/java/com/android/server/wifi/DeviceConfigFacade.java
@@ -66,7 +66,7 @@
// Denominator part of default threshold of L2 throughput over L3 throughput ratio
public static final int DEFAULT_TPUT_SUFFICIENT_RATIO_THR_DEN = 1;
// Default threshold of Tx packet per second
- public static final int DEFAULT_TX_PACKET_PER_SECOND_THR = 1;
+ public static final int DEFAULT_TX_PACKET_PER_SECOND_THR = 2;
// Default threshold of Rx packet per second
public static final int DEFAULT_RX_PACKET_PER_SECOND_THR = 1;
// Default high threshold values for various connection/disconnection cases
diff --git a/service/java/com/android/server/wifi/SoftApManager.java b/service/java/com/android/server/wifi/SoftApManager.java
index f972047..ffbb388 100644
--- a/service/java/com/android/server/wifi/SoftApManager.java
+++ b/service/java/com/android/server/wifi/SoftApManager.java
@@ -469,12 +469,17 @@
return true;
}
+ if (mBlockedClientList.contains(newClient.getMacAddress())) {
+ Log.d(TAG, "Force disconnect for client: " + newClient + "in blocked list");
+ mWifiNative.forceClientDisconnect(
+ mApInterfaceName, newClient.getMacAddress(),
+ WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER);
+ return false;
+ }
if (config.isClientControlByUserEnabled()
&& !mAllowedClientList.contains(newClient.getMacAddress())) {
- if (!mBlockedClientList.contains(newClient.getMacAddress())) {
- mSoftApCallback.onBlockedClientConnecting(newClient,
- WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER);
- }
+ mSoftApCallback.onBlockedClientConnecting(newClient,
+ WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER);
Log.d(TAG, "Force disconnect for unauthorized client: " + newClient);
mWifiNative.forceClientDisconnect(
mApInterfaceName, newClient.getMacAddress(),
@@ -667,25 +672,22 @@
}
int targetDisconnectClientNumber = mConnectedClients.size() - finalMaxClientCount;
List<WifiClient> allowedConnectedList = new ArrayList<>();
- if (mApConfig.getSoftApConfiguration().isClientControlByUserEnabled()) {
- // Check allow list first
- Iterator<WifiClient> iterator = mConnectedClients.iterator();
- while (iterator.hasNext()) {
- WifiClient client = iterator.next();
- if (mAllowedClientList.contains(client.getMacAddress())) {
- allowedConnectedList.add(client);
- } else {
- Log.d(TAG, "Force disconnect for not allowed client: " + client);
- mWifiNative.forceClientDisconnect(
- mApInterfaceName, client.getMacAddress(),
- WifiManager
- .SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER);
- targetDisconnectClientNumber--;
- }
+ Iterator<WifiClient> iterator = mConnectedClients.iterator();
+ while (iterator.hasNext()) {
+ WifiClient client = iterator.next();
+ if (mBlockedClientList.contains(client.getMacAddress())
+ || (mApConfig.getSoftApConfiguration().isClientControlByUserEnabled()
+ && !mAllowedClientList.contains(client.getMacAddress()))) {
+ Log.d(TAG, "Force disconnect for not allowed client: " + client);
+ mWifiNative.forceClientDisconnect(
+ mApInterfaceName, client.getMacAddress(),
+ WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER);
+ targetDisconnectClientNumber--;
+ } else {
+ allowedConnectedList.add(client);
}
- } else {
- allowedConnectedList = new ArrayList<>(mConnectedClients);
}
+
if (targetDisconnectClientNumber > 0) {
Iterator<WifiClient> allowedClientIterator = allowedConnectedList.iterator();
while (allowedClientIterator.hasNext()) {
diff --git a/service/java/com/android/server/wifi/WifiApConfigStore.java b/service/java/com/android/server/wifi/WifiApConfigStore.java
index 961cbbd..3de9971 100644
--- a/service/java/com/android/server/wifi/WifiApConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiApConfigStore.java
@@ -33,6 +33,7 @@
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
+import java.util.ArrayList;
import java.util.Random;
import javax.annotation.Nullable;
@@ -153,10 +154,13 @@
/**
* Returns SoftApConfiguration in which some parameters might be reset to supported default
- * config.
+ * config since it depends on UI or HW.
*
- * MaxNumberOfClients and setClientControlByUserEnabled will need HAL support client force
- * disconnect. Reset to default when device doesn't support it.
+ * MaxNumberOfClients and isClientControlByUserEnabled will need HAL support client force
+ * disconnect, and Band setting (5g/6g) need HW support.
+ *
+ * HiddenSsid, Channel, ShutdownTimeoutMillis and AutoShutdownEnabled are features
+ * which need UI(Setting) support.
*
* SAE/SAE-Transition need hardware support, reset to secured WPA2 security type when device
* doesn't support it.
@@ -164,15 +168,22 @@
public SoftApConfiguration resetToDefaultForUnsupportedConfig(
@NonNull SoftApConfiguration config) {
SoftApConfiguration.Builder configBuilder = new SoftApConfiguration.Builder(config);
- if (!ApConfigUtil.isClientForceDisconnectSupported(mContext)) {
- configBuilder.setMaxNumberOfClients(0);
+ if ((!ApConfigUtil.isClientForceDisconnectSupported(mContext)
+ || mContext.getResources().getBoolean(
+ R.bool.config_wifiSoftapResetUserControlConfig))
+ && (config.isClientControlByUserEnabled()
+ || config.getBlockedClientList().size() != 0)) {
configBuilder.setClientControlByUserEnabled(false);
- if (config.getMaxNumberOfClients() != 0) {
- Log.e(TAG, "Reset MaxNumberOfClients to 0 due to device doesn't support");
- }
- if (config.isClientControlByUserEnabled()) {
- Log.e(TAG, "Reset ClientControlByUser to false due to device doesn't support");
- }
+ configBuilder.setBlockedClientList(new ArrayList<>());
+ Log.i(TAG, "Reset ClientControlByUser to false due to device doesn't support");
+ }
+
+ if ((!ApConfigUtil.isClientForceDisconnectSupported(mContext)
+ || mContext.getResources().getBoolean(
+ R.bool.config_wifiSoftapResetMaxClientSettingConfig))
+ && config.getMaxNumberOfClients() != 0) {
+ configBuilder.setMaxNumberOfClients(0);
+ Log.i(TAG, "Reset MaxNumberOfClients to 0 due to device doesn't support");
}
if (!ApConfigUtil.isWpa3SaeSupported(mContext) && (config.getSecurityType()
@@ -181,18 +192,51 @@
== SoftApConfiguration.SECURITY_TYPE_WPA3_SAE_TRANSITION)) {
configBuilder.setPassphrase(generatePassword(),
SoftApConfiguration.SECURITY_TYPE_WPA2_PSK);
- Log.e(TAG, "Device doesn't support WPA3-SAE, reset config to WPA2");
+ Log.i(TAG, "Device doesn't support WPA3-SAE, reset config to WPA2");
}
- if (mContext.getResources().getBoolean(R.bool.config_wifiSoftapResetChannelConfig)) {
+ if (mContext.getResources().getBoolean(R.bool.config_wifiSoftapResetChannelConfig)
+ && config.getChannel() != 0) {
// The device might not support customize channel or forced channel might not
// work in some countries. Need to reset it.
- if (config.getChannel() != 0) {
- // Add 2.4G by default
- configBuilder.setBand(SoftApConfiguration.BAND_2GHZ | config.getBand());
- Log.i(TAG, "Reset SAP channel configuration");
- }
+ // Add 2.4G by default
+ configBuilder.setBand(config.getBand() | SoftApConfiguration.BAND_2GHZ);
+ Log.i(TAG, "Reset SAP channel configuration");
}
+
+ int newBand = config.getBand();
+ if (!mContext.getResources().getBoolean(R.bool.config_wifi6ghzSupport)
+ && (newBand & SoftApConfiguration.BAND_6GHZ) != 0) {
+ newBand &= ~SoftApConfiguration.BAND_6GHZ;
+ Log.i(TAG, "Device doesn't support 6g, remove 6G band from band setting");
+ }
+
+ if (!mContext.getResources().getBoolean(R.bool.config_wifi5ghzSupport)
+ && (newBand & SoftApConfiguration.BAND_5GHZ) != 0) {
+ newBand &= ~SoftApConfiguration.BAND_5GHZ;
+ Log.i(TAG, "Device doesn't support 5g, remove 5G band from band setting");
+ }
+
+ if (newBand != config.getBand()) {
+ // Always added 2.4G by default when reset the band.
+ Log.i(TAG, "Reset band from " + config.getBand() + " to "
+ + (newBand | SoftApConfiguration.BAND_2GHZ));
+ configBuilder.setBand(newBand | SoftApConfiguration.BAND_2GHZ);
+ }
+
+ if (mContext.getResources().getBoolean(R.bool.config_wifiSoftapResetHiddenConfig)
+ && config.isHiddenSsid()) {
+ configBuilder.setHiddenSsid(false);
+ Log.i(TAG, "Reset SAP Hidden Network configuration");
+ }
+
+ if (mContext.getResources().getBoolean(
+ R.bool.config_wifiSoftapResetAutoShutdownTimerConfig)
+ && config.getShutdownTimeoutMillis() != 0) {
+ configBuilder.setShutdownTimeoutMillis(0);
+ Log.i(TAG, "Reset SAP auto shutdown configuration");
+ }
+
mWifiMetrics.noteSoftApConfigReset(config, configBuilder.build());
return configBuilder.build();
}
diff --git a/service/java/com/android/server/wifi/WifiChannelUtilization.java b/service/java/com/android/server/wifi/WifiChannelUtilization.java
index 906e2d0..5e8cde6 100644
--- a/service/java/com/android/server/wifi/WifiChannelUtilization.java
+++ b/service/java/com/android/server/wifi/WifiChannelUtilization.java
@@ -19,6 +19,8 @@
import static android.net.wifi.WifiManager.DEVICE_MOBILITY_STATE_STATIONARY;
import static android.net.wifi.WifiManager.DEVICE_MOBILITY_STATE_UNKNOWN;
+import android.content.Context;
+import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager.DeviceMobilityState;
import android.util.Log;
import android.util.SparseArray;
@@ -27,6 +29,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.wifi.WifiLinkLayerStats.ChannelStats;
import com.android.server.wifi.util.InformationElementUtil.BssLoad;
+import com.android.wifi.resources.R;
import java.util.ArrayDeque;
import java.util.Iterator;
@@ -60,6 +63,7 @@
@VisibleForTesting
static final int CHANNEL_STATS_CACHE_SIZE = 5;
private final Clock mClock;
+ private final Context mContext;
private @DeviceMobilityState int mDeviceMobilityState = DEVICE_MOBILITY_STATE_UNKNOWN;
private int mCacheUpdateIntervalMinMs = DEFAULT_CACHE_UPDATE_INTERVAL_MIN_MS;
@@ -72,7 +76,8 @@
private long mLastChannelStatsMapTimeStamp;
private int mLastChannelStatsMapMobilityState;
- WifiChannelUtilization(Clock clock) {
+ WifiChannelUtilization(Clock clock, Context context) {
+ mContext = context;
mClock = clock;
}
@@ -85,7 +90,7 @@
}
/**
- * Initialize internal variables and status after wifi is enabled
+ * (Re)initialize internal variables and status
* @param wifiLinkLayerStats The latest wifi link layer stats
*/
public void init(WifiLinkLayerStats wifiLinkLayerStats) {
@@ -120,6 +125,19 @@
* @return Utilization ratio value if it is available; BssLoad.INVALID otherwise
*/
public int getUtilizationRatio(int frequency) {
+ if (mContext.getResources().getBoolean(
+ R.bool.config_wifiChannelUtilizationOverrideEnabled)) {
+ if (ScanResult.is24GHz(frequency)) {
+ return mContext.getResources().getInteger(
+ R.integer.config_wifiChannelUtilizationOverride2g);
+ }
+ if (ScanResult.is5GHz(frequency)) {
+ return mContext.getResources().getInteger(
+ R.integer.config_wifiChannelUtilizationOverride5g);
+ }
+ return mContext.getResources().getInteger(
+ R.integer.config_wifiChannelUtilizationOverride6g);
+ }
return mChannelUtilizationMap.get(frequency, BssLoad.INVALID);
}
@@ -153,6 +171,11 @@
*/
public void refreshChannelStatsAndChannelUtilization(WifiLinkLayerStats wifiLinkLayerStats,
int frequency) {
+ if (mContext.getResources().getBoolean(
+ R.bool.config_wifiChannelUtilizationOverrideEnabled)) {
+ return;
+ }
+
if (wifiLinkLayerStats == null) {
return;
}
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 99de927..6d04b7a 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -3240,9 +3240,11 @@
mWifiPermissionsUtil.checkNetworkSettingsPermission(uid);
final boolean hasNetworkSetupWizardPermission =
mWifiPermissionsUtil.checkNetworkSetupWizardPermission(uid);
+ final boolean hasNetworkManagedProvisioningPermission =
+ mWifiPermissionsUtil.checkNetworkManagedProvisioningPermission(uid);
// If |uid| corresponds to the device owner, allow all modifications.
if (isProfileOwner || isDeviceOwner || hasNetworkSettingsPermission
- || hasNetworkSetupWizardPermission) {
+ || hasNetworkSetupWizardPermission || hasNetworkManagedProvisioningPermission) {
return true;
}
if (mVerboseLoggingEnabled) {
diff --git a/service/java/com/android/server/wifi/WifiDataStall.java b/service/java/com/android/server/wifi/WifiDataStall.java
index 7ae5779..ebc1847 100644
--- a/service/java/com/android/server/wifi/WifiDataStall.java
+++ b/service/java/com/android/server/wifi/WifiDataStall.java
@@ -296,7 +296,8 @@
}
logd(" ccaLevel = " + ccaLevel);
- int txPer = updateTxPer(txSuccessDelta, txRetriesDelta, isSameBssidAndFreq);
+ int txPer = updateTxPer(txSuccessDelta, txRetriesDelta, isSameBssidAndFreq,
+ isTxTrafficHigh);
boolean isTxTputLow = false;
boolean isRxTputLow = false;
@@ -397,12 +398,13 @@
return WifiIsUnusableEvent.TYPE_UNKNOWN;
}
- private int updateTxPer(long txSuccessDelta, long txRetriesDelta, boolean isSameBssidAndFreq) {
+ private int updateTxPer(long txSuccessDelta, long txRetriesDelta, boolean isSameBssidAndFreq,
+ boolean isTxTrafficHigh) {
if (!isSameBssidAndFreq) {
return DEFAULT_TX_PACKET_ERROR_RATE;
}
long txAttempts = txSuccessDelta + txRetriesDelta;
- if (txAttempts <= 0) {
+ if (txAttempts <= 0 || !isTxTrafficHigh) {
return DEFAULT_TX_PACKET_ERROR_RATE;
}
return (int) (txRetriesDelta * 100 / txAttempts);
diff --git a/service/java/com/android/server/wifi/WifiDiagnostics.java b/service/java/com/android/server/wifi/WifiDiagnostics.java
index db9b075..6fc75c6 100644
--- a/service/java/com/android/server/wifi/WifiDiagnostics.java
+++ b/service/java/com/android/server/wifi/WifiDiagnostics.java
@@ -110,10 +110,10 @@
public static final long MIN_DUMP_TIME_WINDOW_MILLIS = 10 * 60 * 1000; // 10 mins
// Timeout for logcat process termination
- private static final long LOGCAT_PROC_TIMEOUT_MILLIS = 500;
+ private static final long LOGCAT_PROC_TIMEOUT_MILLIS = 50;
// Timeout for logcat read from input/error stream each.
@VisibleForTesting
- public static final long LOGCAT_READ_TIMEOUT_MILLIS = 500;
+ public static final long LOGCAT_READ_TIMEOUT_MILLIS = 50;
private long mLastBugReportTime;
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index 8f6465b..b9aa052 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -329,7 +329,7 @@
mWifiDiagnostics = new WifiDiagnostics(
mContext, this, mWifiNative, mBuildProperties,
new LastMileLogger(this), mClock);
- mWifiChannelUtilizationConnected = new WifiChannelUtilization(mClock);
+ mWifiChannelUtilizationConnected = new WifiChannelUtilization(mClock, mContext);
mWifiDataStall = new WifiDataStall(mFrameworkFacade, mWifiMetrics, mContext,
mDeviceConfigFacade, mWifiChannelUtilizationConnected, mClock, wifiHandler,
mThroughputPredictor);
@@ -617,7 +617,7 @@
mBssidBlocklistMonitor = new BssidBlocklistMonitor(mContext, mWifiConnectivityHelper,
mWifiLastResortWatchdog, mClock, mConnectivityLocalLog, mWifiScoreCard);
mWifiMetrics.setBssidBlocklistMonitor(mBssidBlocklistMonitor);
- mWifiChannelUtilizationScan = new WifiChannelUtilization(mClock);
+ mWifiChannelUtilizationScan = new WifiChannelUtilization(mClock, mContext);
return new WifiConnectivityManager(mContext, getScoringParams(),
clientModeImpl, this,
mWifiConfigManager, mWifiNetworkSuggestionsManager, clientModeImpl.getWifiInfo(),
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index 72c52bd..a7544e0 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -44,6 +44,7 @@
import android.os.RemoteException;
import android.os.SystemProperties;
import android.telephony.TelephonyManager;
+import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Base64;
import android.util.Log;
@@ -1111,6 +1112,7 @@
}
sb.append(", numConsecutiveConnectionFailure="
+ mConnectionEvent.numConsecutiveConnectionFailure);
+ sb.append(", isOsuProvisioned=" + mConnectionEvent.isOsuProvisioned);
}
return sb.toString();
}
@@ -1460,9 +1462,12 @@
mBssidBlocklistMonitor.getNumBlockedBssidsForSsid(config.SSID);
mCurrentConnectionEvent.mConnectionEvent.networkType =
WifiMetricsProto.ConnectionEvent.TYPE_UNKNOWN;
+ mCurrentConnectionEvent.mConnectionEvent.isOsuProvisioned = false;
if (config.isPasspoint()) {
mCurrentConnectionEvent.mConnectionEvent.networkType =
WifiMetricsProto.ConnectionEvent.TYPE_PASSPOINT;
+ mCurrentConnectionEvent.mConnectionEvent.isOsuProvisioned =
+ !TextUtils.isEmpty(config.updateIdentifier);
} else if (WifiConfigurationUtil.isConfigForSaeNetwork(config)) {
mCurrentConnectionEvent.mConnectionEvent.networkType =
WifiMetricsProto.ConnectionEvent.TYPE_WPA3;
@@ -3097,7 +3102,7 @@
for (ConnectionEvent event : mConnectionEventList) {
String eventLine = event.toString();
if (event == mCurrentConnectionEvent) {
- eventLine += "CURRENTLY OPEN EVENT";
+ eventLine += " CURRENTLY OPEN EVENT";
}
pw.println(eventLine);
}
diff --git a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
index 56cdba8..61e6c16 100644
--- a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
+++ b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
@@ -158,6 +158,12 @@
android.Manifest.permission.ACCESS_WIFI_STATE
};
+ private static final String[] RECEIVER_PERMISSIONS_FOR_BROADCAST_LOCATION_OFF = {
+ android.Manifest.permission.NETWORK_SETTINGS,
+ android.Manifest.permission.ACCESS_FINE_LOCATION,
+ android.Manifest.permission.ACCESS_WIFI_STATE
+ };
+
// Maximum number of bytes allowed for a network name, i.e. SSID.
private static final int MAX_NETWORK_NAME_BYTES = 32;
// Minimum number of bytes for a network name, i.e. DIRECT-xy.
@@ -3085,8 +3091,12 @@
private void sendBroadcastMultiplePermissions(Intent intent) {
Context context = mContext.createContextAsUser(UserHandle.ALL, 0);
+ String[] permissions = RECEIVER_PERMISSIONS_FOR_BROADCAST;
+ if (!mWifiPermissionsUtil.isLocationModeEnabled()) {
+ permissions = RECEIVER_PERMISSIONS_FOR_BROADCAST_LOCATION_OFF;
+ }
context.sendBroadcastWithMultiplePermissions(
- intent, RECEIVER_PERMISSIONS_FOR_BROADCAST);
+ intent, permissions);
}
private void sendThisDeviceChangedBroadcast() {
diff --git a/service/java/com/android/server/wifi/util/ApConfigUtil.java b/service/java/com/android/server/wifi/util/ApConfigUtil.java
index b385369..39d0df5 100644
--- a/service/java/com/android/server/wifi/util/ApConfigUtil.java
+++ b/service/java/com/android/server/wifi/util/ApConfigUtil.java
@@ -529,7 +529,8 @@
SoftApCapability capability) {
if (!capability.areFeaturesSupported(
SoftApCapability.SOFTAP_FEATURE_CLIENT_FORCE_DISCONNECT)
- && (config.getMaxNumberOfClients() != 0 || config.isClientControlByUserEnabled())) {
+ && (config.getMaxNumberOfClients() != 0 || config.isClientControlByUserEnabled()
+ || config.getBlockedClientList().size() != 0)) {
Log.d(TAG, "Error, Client control requires HAL support");
return false;
}
diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto
index e7c0ec8..30b1690 100644
--- a/service/proto/src/metrics.proto
+++ b/service/proto/src/metrics.proto
@@ -1049,7 +1049,7 @@
CREATOR_CARRIER = 2;
}
- // Start time of the connection.
+ // Start time of the connection, in milliseconds since Unix epoch (1970-01-01).
optional int64 start_time_millis = 1;// [(datapol.semantic_type) = ST_TIMESTAMP];
// Duration to connect.
@@ -1109,6 +1109,9 @@
// middle won't break the streak count. The count is cleared after
// a network disconnection event.
optional int32 num_consecutive_connection_failure = 19 [default = -1];
+
+ // Indicates if the profile used for the connection was provisioned by Passpoint OSU server
+ optional bool is_osu_provisioned = 20;
}
// Number of occurrences of a specific RSSI poll rssi value
diff --git a/service/res/values/config.xml b/service/res/values/config.xml
index 7e35eed..cc80f60 100644
--- a/service/res/values/config.xml
+++ b/service/res/values/config.xml
@@ -133,13 +133,24 @@
are no connected devices. -->
<integer translatable="false" name="config_wifiFrameworkSoftApShutDownTimeoutMilliseconds">600000</integer>
-
<!-- Integer indicating maximum hardware supported client number of soft ap -->
<integer translatable="false" name="config_wifiHardwareSoftapMaxClientCount">16</integer>
- <!-- boolean indicating whether reset channel configuration or not during cloud configuration restore -->
+ <!-- boolean indicating whether or not to reset channel configuration during cloud configuration restore -->
<bool translatable="false" name ="config_wifiSoftapResetChannelConfig">true</bool>
+ <!-- boolean indicating whether or not to reset hiddenSsid configuration during cloud configuration restore -->
+ <bool translatable="false" name ="config_wifiSoftapResetHiddenConfig">true</bool>
+
+ <!-- boolean indicating whether or not to reset user control configuration during cloud configuration restore -->
+ <bool translatable="false" name ="config_wifiSoftapResetUserControlConfig">true</bool>
+
+ <!-- boolean indicating whether or not to reset auto shotdown configuration during cloud configuration restore -->
+ <bool translatable="false" name ="config_wifiSoftapResetAutoShutdownTimerConfig">true</bool>
+
+ <!-- boolean indicating whether or not to reset max client setting configuration during cloud configuration restore -->
+ <bool translatable="false" name ="config_wifiSoftapResetMaxClientSettingConfig">true</bool>
+
<!-- List of allowed channels in 2GHz band for softap. If the device doesn't want to restrict
channels this should be empty. Values is a comma separated channel string and/or channel
range string like '1-6,11'. -->
@@ -411,6 +422,15 @@
<!-- Integer indicating the RSSI and link layer stats polling interval in milliseconds when device is connected and screen is on -->
<integer translatable="false" name="config_wifiPollRssiIntervalMilliseconds">3000</integer>
+ <!-- Override channel utilization estimation with fixed value -->
+ <bool translatable="false" name="config_wifiChannelUtilizationOverrideEnabled">true</bool>
+ <!-- Integer values represent the channel utilization in different RF bands when
+ config_wifiChannelUtilizationOverridingEnabled is true.
+ They should be set to [0, 255] corresponding to utilization ratio between 0 and 1 -->
+ <integer translatable="false" name="config_wifiChannelUtilizationOverride2g">80</integer>
+ <integer translatable="false" name="config_wifiChannelUtilizationOverride5g">15</integer>
+ <integer translatable="false" name="config_wifiChannelUtilizationOverride6g">10</integer>
+
<!-- Enable WPA2 to WPA3 auto-upgrade -->
<bool translatable="false" name="config_wifiSaeUpgradeEnabled">true</bool>
diff --git a/service/res/values/overlayable.xml b/service/res/values/overlayable.xml
index bf96fde..a4b7011 100644
--- a/service/res/values/overlayable.xml
+++ b/service/res/values/overlayable.xml
@@ -58,6 +58,10 @@
<item type="integer" name="config_wifiFrameworkScoreGoodRssiThreshold6ghz" />
<item type="integer" name="config_wifiFrameworkSoftApShutDownTimeoutMilliseconds" />
<item type="bool" name="config_wifiSoftapResetChannelConfig" />
+ <item type="bool" name="config_wifiSoftapResetHiddenConfig" />
+ <item type="bool" name="config_wifiSoftapResetUserControlConfig" />
+ <item type="bool" name="config_wifiSoftapResetAutoShutdownTimerConfig" />
+ <item type="bool" name="config_wifiSoftapResetMaxClientSettingConfig" />
<item type="string" name="config_wifiSoftap2gChannelList" />
<item type="string" name="config_wifiSoftap5gChannelList" />
<item type="string" name="config_wifiSoftap6gChannelList" />
@@ -128,6 +132,10 @@
<item type="integer" name="config_wifiHighMovementNetworkSelectionOptimizationRssiDelta" />
<item type="integer" name="config_wifiRttBackgroundExecGapMs" />
<item type="integer" name="config_wifiPollRssiIntervalMilliseconds" />
+ <item type="bool" name="config_wifiChannelUtilizationOverrideEnabled" />
+ <item type="integer" name="config_wifiChannelUtilizationOverride2g" />
+ <item type="integer" name="config_wifiChannelUtilizationOverride5g" />
+ <item type="integer" name="config_wifiChannelUtilizationOverride6g" />
<item type="bool" name="config_wifiSaeUpgradeEnabled" />
<item type="bool" name="config_wifiSaeUpgradeOffloadEnabled" />
<item type="integer" name="config_wifiMaxNativeFailureSelfRecoveryPerHour" />
diff --git a/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java b/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java
index 99cd2db..ddd8fe5 100644
--- a/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SoftApManagerTest.java
@@ -1190,6 +1190,92 @@
}
@Test
+ public void testClientConnectFailureWhenClientInBlcokedListAndClientAuthorizationDisabled()
+ throws Exception {
+ ArrayList<MacAddress> blockedClientList = new ArrayList<>();
+ mTestSoftApCapability.setMaxSupportedClients(10);
+ Builder configBuilder = new SoftApConfiguration.Builder();
+ configBuilder.setBand(SoftApConfiguration.BAND_2GHZ);
+ configBuilder.setSsid(TEST_SSID);
+ configBuilder.setClientControlByUserEnabled(false);
+ // Client in blocked list
+ blockedClientList.add(TEST_MAC_ADDRESS);
+ configBuilder.setBlockedClientList(blockedClientList);
+ SoftApModeConfiguration apConfig =
+ new SoftApModeConfiguration(WifiManager.IFACE_IP_MODE_TETHERED,
+ configBuilder.build(), mTestSoftApCapability);
+ startSoftApAndVerifyEnabled(apConfig);
+
+ verify(mCallback).onConnectedClientsChanged(new ArrayList<>());
+
+ mSoftApListenerCaptor.getValue().onConnectedClientsChanged(
+ TEST_NATIVE_CLIENT, true);
+ mLooper.dispatchAll();
+
+ // Client is not allow verify
+ verify(mWifiNative).forceClientDisconnect(
+ TEST_INTERFACE_NAME, TEST_MAC_ADDRESS,
+ WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER);
+ verify(mWifiMetrics, never()).addSoftApNumAssociatedStationsChangedEvent(
+ 1, apConfig.getTargetMode());
+ verify(mCallback, never()).onConnectedClientsChanged(
+ Mockito.argThat((List<WifiClient> clients) ->
+ clients.contains(TEST_CONNECTED_CLIENT))
+ );
+
+ }
+
+ @Test
+ public void testClientDisconnectWhenClientInBlcokedLisUpdatedtAndClientAuthorizationDisabled()
+ throws Exception {
+ ArrayList<MacAddress> blockedClientList = new ArrayList<>();
+ mTestSoftApCapability.setMaxSupportedClients(10);
+ Builder configBuilder = new SoftApConfiguration.Builder();
+ configBuilder.setBand(SoftApConfiguration.BAND_2GHZ);
+ configBuilder.setSsid(TEST_SSID);
+ configBuilder.setClientControlByUserEnabled(false);
+ SoftApModeConfiguration apConfig =
+ new SoftApModeConfiguration(WifiManager.IFACE_IP_MODE_TETHERED,
+ configBuilder.build(), mTestSoftApCapability);
+ startSoftApAndVerifyEnabled(apConfig);
+
+ verify(mCallback).onConnectedClientsChanged(new ArrayList<>());
+
+ mSoftApListenerCaptor.getValue().onConnectedClientsChanged(
+ TEST_NATIVE_CLIENT, true);
+ mLooper.dispatchAll();
+
+ // Client connected check
+ verify(mWifiNative, never()).forceClientDisconnect(
+ TEST_INTERFACE_NAME, TEST_MAC_ADDRESS,
+ WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER);
+ verify(mWifiMetrics).addSoftApNumAssociatedStationsChangedEvent(
+ 1, apConfig.getTargetMode());
+ verify(mCallback, times(2)).onConnectedClientsChanged(
+ Mockito.argThat((List<WifiClient> clients) ->
+ clients.contains(TEST_CONNECTED_CLIENT))
+ );
+
+ reset(mCallback);
+ reset(mWifiNative);
+ // Update configuration
+ blockedClientList.add(TEST_MAC_ADDRESS);
+ configBuilder.setBlockedClientList(blockedClientList);
+ mSoftApManager.updateConfiguration(configBuilder.build());
+ mLooper.dispatchAll();
+ // Client difconnected
+ verify(mWifiNative).forceClientDisconnect(
+ TEST_INTERFACE_NAME, TEST_MAC_ADDRESS,
+ WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER);
+ // The callback should not trigger in configuration update case.
+ verify(mCallback, never()).onBlockedClientConnecting(TEST_CONNECTED_CLIENT,
+ WifiManager.SAP_CLIENT_BLOCK_REASON_CODE_BLOCKED_BY_USER);
+
+ }
+
+
+
+ @Test
public void testForceClientDisconnectInvokeBecauseClientAuthorizationEnabled()
throws Exception {
mTestSoftApCapability.setMaxSupportedClients(10);
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java b/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java
index bc646c1..90e0171 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java
@@ -659,24 +659,107 @@
@Test
public void testResetToDefaultForUnsupportedConfig() throws Exception {
- mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, false);
- mResources.setBoolean(R.bool.config_wifi_softap_sae_supported, false);
- mResources.setBoolean(R.bool.config_wifiSoftapResetChannelConfig, true);
- SoftApConfiguration sae_config = new SoftApConfiguration.Builder()
- .setPassphrase("secretsecret", SoftApConfiguration.SECURITY_TYPE_WPA3_SAE)
- .setMaxNumberOfClients(10)
- .setClientControlByUserEnabled(true)
- .setChannel(149, SoftApConfiguration.BAND_5GHZ)
- .build();
- WifiApConfigStore store = createWifiApConfigStore();
+ mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, true);
+ mResources.setBoolean(R.bool.config_wifi_softap_sae_supported, true);
+ mResources.setBoolean(R.bool.config_wifi6ghzSupport, true);
+ mResources.setBoolean(R.bool.config_wifi5ghzSupport, true);
- SoftApConfiguration resetedConfig = store.resetToDefaultForUnsupportedConfig(sae_config);
- assertEquals(resetedConfig.getMaxNumberOfClients(), 0);
- assertFalse(resetedConfig.isClientControlByUserEnabled());
+ // Test all of the features support and all of the reset config are false.
+ String testPassphrase = "secretsecret";
+ SoftApConfiguration.Builder configBuilder = new SoftApConfiguration.Builder();
+ configBuilder.setPassphrase(testPassphrase, SoftApConfiguration.SECURITY_TYPE_WPA3_SAE);
+ WifiApConfigStore store = createWifiApConfigStore();
+ SoftApConfiguration resetedConfig = store.resetToDefaultForUnsupportedConfig(
+ configBuilder.build());
+ assertEquals(resetedConfig, configBuilder.build());
+
+ verify(mWifiMetrics).noteSoftApConfigReset(configBuilder.build(), resetedConfig);
+
+ // Test SAE not support case.
+ mResources.setBoolean(R.bool.config_wifi_softap_sae_supported, false);
+ resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build());
+ assertEquals(resetedConfig.getSecurityType(), SoftApConfiguration.SECURITY_TYPE_WPA2_PSK);
+ // Test force channel
+ configBuilder.setChannel(149, SoftApConfiguration.BAND_5GHZ);
+ mResources.setBoolean(
+ R.bool.config_wifiSoftapResetChannelConfig, true);
+ resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build());
assertEquals(resetedConfig.getChannel(), 0);
assertEquals(resetedConfig.getBand(),
SoftApConfiguration.BAND_2GHZ | SoftApConfiguration.BAND_5GHZ);
- verify(mWifiMetrics).noteSoftApConfigReset(sae_config, resetedConfig);
+
+ // Test forced channel band doesn't support.
+ mResources.setBoolean(R.bool.config_wifi5ghzSupport, false);
+ resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build());
+ assertEquals(resetedConfig.getChannel(), 0);
+ assertEquals(resetedConfig.getBand(),
+ SoftApConfiguration.BAND_2GHZ);
+
+ // Test band not support with auto channel
+ configBuilder.setBand(SoftApConfiguration.BAND_5GHZ);
+ resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build());
+ assertEquals(resetedConfig.getBand(), SoftApConfiguration.BAND_2GHZ);
+
+ // Test reset hidden network
+ mResources.setBoolean(
+ R.bool.config_wifiSoftapResetHiddenConfig, true);
+ configBuilder.setHiddenSsid(true);
+ resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build());
+ assertFalse(resetedConfig.isHiddenSsid());
+
+ // Test auto shutdown timer
+ mResources.setBoolean(
+ R.bool.config_wifiSoftapResetAutoShutdownTimerConfig, true);
+ configBuilder.setShutdownTimeoutMillis(8888);
+ resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build());
+ assertEquals(resetedConfig.getShutdownTimeoutMillis(), 0);
+
+ // Test max client setting when force client disconnect doesn't support
+ mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, false);
+ configBuilder.setMaxNumberOfClients(10);
+ resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build());
+ assertEquals(resetedConfig.getMaxNumberOfClients(), 0);
+
+ // Test client control setting when force client disconnect doesn't support
+ mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, false);
+ ArrayList<MacAddress> blockedClientList = new ArrayList<>();
+ ArrayList<MacAddress> allowedClientList = new ArrayList<>();
+ blockedClientList.add(MacAddress.fromString("11:22:33:44:55:66"));
+ allowedClientList.add(MacAddress.fromString("aa:bb:cc:dd:ee:ff"));
+ configBuilder.setBlockedClientList(blockedClientList);
+ configBuilder.setAllowedClientList(allowedClientList);
+
+ configBuilder.setClientControlByUserEnabled(true);
+ resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build());
+ assertFalse(resetedConfig.isClientControlByUserEnabled());
+ // The blocked list will be clean
+ assertEquals(resetedConfig.getBlockedClientList().size(), 0);
+ // The allowed list will be keep
+ assertEquals(resetedConfig.getAllowedClientList(), allowedClientList);
+
+ // Test max client setting when reset enabled but force client disconnect supported
+ mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, true);
+ mResources.setBoolean(
+ R.bool.config_wifiSoftapResetMaxClientSettingConfig, true);
+ assertEquals(resetedConfig.getMaxNumberOfClients(), 0);
+
+ // Test client control setting when reset enabled but force client disconnect supported
+ mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, true);
+ mResources.setBoolean(
+ R.bool.config_wifiSoftapResetUserControlConfig, true);
+ resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build());
+ assertFalse(resetedConfig.isClientControlByUserEnabled());
+ assertEquals(resetedConfig.getBlockedClientList().size(), 0);
+ assertEquals(resetedConfig.getAllowedClientList(), allowedClientList);
+
+ // Test blocked list setting will be reset even if client control disabled
+ mResources.setBoolean(
+ R.bool.config_wifiSoftapResetUserControlConfig, true);
+ configBuilder.setClientControlByUserEnabled(false);
+ resetedConfig = store.resetToDefaultForUnsupportedConfig(configBuilder.build());
+ assertFalse(resetedConfig.isClientControlByUserEnabled());
+ assertEquals(resetedConfig.getBlockedClientList().size(), 0);
+ assertEquals(resetedConfig.getAllowedClientList(), allowedClientList);
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java b/tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java
index 31fc7b7..bb6ff74 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java
@@ -30,10 +30,13 @@
import static org.mockito.Mockito.*;
import static org.mockito.Mockito.validateMockitoUsage;
+import android.content.Context;
+
import androidx.test.filters.SmallTest;
import com.android.server.wifi.WifiLinkLayerStats.ChannelStats;
import com.android.server.wifi.util.InformationElementUtil.BssLoad;
+import com.android.wifi.resources.R;
import org.junit.After;
import org.junit.Before;
@@ -48,13 +51,19 @@
public class WifiChannelUtilizationTest extends WifiBaseTest {
private WifiChannelUtilization mWifiChannelUtilization;
@Mock private Clock mClock;
+ @Mock Context mContext;
+ MockResources mMockResources = new MockResources();
/**
* Called before each test
*/
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- mWifiChannelUtilization = new WifiChannelUtilization(mClock);
+ when(mContext.getResources()).thenReturn(mMockResources);
+ mMockResources.setBoolean(
+ R.bool.config_wifiChannelUtilizationOverrideEnabled,
+ false);
+ mWifiChannelUtilization = new WifiChannelUtilization(mClock, mContext);
mWifiChannelUtilization.init(null);
}
@@ -428,4 +437,23 @@
mWifiChannelUtilization.setUtilizationRatio(freq, utilizationRatio);
assertEquals(utilizationRatio, mWifiChannelUtilization.getUtilizationRatio(freq));
}
+
+ @Test
+ public void verifyOverridingUtilizationRatio() throws Exception {
+ mMockResources.setBoolean(
+ R.bool.config_wifiChannelUtilizationOverrideEnabled,
+ true);
+ mMockResources.setInteger(
+ R.integer.config_wifiChannelUtilizationOverride2g,
+ 60);
+ mMockResources.setInteger(
+ R.integer.config_wifiChannelUtilizationOverride5g,
+ 20);
+ mMockResources.setInteger(
+ R.integer.config_wifiChannelUtilizationOverride6g,
+ 10);
+ assertEquals(60, mWifiChannelUtilization.getUtilizationRatio(2412));
+ assertEquals(20, mWifiChannelUtilization.getUtilizationRatio(5810));
+ assertEquals(10, mWifiChannelUtilization.getUtilizationRatio(6710));
+ }
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index 815b3ad..d2584ad 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -4003,6 +4003,33 @@
true, // assertSuccess
WifiConfiguration.INVALID_NETWORK_ID); // Update networkID
}
+
+ /**
+ * Verifies that adding a network with a PAC or STATIC proxy, while having the
+ * {@link android.Manifest.permission#NETWORK_MANAGED_PROVISIONING} permission is successful
+ */
+ @Test
+ public void testAddNetworkWithProxyWithNetworkManagedPermission() {
+ verifyAddOrUpdateNetworkWithProxySettingsAndPermissions(
+ false, // withNetworkSettings
+ false, // withNetworkSetupWizard
+ true, // withNetworkManagedProvisioning
+ false, // withProfileOwnerPolicy
+ false, // withDeviceOwnerPolicy
+ WifiConfigurationTestUtil.createDHCPIpConfigurationWithPacProxy(),
+ true, // assertSuccess
+ WifiConfiguration.INVALID_NETWORK_ID); // Update networkID
+ verifyAddOrUpdateNetworkWithProxySettingsAndPermissions(
+ false, // withNetworkSettings
+ false, // withNetworkSetupWizard
+ true, // withNetworkManagedProvisioning
+ false, // withProfileOwnerPolicy
+ false, // withDeviceOwnerPolicy
+ WifiConfigurationTestUtil.createDHCPIpConfigurationWithStaticProxy(),
+ true, // assertSuccess
+ WifiConfiguration.INVALID_NETWORK_ID); // Update networkID
+ }
+
/**
* Verifies that updating a network (that has no proxy) and adding a PAC or STATIC proxy fails
* without being able to override configs, or holding Device or Profile owner policies.
@@ -4052,7 +4079,7 @@
verifyAddOrUpdateNetworkWithProxySettingsAndPermissions(
false, // withNetworkSettings
true, // withNetworkSetupWizard
- false, // withProfileOwnerPolicy
+ false, false, // withProfileOwnerPolicy
false, // withDeviceOwnerPolicy
WifiConfigurationTestUtil.createDHCPIpConfigurationWithPacProxy(),
true, // assertSuccess
@@ -4633,13 +4660,14 @@
boolean assertSuccess,
int networkId) {
return verifyAddOrUpdateNetworkWithProxySettingsAndPermissions(withNetworkSettings,
- false, withProfileOwnerPolicy, withDeviceOwnerPolicy, ipConfiguration,
+ false, false, withProfileOwnerPolicy, withDeviceOwnerPolicy, ipConfiguration,
assertSuccess, networkId);
}
private NetworkUpdateResult verifyAddOrUpdateNetworkWithProxySettingsAndPermissions(
boolean withNetworkSettings,
boolean withNetworkSetupWizard,
+ boolean withNetworkManagedProvisioning,
boolean withProfileOwnerPolicy,
boolean withDeviceOwnerPolicy,
IpConfiguration ipConfiguration,
@@ -4660,7 +4688,9 @@
.thenReturn(withNetworkSettings);
when(mWifiPermissionsUtil.checkNetworkSetupWizardPermission(anyInt()))
.thenReturn(withNetworkSetupWizard);
- int uid = withNetworkSettings || withNetworkSetupWizard
+ when(mWifiPermissionsUtil.checkNetworkManagedProvisioningPermission(anyInt()))
+ .thenReturn(withNetworkManagedProvisioning);
+ int uid = withNetworkSettings || withNetworkSetupWizard || withNetworkManagedProvisioning
? TEST_CREATOR_UID
: TEST_NO_PERM_UID;
NetworkUpdateResult result = addNetworkToWifiConfigManager(network, uid);
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java b/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java
index 61979f1..de1e5cb 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java
@@ -212,7 +212,7 @@
}
/**
- * Verify throughtput when Rx link speed is unavailable.
+ * Verify throughput when Rx link speed is unavailable.
* Also verify the logging of channel utilization and throughput.
*/
@Test
@@ -342,7 +342,7 @@
assertEquals(WifiIsUnusableEvent.TYPE_UNKNOWN, mWifiDataStall
.checkDataStallAndThroughputSufficiency(mOldLlStats, mNewLlStats, mWifiInfo));
assertEquals(true, mWifiDataStall.isThroughputSufficient());
- assertEquals(4804, mWifiDataStall.getTxThroughputKbps());
+ assertEquals(9128, mWifiDataStall.getTxThroughputKbps());
assertEquals(-1, mWifiDataStall.getRxThroughputKbps());
verify(mWifiMetrics, never()).logWifiIsUnusableEvent(anyInt());
}
@@ -400,7 +400,7 @@
assertEquals(WifiIsUnusableEvent.TYPE_UNKNOWN, mWifiDataStall
.checkDataStallAndThroughputSufficiency(mOldLlStats, mNewLlStats, mWifiInfo));
assertEquals(true, mWifiDataStall.isThroughputSufficient());
- assertEquals(4707, mWifiDataStall.getTxThroughputKbps());
+ assertEquals(8943, mWifiDataStall.getTxThroughputKbps());
assertEquals(9414, mWifiDataStall.getRxThroughputKbps());
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 198eb07..4e895e4 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -1762,10 +1762,11 @@
assertEquals(1, mDecodedProto.connectionEvent.length);
assertEquals(WifiMetricsProto.ConnectionEvent.TYPE_OPEN,
mDecodedProto.connectionEvent[0].networkType);
+ assertFalse(mDecodedProto.connectionEvent[0].isOsuProvisioned);
}
/**
- * Verify the ConnectionEvent is labeled with networkType passpoint correctly.
+ * Verify the ConnectionEvent is labeled with networkType Passpoint correctly.
*/
@Test
public void testConnectionNetworkTypePasspoint() throws Exception {
@@ -1781,6 +1782,7 @@
assertEquals(1, mDecodedProto.connectionEvent.length);
assertEquals(WifiMetricsProto.ConnectionEvent.TYPE_PASSPOINT,
mDecodedProto.connectionEvent[0].networkType);
+ assertFalse(mDecodedProto.connectionEvent[0].isOsuProvisioned);
}
/**
@@ -4995,4 +4997,26 @@
assertEquals(2, mDecodedProto.carrierWifiMetrics.numConnectionAuthFailure);
assertEquals(3, mDecodedProto.carrierWifiMetrics.numConnectionNonAuthFailure);
}
+
+ /**
+ * Verify the ConnectionEvent is labeled with networkType Passpoint correctly and that the OSU
+ * provisioned flag is set to true.
+ */
+ @Test
+ public void testConnectionNetworkTypePasspointFromOsu() throws Exception {
+ WifiConfiguration config = WifiConfigurationTestUtil.createPasspointNetwork();
+ config.updateIdentifier = "7";
+ mWifiMetrics.startConnectionEvent(config, "RED",
+ WifiMetricsProto.ConnectionEvent.ROAM_NONE);
+ mWifiMetrics.endConnectionEvent(
+ WifiMetrics.ConnectionEvent.FAILURE_ASSOCIATION_TIMED_OUT,
+ WifiMetricsProto.ConnectionEvent.HLF_NONE,
+ WifiMetricsProto.ConnectionEvent.FAILURE_REASON_UNKNOWN);
+ dumpProtoAndDeserialize();
+
+ assertEquals(1, mDecodedProto.connectionEvent.length);
+ assertEquals(WifiMetricsProto.ConnectionEvent.TYPE_PASSPOINT,
+ mDecodedProto.connectionEvent[0].networkType);
+ assertTrue(mDecodedProto.connectionEvent[0].isOsuProvisioned);
+ }
}