summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/Android.bp13
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java29
-rw-r--r--service/java/com/android/server/wifi/FrameworkFacade.java4
-rw-r--r--service/java/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreData.java3
-rw-r--r--service/java/com/android/server/wifi/NetworkListStoreData.java13
-rw-r--r--service/java/com/android/server/wifi/NetworkRequestStoreData.java4
-rw-r--r--service/java/com/android/server/wifi/NetworkSuggestionStoreData.java4
-rw-r--r--service/java/com/android/server/wifi/RandomizedMacStoreData.java4
-rw-r--r--service/java/com/android/server/wifi/SoftApNotifier.java7
-rw-r--r--service/java/com/android/server/wifi/SoftApStoreData.java13
-rw-r--r--service/java/com/android/server/wifi/SsidSetStoreData.java4
-rw-r--r--service/java/com/android/server/wifi/WakeupConfigStoreData.java4
-rw-r--r--service/java/com/android/server/wifi/WifiApConfigStore.java32
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java18
-rw-r--r--service/java/com/android/server/wifi/WifiConfigStore.java202
-rw-r--r--service/java/com/android/server/wifi/WifiConfigStoreMigrationDataHolder.java73
-rw-r--r--service/java/com/android/server/wifi/WifiDiagnostics.java2
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java3
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java25
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java1
-rw-r--r--service/java/com/android/server/wifi/WifiSettingsConfigStore.java3
-rw-r--r--service/java/com/android/server/wifi/hotspot2/PasspointConfigSharedStoreData.java5
-rw-r--r--service/java/com/android/server/wifi/hotspot2/PasspointConfigUserStoreData.java5
-rw-r--r--service/java/com/android/server/wifi/util/Environment.java51
-rw-r--r--service/proto/src/metrics.proto6
-rw-r--r--service/res/values/strings.xml5
-rw-r--r--service/tests/wifitests/Android.bp3
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java5
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java4
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java20
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/NetworkRequestStoreDataTest.java3
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/NetworkSuggestionStoreDataTest.java3
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/RandomizedMacStoreDataTest.java3
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/SoftApStoreDataTest.java69
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/SsidSetStoreDataTest.java3
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/WakeupConfigStoreDataTest.java6
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java3
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java24
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java21
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java70
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java22
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java1
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java3
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/WifiSettingsConfigStoreTest.java3
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigSharedStoreDataTest.java4
-rw-r--r--service/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigUserStoreDataTest.java4
46 files changed, 373 insertions, 434 deletions
diff --git a/service/Android.bp b/service/Android.bp
index 43b4b351b9..22cb3a5435 100644
--- a/service/Android.bp
+++ b/service/Android.bp
@@ -52,20 +52,16 @@ java_library {
// java_api_finder must accompany `srcs`
plugins: ["java_api_finder"],
- // TODO(b/140299412) should be "system_server_current" since Wifi module is not allowed to use
- // @CorePlatformApi's
- sdk_version: "core_platform",
+ sdk_version: "system_server_current",
libs: [
"error_prone_annotations",
"jsr305",
"framework-annotations-lib",
- "services-stubs", // TODO(b/140299412): remove
// load the resources from the resources APK.
"wifi-service-resources",
// need pre-jarjar symbols so that wifi-service can reference the original class names at
// compile time
"framework-wifi-pre-jarjar",
- "android_module_lib_stubs_current", // TODO(b/140299412): remove
"framework-statsd-stubs-module_libs_api",
"framework-telephony-stubs",
"unsupportedappusage",
@@ -111,14 +107,9 @@ java_library {
// need to include `libs` so that Soong doesn't complain about missing classes after jarjaring
libs: [
"framework-wifi",
- "android_module_lib_stubs_current",
- "services-stubs",
- "framework-telephony-stubs",
],
- // TODO(b/140299412) should be "core_current" since Wifi module is not allowed to use
- // @CorePlatformApi's
- sdk_version: "core_platform",
+ sdk_version: "system_server_current",
jarjar_rules: ":wifi-jarjar-rules",
optimize: {
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 76b089d795..f5f96a1345 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -2642,6 +2642,8 @@ public class ClientModeImpl extends StateMachine {
mWifiInfo.setWifiStandard(capabilities.wifiStandard);
mWifiInfo.setMaxSupportedTxLinkSpeedMbps(maxTxLinkSpeedMbps);
mWifiInfo.setMaxSupportedRxLinkSpeedMbps(maxRxLinkSpeedMbps);
+ mWifiMetrics.setConnectionMaxSupportedLinkSpeedMbps(
+ maxTxLinkSpeedMbps, maxRxLinkSpeedMbps);
mWifiDataStall.setConnectionCapabilities(capabilities);
if (mVerboseLoggingEnabled) {
StringBuilder sb = new StringBuilder();
@@ -3894,7 +3896,12 @@ public class ClientModeImpl extends StateMachine {
// Pair<identity, encrypted identity>
Pair<String, String> identityPair = mTelephonyUtil
.getSimIdentity(mTargetWifiConfiguration);
- Log.i(TAG, "SUP_REQUEST_IDENTITY: identityPair=" + identityPair);
+ Log.i(TAG, "SUP_REQUEST_IDENTITY: identityPair=["
+ + ((identityPair.first.length() >= 7)
+ ? identityPair.first.substring(0, 7 /* Prefix+PLMN ID */) + "****"
+ : identityPair.first) + ", "
+ + (!TextUtils.isEmpty(identityPair.second) ? identityPair.second
+ : "<NONE>") + "]");
if (identityPair != null && identityPair.first != null) {
mWifiNative.simIdentityResponse(mInterfaceName, identityPair.first,
identityPair.second);
@@ -4341,6 +4348,7 @@ public class ClientModeImpl extends StateMachine {
}
result.setOwnerUid(currentWifiConfiguration.creatorUid);
+ result.setAdministratorUids(new int[] {currentWifiConfiguration.creatorUid});
if (!WifiConfiguration.isMetered(currentWifiConfiguration, mWifiInfo)) {
result.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
@@ -6326,6 +6334,15 @@ public class ClientModeImpl extends StateMachine {
}
}
+ private void setConfigurationsPriorToIpClientProvisioning(WifiConfiguration config) {
+ mIpClient.setHttpProxy(config.getHttpProxy());
+ if (!TextUtils.isEmpty(mContext.getResources().getString(
+ R.string.config_wifi_tcp_buffers))) {
+ mIpClient.setTcpBufferSizes(mContext.getResources().getString(
+ R.string.config_wifi_tcp_buffers));
+ }
+ }
+
private boolean startIpClient(WifiConfiguration config, boolean isFilsConnection) {
if (mIpClient == null) {
return false;
@@ -6348,6 +6365,7 @@ public class ClientModeImpl extends StateMachine {
mWifiNative.flushAllHlp(mInterfaceName);
return false;
}
+ setConfigurationsPriorToIpClientProvisioning(config);
final ProvisioningConfiguration prov =
new ProvisioningConfiguration.Builder()
.withPreDhcpAction()
@@ -6372,14 +6390,7 @@ public class ClientModeImpl extends StateMachine {
// connectivity APIs such as getActiveNetworkInfo should not return
// CONNECTED.
stopDhcpSetup();
-
- mIpClient.setHttpProxy(config.getHttpProxy());
- if (!TextUtils.isEmpty(mContext.getResources().getString(
- R.string.config_wifi_tcp_buffers))) {
- mIpClient.setTcpBufferSizes(mContext.getResources().getString(
- R.string.config_wifi_tcp_buffers));
- }
-
+ setConfigurationsPriorToIpClientProvisioning(config);
ScanDetailCache scanDetailCache =
mWifiConfigManager.getScanDetailCacheForNetwork(config.networkId);
ScanResult scanResult = null;
diff --git a/service/java/com/android/server/wifi/FrameworkFacade.java b/service/java/com/android/server/wifi/FrameworkFacade.java
index 20c27d70bd..0262cc32bd 100644
--- a/service/java/com/android/server/wifi/FrameworkFacade.java
+++ b/service/java/com/android/server/wifi/FrameworkFacade.java
@@ -22,6 +22,7 @@ import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.Notification;
import android.app.PendingIntent;
+import android.app.admin.DevicePolicyManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -121,7 +122,8 @@ public class FrameworkFacade {
* Returns whether the device is in NIAP mode or not.
*/
public boolean isNiapModeOn(Context context) {
- return getIntegerSetting(context, Settings.Global.COMMON_CRITERIA_MODE, 0) == 1;
+ return context.getSystemService(DevicePolicyManager.class)
+ .isCommonCriteriaModeEnabled(null);
}
/**
diff --git a/service/java/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreData.java b/service/java/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreData.java
index 065ccf1db3..acfba80c5b 100644
--- a/service/java/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreData.java
+++ b/service/java/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreData.java
@@ -88,8 +88,7 @@ public class ImsiPrivacyProtectionExemptionStoreData implements WifiConfigStore.
@Override
public void deserializeData(XmlPullParser in, int outerTagDepth, int version,
- WifiConfigStoreEncryptionUtil encryptionUtil,
- WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
// Ignore empty reads.
if (in == null) {
diff --git a/service/java/com/android/server/wifi/NetworkListStoreData.java b/service/java/com/android/server/wifi/NetworkListStoreData.java
index 4c2bf77824..33c511ba44 100644
--- a/service/java/com/android/server/wifi/NetworkListStoreData.java
+++ b/service/java/com/android/server/wifi/NetworkListStoreData.java
@@ -18,7 +18,6 @@ package com.android.server.wifi;
import static com.android.server.wifi.WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.net.IpConfiguration;
@@ -82,18 +81,8 @@ public abstract class NetworkListStoreData implements WifiConfigStore.StoreData
@Override
public void deserializeData(XmlPullParser in, int outerTagDepth,
@WifiConfigStore.Version int version,
- @Nullable WifiConfigStoreEncryptionUtil encryptionUtil,
- @NonNull WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ @Nullable WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
- // Check if we have data to migrate from OEM, if yes skip loading the section from the file.
- List<WifiConfiguration> oemMigratedConfigurations =
- storeMigrationDataHolder.getUserSavedNetworks();
- if (oemMigratedConfigurations != null) {
- Log.i(TAG, "Loading data from OEM migration hook");
- mConfigurations = oemMigratedConfigurations;
- return;
- }
-
// Ignore empty reads.
if (in == null) {
return;
diff --git a/service/java/com/android/server/wifi/NetworkRequestStoreData.java b/service/java/com/android/server/wifi/NetworkRequestStoreData.java
index 7d06a70e15..763f267b94 100644
--- a/service/java/com/android/server/wifi/NetworkRequestStoreData.java
+++ b/service/java/com/android/server/wifi/NetworkRequestStoreData.java
@@ -16,7 +16,6 @@
package com.android.server.wifi;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.net.MacAddress;
import android.util.Log;
@@ -99,8 +98,7 @@ public class NetworkRequestStoreData implements WifiConfigStore.StoreData {
@Override
public void deserializeData(XmlPullParser in, int outerTagDepth,
@WifiConfigStore.Version int version,
- @Nullable WifiConfigStoreEncryptionUtil encryptionUtil,
- @NonNull WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ @Nullable WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
// Ignore empty reads.
if (in == null) {
diff --git a/service/java/com/android/server/wifi/NetworkSuggestionStoreData.java b/service/java/com/android/server/wifi/NetworkSuggestionStoreData.java
index 169e87db9e..8de575888a 100644
--- a/service/java/com/android/server/wifi/NetworkSuggestionStoreData.java
+++ b/service/java/com/android/server/wifi/NetworkSuggestionStoreData.java
@@ -18,7 +18,6 @@ package com.android.server.wifi;
import static com.android.server.wifi.WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiEnterpriseConfig;
@@ -121,8 +120,7 @@ public class NetworkSuggestionStoreData implements WifiConfigStore.StoreData {
@Override
public void deserializeData(XmlPullParser in, int outerTagDepth,
@WifiConfigStore.Version int version,
- @Nullable WifiConfigStoreEncryptionUtil encryptionUtil,
- @NonNull WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ @Nullable WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
// Ignore empty reads.
if (in == null) {
diff --git a/service/java/com/android/server/wifi/RandomizedMacStoreData.java b/service/java/com/android/server/wifi/RandomizedMacStoreData.java
index 8c7c9bd837..a03be60563 100644
--- a/service/java/com/android/server/wifi/RandomizedMacStoreData.java
+++ b/service/java/com/android/server/wifi/RandomizedMacStoreData.java
@@ -16,7 +16,6 @@
package com.android.server.wifi;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.util.Log;
@@ -57,8 +56,7 @@ public class RandomizedMacStoreData implements WifiConfigStore.StoreData {
@Override
public void deserializeData(XmlPullParser in, int outerTagDepth,
@WifiConfigStore.Version int version,
- @Nullable WifiConfigStoreEncryptionUtil encryptionUtil,
- @NonNull WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ @Nullable WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
// Ignore empty reads.
if (in == null) {
diff --git a/service/java/com/android/server/wifi/SoftApNotifier.java b/service/java/com/android/server/wifi/SoftApNotifier.java
index 3a9e227f59..741cab82ec 100644
--- a/service/java/com/android/server/wifi/SoftApNotifier.java
+++ b/service/java/com/android/server/wifi/SoftApNotifier.java
@@ -69,13 +69,10 @@ public class SoftApNotifier {
}
private Notification buildSoftApShutDownTimeoutExpiredNotification() {
- // TODO: b/146571220 Check UI wording
String title = mContext.getResources().getString(
R.string.wifi_softap_auto_shutdown_timeout_expired_title);
String contentSummary = mContext.getResources().getString(
R.string.wifi_softap_auto_shutdown_timeout_expired_summary);
- String content = mContext.getResources().getString(
- R.string.wifi_softap_auto_shutdown_timeout_expired_detail);
return mFrameworkFacade.makeNotificationBuilder(mContext,
WifiService.NOTIFICATION_NETWORK_STATUS)
@@ -89,10 +86,6 @@ public class SoftApNotifier {
.setLocalOnly(true)
.setColor(mContext.getResources().getColor(
android.R.color.system_notification_accent_color, mContext.getTheme()))
- .setStyle(new Notification.BigTextStyle()
- .bigText(content)
- .setBigContentTitle(title)
- .setSummaryText(contentSummary))
.setAutoCancel(true)
.build();
}
diff --git a/service/java/com/android/server/wifi/SoftApStoreData.java b/service/java/com/android/server/wifi/SoftApStoreData.java
index 299f51507b..ac32ae66a9 100644
--- a/service/java/com/android/server/wifi/SoftApStoreData.java
+++ b/service/java/com/android/server/wifi/SoftApStoreData.java
@@ -16,7 +16,6 @@
package com.android.server.wifi;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.net.MacAddress;
@@ -143,18 +142,8 @@ public class SoftApStoreData implements WifiConfigStore.StoreData {
@Override
public void deserializeData(XmlPullParser in, int outerTagDepth,
@WifiConfigStore.Version int version,
- @Nullable WifiConfigStoreEncryptionUtil encryptionUtil,
- @NonNull WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ @Nullable WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
- // Check if we have data to migrate from OEM, if yes skip loading the section from the file.
- SoftApConfiguration oemMigratedConfiguration =
- storeMigrationDataHolder.getUserSoftApConfiguration();
- if (oemMigratedConfiguration != null) {
- Log.i(TAG, "Loading data from OEM migration hook");
- mDataSource.fromDeserialized(oemMigratedConfiguration);
- return;
- }
-
// Ignore empty reads.
if (in == null) {
return;
diff --git a/service/java/com/android/server/wifi/SsidSetStoreData.java b/service/java/com/android/server/wifi/SsidSetStoreData.java
index e5636f6031..e3374ddbe4 100644
--- a/service/java/com/android/server/wifi/SsidSetStoreData.java
+++ b/service/java/com/android/server/wifi/SsidSetStoreData.java
@@ -16,7 +16,6 @@
package com.android.server.wifi;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;
@@ -91,8 +90,7 @@ public class SsidSetStoreData implements WifiConfigStore.StoreData {
@Override
public void deserializeData(XmlPullParser in, int outerTagDepth,
@WifiConfigStore.Version int version,
- @Nullable WifiConfigStoreEncryptionUtil encryptionUtil,
- @NonNull WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ @Nullable WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
// Ignore empty reads.
if (in == null) {
diff --git a/service/java/com/android/server/wifi/WakeupConfigStoreData.java b/service/java/com/android/server/wifi/WakeupConfigStoreData.java
index f828930b6f..074393b81c 100644
--- a/service/java/com/android/server/wifi/WakeupConfigStoreData.java
+++ b/service/java/com/android/server/wifi/WakeupConfigStoreData.java
@@ -16,7 +16,6 @@
package com.android.server.wifi;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.util.ArraySet;
import android.util.Log;
@@ -147,8 +146,7 @@ public class WakeupConfigStoreData implements StoreData {
@Override
public void deserializeData(XmlPullParser in, int outerTagDepth,
@WifiConfigStore.Version int version,
- @Nullable WifiConfigStoreEncryptionUtil encryptionUtil,
- @NonNull WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ @Nullable WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
if (!mHasBeenRead) {
Log.d(TAG, "WifiWake user data has been read");
diff --git a/service/java/com/android/server/wifi/WifiApConfigStore.java b/service/java/com/android/server/wifi/WifiApConfigStore.java
index 660c99b309..e5d12822b9 100644
--- a/service/java/com/android/server/wifi/WifiApConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiApConfigStore.java
@@ -23,6 +23,7 @@ import android.net.MacAddress;
import android.net.util.MacAddressUtils;
import android.net.wifi.SoftApConfiguration;
import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiMigration;
import android.os.Handler;
import android.os.Process;
import android.text.TextUtils;
@@ -30,15 +31,12 @@ import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.wifi.util.ApConfigUtil;
-import com.android.server.wifi.util.Environment;
import com.android.wifi.resources.R;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.Random;
@@ -122,7 +120,8 @@ public class WifiApConfigStore {
WifiConfigManager wifiConfigManager, ActiveModeWarden activeModeWarden) {
this(context, wifiInjector, handler, backupManagerProxy, wifiConfigStore,
wifiConfigManager, activeModeWarden,
- new File(Environment.getLegacyWifiSharedDirectory(), LEGACY_AP_CONFIG_FILE));
+ WifiMigration.convertAndRetrieveSharedConfigStoreFile(
+ WifiMigration.STORE_FILE_SHARED_SOFTAP));
}
WifiApConfigStore(Context context,
@@ -132,7 +131,7 @@ public class WifiApConfigStore {
WifiConfigStore wifiConfigStore,
WifiConfigManager wifiConfigManager,
ActiveModeWarden activeModeWarden,
- File apConfigFile) {
+ InputStream legacyApConfigFileStream) {
mContext = context;
mHandler = handler;
mBackupManagerProxy = backupManagerProxy;
@@ -140,20 +139,21 @@ public class WifiApConfigStore {
mActiveModeWarden = activeModeWarden;
// One time migration from legacy config store.
- try {
- File file = apConfigFile;
- FileInputStream fis = new FileInputStream(apConfigFile);
+ // TODO (b/149418926): softap migration needs to be fixed. Move the logic
+ // below to WifiMigration. This is to allow OEM's who have been supporting some new AOSP R
+ // features like blocklist/allowlist in Q and stored the data using the old key/value
+ // format.
+ if (legacyApConfigFileStream != null) {
/* Load AP configuration from persistent storage. */
- SoftApConfiguration config = loadApConfigurationFromLegacyFile(fis);
+ SoftApConfiguration config =
+ loadApConfigurationFromLegacyFile(legacyApConfigFileStream);
if (config != null) {
// Persist in the new store.
persistConfigAndTriggerBackupManagerProxy(config);
- Log.i(TAG, "Migrated data out of legacy store file " + apConfigFile);
- // delete the legacy file.
- file.delete();
+ Log.i(TAG, "Migrated data out of legacy store file");
+ WifiMigration.removeSharedConfigStoreFile(
+ WifiMigration.STORE_FILE_SHARED_SOFTAP);
}
- } catch (FileNotFoundException e) {
- // Expected on further reboots after the first reboot.
}
// Register store data listener
@@ -271,7 +271,7 @@ public class WifiApConfigStore {
* Load AP configuration from legacy persistent storage.
* Note: This is deprecated and only used for migrating data once on reboot.
*/
- private static SoftApConfiguration loadApConfigurationFromLegacyFile(FileInputStream fis) {
+ private static SoftApConfiguration loadApConfigurationFromLegacyFile(InputStream fis) {
SoftApConfiguration config = null;
DataInputStream in = null;
try {
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index c4cb51c0b1..db7e4c091a 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -404,7 +404,7 @@ public class WifiConfigManager {
/**
* Determine if the framework should perform "aggressive" MAC randomization when connecting
- * to the SSID in the input WifiConfiguration.
+ * to the SSID or FQDN in the input WifiConfiguration.
* @param config
* @return
*/
@@ -416,20 +416,24 @@ public class WifiConfigManager {
if (config.getIpConfiguration().getIpAssignment() == IpConfiguration.IpAssignment.STATIC) {
return false;
}
- return isSsidOptInForAggressiveRandomization(config.SSID);
+ if (config.isPasspoint()) {
+ return isNetworkOptInForAggressiveRandomization(config.FQDN);
+ } else {
+ return isNetworkOptInForAggressiveRandomization(config.SSID);
+ }
}
- private boolean isSsidOptInForAggressiveRandomization(String ssid) {
+ private boolean isNetworkOptInForAggressiveRandomization(String ssidOrFqdn) {
Set<String> perDeviceSsidBlocklist = new ArraySet<>(mContext.getResources().getStringArray(
R.array.config_wifi_aggressive_randomization_ssid_blocklist));
- if (mDeviceConfigFacade.getAggressiveMacRandomizationSsidBlocklist().contains(ssid)
- || perDeviceSsidBlocklist.contains(ssid)) {
+ if (mDeviceConfigFacade.getAggressiveMacRandomizationSsidBlocklist().contains(ssidOrFqdn)
+ || perDeviceSsidBlocklist.contains(ssidOrFqdn)) {
return false;
}
Set<String> perDeviceSsidAllowlist = new ArraySet<>(mContext.getResources().getStringArray(
R.array.config_wifi_aggressive_randomization_ssid_allowlist));
- return mDeviceConfigFacade.getAggressiveMacRandomizationSsidAllowlist().contains(ssid)
- || perDeviceSsidAllowlist.contains(ssid);
+ return mDeviceConfigFacade.getAggressiveMacRandomizationSsidAllowlist().contains(ssidOrFqdn)
+ || perDeviceSsidAllowlist.contains(ssidOrFqdn);
}
@VisibleForTesting
diff --git a/service/java/com/android/server/wifi/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java
index f2f48be1f6..a891b05881 100644
--- a/service/java/com/android/server/wifi/WifiConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiConfigStore.java
@@ -23,7 +23,9 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.AlarmManager;
import android.content.Context;
+import android.net.wifi.WifiMigration;
import android.os.Handler;
+import android.os.UserHandle;
import android.util.AtomicFile;
import android.util.Log;
import android.util.SparseArray;
@@ -49,11 +51,11 @@ import java.io.FileDescriptor;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -190,7 +192,6 @@ public class WifiConfigStore {
*/
private final Clock mClock;
private final WifiMetrics mWifiMetrics;
- private final WifiConfigStoreMigrationDataHolder mStoreMigrationDataHolder;
/**
* Shared config store file instance. There are 2 shared store files:
* {@link #STORE_FILE_NAME_SHARED_GENERAL} & {@link #STORE_FILE_NAME_SHARED_SOFTAP}.
@@ -236,20 +237,17 @@ public class WifiConfigStore {
* @param handler handler instance to post alarm timeouts to.
* @param clock clock instance to retrieve timestamps for alarms.
* @param wifiMetrics Metrics instance.
- * @param storeMigrationDataHolder Needed for migration data out of OEM stores.
* @param sharedStores List of {@link StoreFile} instances pointing to the shared store files.
* This should be retrieved using {@link #createSharedFiles(boolean)}
* method.
*/
public WifiConfigStore(Context context, Handler handler, Clock clock, WifiMetrics wifiMetrics,
- WifiConfigStoreMigrationDataHolder storeMigrationDataHolder,
List<StoreFile> sharedStores) {
mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
mEventHandler = handler;
mClock = clock;
mWifiMetrics = wifiMetrics;
- mStoreMigrationDataHolder = storeMigrationDataHolder;
mStoreDataList = new ArrayList<>();
// Initialize the store files.
@@ -292,19 +290,6 @@ public class WifiConfigStore {
return true;
}
- private static void copyLegacyStoreFileIfNeeded(File legacyStoreFile, File storeFile) {
- try {
- // If the new store file exists, nothing to copy.
- if (storeFile.exists()) return;
- // If the legacy file does not exist, nothing to copy.
- if (!legacyStoreFile.exists()) return;
- Log.d(TAG, "Copying wifi store file from " + legacyStoreFile + " to " + storeFile);
- Files.copy(legacyStoreFile.toPath(), storeFile.toPath());
- } catch (SecurityException | IOException e) {
- Log.e(TAG, "Failed to copy the legacy store file", e);
- }
- }
-
/**
* Helper method to create a store file instance for either the shared store or user store.
* Note: The method creates the store directory if not already present. This may be needed for
@@ -312,15 +297,13 @@ public class WifiConfigStore {
*
* @param storeDir Base directory under which the store file is to be stored. The store file
* will be at <storeDir>/WifiConfigStore.xml.
- * @param legacyStoreDir Base directory under which the store file was stored. The store file
- * will be at <storeDir>/WifiConfigStore.xml. This is needed to perform
- * a one time migration of the files from this folder to |storeDir|.
* @param fileId Identifier for the file. See {@link StoreFileId}.
+ * @param userHandle User handle. Meaningful only for user specific store files.
* @param shouldEncryptCredentials Whether to encrypt credentials or not.
* @return new instance of the store file or null if the directory cannot be created.
*/
- private static @Nullable StoreFile createFile(File storeDir, File legacyStoreDir,
- @StoreFileId int fileId, boolean shouldEncryptCredentials) {
+ private static @Nullable StoreFile createFile(@NonNull File storeDir,
+ @StoreFileId int fileId, UserHandle userHandle, boolean shouldEncryptCredentials) {
if (!storeDir.exists()) {
if (!storeDir.mkdir()) {
Log.w(TAG, "Could not create store directory " + storeDir);
@@ -328,24 +311,19 @@ public class WifiConfigStore {
}
}
File file = new File(storeDir, STORE_ID_TO_FILE_NAME.get(fileId));
- // Note: This performs a one time migration of the existing wifi config store files
- // from the old /data/misc/wifi & /data/misc_ce/<userId>/wifi folder to the
- // wifi apex folder.
- copyLegacyStoreFileIfNeeded(
- new File(legacyStoreDir, STORE_ID_TO_FILE_NAME.get(fileId)), file);
WifiConfigStoreEncryptionUtil encryptionUtil = null;
if (shouldEncryptCredentials) {
encryptionUtil = new WifiConfigStoreEncryptionUtil(file.getName());
}
- return new StoreFile(file, fileId, encryptionUtil);
+ return new StoreFile(file, fileId, userHandle, encryptionUtil);
}
- private static @Nullable List<StoreFile> createFiles(File storeDir, File legacyStoreDir,
- List<Integer> storeFileIds, boolean shouldEncryptCredentials) {
+ private static @Nullable List<StoreFile> createFiles(File storeDir, List<Integer> storeFileIds,
+ UserHandle userHandle, boolean shouldEncryptCredentials) {
List<StoreFile> storeFiles = new ArrayList<>();
for (int fileId : storeFileIds) {
StoreFile storeFile =
- createFile(storeDir, legacyStoreDir, fileId, shouldEncryptCredentials);
+ createFile(storeDir, fileId, userHandle, shouldEncryptCredentials);
if (storeFile == null) {
return null;
}
@@ -363,8 +341,8 @@ public class WifiConfigStore {
public static @NonNull List<StoreFile> createSharedFiles(boolean shouldEncryptCredentials) {
return createFiles(
Environment.getWifiSharedDirectory(),
- Environment.getLegacyWifiSharedDirectory(),
Arrays.asList(STORE_FILE_SHARED_GENERAL, STORE_FILE_SHARED_SOFTAP),
+ UserHandle.ALL,
shouldEncryptCredentials);
}
@@ -379,10 +357,11 @@ public class WifiConfigStore {
*/
public static @Nullable List<StoreFile> createUserFiles(int userId,
boolean shouldEncryptCredentials) {
+ UserHandle userHandle = UserHandle.of(userId);
return createFiles(
Environment.getWifiUserDirectory(userId),
- Environment.getLegacyWifiUserDirectory(userId),
Arrays.asList(STORE_FILE_USER_GENERAL, STORE_FILE_USER_NETWORK_SUGGESTIONS),
+ userHandle,
shouldEncryptCredentials);
}
@@ -540,6 +519,127 @@ public class WifiConfigStore {
}
/**
+ * Note: This is a copy of {@link AtomicFile#readFully()} modified to use the passed in
+ * {@link InputStream} which was returned using {@link AtomicFile#openRead()}.
+ */
+ private static byte[] readAtomicFileFully(InputStream stream) throws IOException {
+ try {
+ int pos = 0;
+ int avail = stream.available();
+ byte[] data = new byte[avail];
+ while (true) {
+ int amt = stream.read(data, pos, data.length - pos);
+ if (amt <= 0) {
+ return data;
+ }
+ pos += amt;
+ avail = stream.available();
+ if (avail > data.length - pos) {
+ byte[] newData = new byte[pos + avail];
+ System.arraycopy(data, 0, newData, 0, pos);
+ data = newData;
+ }
+ }
+ } finally {
+ stream.close();
+ }
+ }
+
+ /**
+ * Conversion for file id's to use in WifiMigration API surface.
+ */
+ private static Integer getMigrationStoreFileId(@StoreFileId int fileId) {
+ switch (fileId) {
+ case STORE_FILE_SHARED_GENERAL:
+ return WifiMigration.STORE_FILE_SHARED_GENERAL;
+ case STORE_FILE_SHARED_SOFTAP:
+ // TODO (b/149418926): softap migration needs to be fixed.
+ return null;
+ case STORE_FILE_USER_GENERAL:
+ return WifiMigration.STORE_FILE_USER_GENERAL;
+ case STORE_FILE_USER_NETWORK_SUGGESTIONS:
+ return WifiMigration.STORE_FILE_USER_NETWORK_SUGGESTIONS;
+ default:
+ return null;
+ }
+ }
+
+ private static byte[] readDataFromMigrationSharedStoreFile(@StoreFileId int fileId)
+ throws IOException {
+ Integer migrationStoreFileId = getMigrationStoreFileId(fileId);
+ if (migrationStoreFileId == null) return null;
+ InputStream migrationIs =
+ WifiMigration.convertAndRetrieveSharedConfigStoreFile(migrationStoreFileId);
+ if (migrationIs == null) return null;
+ return readAtomicFileFully(migrationIs);
+ }
+
+ private static byte[] readDataFromMigrationUserStoreFile(@StoreFileId int fileId,
+ UserHandle userHandle) throws IOException {
+ Integer migrationStoreFileId = getMigrationStoreFileId(fileId);
+ if (migrationStoreFileId == null) return null;
+ InputStream migrationIs =
+ WifiMigration.convertAndRetrieveUserConfigStoreFile(
+ migrationStoreFileId, userHandle);
+ if (migrationIs == null) return null;
+ return readAtomicFileFully(migrationIs);
+ }
+
+ /**
+ * Helper method to read from the shared store files.
+ * @throws XmlPullParserException
+ * @throws IOException
+ */
+ private void readFromSharedStoreFiles() throws XmlPullParserException, IOException {
+ for (StoreFile sharedStoreFile : mSharedStores) {
+ byte[] sharedDataBytes = readDataFromMigrationSharedStoreFile(sharedStoreFile.mFileId);
+ if (sharedDataBytes == null) {
+ sharedDataBytes = sharedStoreFile.readRawData();
+ } else {
+ Log.i(TAG, "Read data out of shared migration store file: "
+ + sharedStoreFile.mAtomicFile.getBaseFile().getName());
+ // Save the migrated file contents to the regular store file and delete the
+ // migrated stored file.
+ sharedStoreFile.storeRawDataToWrite(sharedDataBytes);
+ sharedStoreFile.writeBufferedRawData();
+ // Note: If the migrated store file is at the same location as the store file,
+ // then the OEM implementation should ignore this remove.
+ WifiMigration.removeSharedConfigStoreFile(
+ getMigrationStoreFileId(sharedStoreFile.mFileId));
+ }
+ deserializeData(sharedDataBytes, sharedStoreFile);
+ }
+ }
+
+ /**
+ * Helper method to read from the user store files.
+ * @throws XmlPullParserException
+ * @throws IOException
+ */
+ private void readFromUserStoreFiles() throws XmlPullParserException, IOException {
+ for (StoreFile userStoreFile : mUserStores) {
+ byte[] userDataBytes = readDataFromMigrationUserStoreFile(
+ userStoreFile.mFileId, userStoreFile.mUserHandle);
+ if (userDataBytes == null) {
+ userDataBytes = userStoreFile.readRawData();
+ } else {
+ Log.i(TAG, "Read data out of user migration store file: "
+ + userStoreFile.mAtomicFile.getBaseFile().getName());
+ // Save the migrated file contents to the regular store file and delete the
+ // migrated stored file.
+ userStoreFile.storeRawDataToWrite(userDataBytes);
+ userStoreFile.writeBufferedRawData();
+ // Note: If the migrated store file is at the same location as the store file,
+ // then the OEM implementation should ignore this remove.
+ WifiMigration.removeUserConfigStoreFile(
+ getMigrationStoreFileId(userStoreFile.mFileId),
+ userStoreFile.mUserHandle);
+ }
+ deserializeData(userDataBytes, userStoreFile);
+ }
+ }
+
+ /**
* API to read the store data from the config stores.
* The method reads the user specific configurations from user specific config store and the
* shared configurations from the shared config store.
@@ -554,17 +654,10 @@ public class WifiConfigStore {
resetStoreData(userStoreFile);
}
}
-
long readStartTime = mClock.getElapsedSinceBootMillis();
- for (StoreFile sharedStoreFile : mSharedStores) {
- byte[] sharedDataBytes = sharedStoreFile.readRawData();
- deserializeData(sharedDataBytes, sharedStoreFile);
- }
+ readFromSharedStoreFiles();
if (mUserStores != null) {
- for (StoreFile userStoreFile : mUserStores) {
- byte[] userDataBytes = userStoreFile.readRawData();
- deserializeData(userDataBytes, userStoreFile);
- }
+ readFromUserStoreFiles();
}
long readTime = mClock.getElapsedSinceBootMillis() - readStartTime;
try {
@@ -572,8 +665,6 @@ public class WifiConfigStore {
} catch (ArithmeticException e) {
// Silently ignore on any overflow errors.
}
- // Read is complete, go ahead and remove any OEM config stores.
- mStoreMigrationDataHolder.removeStoreIfPresent();
Log.d(TAG, "Reading from all stores completed in " + readTime + " ms.");
}
@@ -597,12 +688,9 @@ public class WifiConfigStore {
stopBufferedWriteAlarm();
mUserStores = userStores;
- // Now read from the user store file.
+ // Now read from the user store files.
long readStartTime = mClock.getElapsedSinceBootMillis();
- for (StoreFile userStoreFile : mUserStores) {
- byte[] userDataBytes = userStoreFile.readRawData();
- deserializeData(userDataBytes, userStoreFile);
- }
+ readFromUserStoreFiles();
long readTime = mClock.getElapsedSinceBootMillis() - readStartTime;
mWifiMetrics.noteWifiConfigStoreReadDuration(toIntExact(readTime));
Log.d(TAG, "Reading from user stores completed in " + readTime + " ms.");
@@ -622,7 +710,7 @@ public class WifiConfigStore {
@Version int version, @NonNull WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
for (StoreData storeData : storeDataSet) {
- storeData.deserializeData(null, 0, version, encryptionUtil, mStoreMigrationDataHolder);
+ storeData.deserializeData(null, 0, version, encryptionUtil);
}
}
@@ -677,7 +765,7 @@ public class WifiConfigStore {
continue;
}
storeData.deserializeData(in, rootTagDepth + 1, version,
- storeFile.getEncryptionUtil(), mStoreMigrationDataHolder);
+ storeFile.getEncryptionUtil());
storeDatasInvoked.add(storeData);
}
// Inform all the other registered store data clients that there is nothing in the store
@@ -772,15 +860,21 @@ public class WifiConfigStore {
*/
private final @StoreFileId int mFileId;
/**
+ * User handle. Meaningful only for user specific store files.
+ */
+ private final UserHandle mUserHandle;
+ /**
* Integrity checking for the store file.
*/
private final WifiConfigStoreEncryptionUtil mEncryptionUtil;
public StoreFile(File file, @StoreFileId int fileId,
+ @NonNull UserHandle userHandle,
@Nullable WifiConfigStoreEncryptionUtil encryptionUtil) {
mAtomicFile = new AtomicFile(file);
mFileName = file.getAbsolutePath();
mFileId = fileId;
+ mUserHandle = userHandle;
mEncryptionUtil = encryptionUtil;
}
@@ -877,14 +971,12 @@ public class WifiConfigStore {
* @param outerTagDepth The depth of the outer tag in the XML document
* @param version Version of config store file.
* @param encryptionUtil Utility to help decrypt any credential data.
- * @param storeMigrationDataHolder Needed for migration data out of OEM stores.
*
* Note: This will be invoked every time a store file is read, even if there is nothing
* in the store for them.
*/
void deserializeData(@Nullable XmlPullParser in, int outerTagDepth, @Version int version,
- @Nullable WifiConfigStoreEncryptionUtil encryptionUtil,
- @NonNull WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ @Nullable WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException;
/**
diff --git a/service/java/com/android/server/wifi/WifiConfigStoreMigrationDataHolder.java b/service/java/com/android/server/wifi/WifiConfigStoreMigrationDataHolder.java
deleted file mode 100644
index 7ecae0f1f3..0000000000
--- a/service/java/com/android/server/wifi/WifiConfigStoreMigrationDataHolder.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.server.wifi;
-
-import android.annotation.Nullable;
-import android.net.wifi.SoftApConfiguration;
-import android.net.wifi.WifiConfiguration;
-import android.net.wifi.WifiMigration;
-import android.net.wifi.WifiMigration.ConfigStoreMigrationData;
-
-import java.util.List;
-
-/**
- * Caches the data migrated out of OEM config store. This class helps to avoid invoking the
- * {@link WifiMigration#loadFromConfigStore()} multiple times from different instances of
- * {@link WifiConfigStore.StoreData}.
- *
- */
-public class WifiConfigStoreMigrationDataHolder {
- private ConfigStoreMigrationData mData;
- private boolean mLoaded = false;
-
- private void loadMigrationData() {
- if (!mLoaded) {
- mData = WifiMigration.loadFromConfigStore();
- mLoaded = true;
- }
- }
-
- /**
- * Helper method to load saved network configuration from OEM migration code.
- */
- @Nullable
- public List<WifiConfiguration> getUserSavedNetworks() {
- loadMigrationData();
- if (mData == null) return null;
- return mData.getUserSavedNetworkConfigurations();
- }
-
- /**
- * Helper method to load saved softap configuration from OEM migration code.
- */
- @Nullable
- public SoftApConfiguration getUserSoftApConfiguration() {
- loadMigrationData();
- if (mData == null) return null;
- return mData.getUserSoftApConfiguration();
- }
-
- /**
- * Check if there was any data to be migrated. If yes, then go ahead and invoke the API
- * to remove the stores now.
- */
- public void removeStoreIfPresent() {
- if (mLoaded && mData != null) {
- WifiMigration.removeConfigStore();
- }
- }
-}
diff --git a/service/java/com/android/server/wifi/WifiDiagnostics.java b/service/java/com/android/server/wifi/WifiDiagnostics.java
index 1a8e7feaf4..05c4df6346 100644
--- a/service/java/com/android/server/wifi/WifiDiagnostics.java
+++ b/service/java/com/android/server/wifi/WifiDiagnostics.java
@@ -308,7 +308,7 @@ class WifiDiagnostics extends BaseWifiDiagnostics {
}
mLastBugReportTime = currentTime;
BugreportManager bugreportManager = mContext.getSystemService(BugreportManager.class);
- BugreportParams params = new BugreportParams(BugreportParams.BUGREPORT_MODE_WIFI);
+ BugreportParams params = new BugreportParams(BugreportParams.BUGREPORT_MODE_FULL);
try {
bugreportManager.requestBugreport(params, bugTitle, bugDetail);
} catch (RuntimeException e) {
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index 865c1a0cbe..87e1616124 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -157,7 +157,6 @@ public class WifiInjector {
private final ThroughputPredictor mThroughputPredictor;
private NetdWrapper mNetdWrapper;
private final WifiHealthMonitor mWifiHealthMonitor;
- private final WifiConfigStoreMigrationDataHolder mOemConfigStoreMigrationDataHolder;
private final WifiSettingsConfigStore mSettingsConfigStore;
private final WifiScanAlwaysAvailableSettingsCompatibility
mWifiScanAlwaysAvailableSettingsCompatibility;
@@ -248,9 +247,7 @@ public class WifiInjector {
mKeyStore = keyStore;
mWifiKeyStore = new WifiKeyStore(mKeyStore);
// New config store
- mOemConfigStoreMigrationDataHolder = new WifiConfigStoreMigrationDataHolder();
mWifiConfigStore = new WifiConfigStore(mContext, wifiHandler, mClock, mWifiMetrics,
- mOemConfigStoreMigrationDataHolder,
WifiConfigStore.createSharedFiles(mFrameworkFacade.isNiapModeOn(mContext)));
SubscriptionManager subscriptionManager =
mContext.getSystemService(SubscriptionManager.class);
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index b356af7190..0c5bae954e 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -481,6 +481,10 @@ public class WifiMetrics {
sb.append(", mAuthPhase2Method=" + mRouterFingerPrintProto.authPhase2Method);
sb.append(", mOcspType=" + mRouterFingerPrintProto.ocspType);
sb.append(", mPmkCache=" + mRouterFingerPrintProto.pmkCacheEnabled);
+ sb.append(", mMaxSupportedTxLinkSpeedMbps=" + mRouterFingerPrintProto
+ .maxSupportedTxLinkSpeedMbps);
+ sb.append(", mMaxSupportedRxLinkSpeedMbps=" + mRouterFingerPrintProto
+ .maxSupportedRxLinkSpeedMbps);
}
return sb.toString();
}
@@ -539,6 +543,14 @@ public class WifiMetrics {
mRouterFingerPrintProto.pmkCacheEnabled = isEnabled;
}
}
+
+ public void setMaxSupportedLinkSpeedMbps(int maxSupportedTxLinkSpeedMbps,
+ int maxSupportedRxLinkSpeedMbps) {
+ synchronized (mLock) {
+ mRouterFingerPrintProto.maxSupportedTxLinkSpeedMbps = maxSupportedTxLinkSpeedMbps;
+ mRouterFingerPrintProto.maxSupportedRxLinkSpeedMbps = maxSupportedRxLinkSpeedMbps;
+ }
+ }
}
private int getEapMethodProto(int eapMethod) {
switch (eapMethod) {
@@ -1361,6 +1373,19 @@ public class WifiMetrics {
}
/**
+ * Set the max link speed supported by current network
+ */
+ public void setConnectionMaxSupportedLinkSpeedMbps(int maxSupportedTxLinkSpeedMbps,
+ int maxSupportedRxLinkSpeedMbps) {
+ synchronized (mLock) {
+ if (mCurrentConnectionEvent != null) {
+ mCurrentConnectionEvent.mRouterFingerPrint.setMaxSupportedLinkSpeedMbps(
+ maxSupportedTxLinkSpeedMbps, maxSupportedRxLinkSpeedMbps);
+ }
+ }
+ }
+
+ /**
* End a Connection event record. Call when wifi connection attempt succeeds or fails.
* If a Connection event has not been started and is active when .end is called, then this
* method will do nothing.
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index 15f9984128..c5e05892bb 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -1582,6 +1582,7 @@ public class WifiNative {
* @return true on success.
*/
public boolean startPnoScan(@NonNull String ifaceName, PnoSettings pnoSettings) {
+ removeAllNetworks(ifaceName);
return mWifiCondManager.startPnoScan(ifaceName, pnoSettings.toNativePnoSettings(),
Runnable::run,
new WifiNl80211Manager.PnoScanRequestCallback() {
diff --git a/service/java/com/android/server/wifi/WifiSettingsConfigStore.java b/service/java/com/android/server/wifi/WifiSettingsConfigStore.java
index 7a1931cf20..872d0d4373 100644
--- a/service/java/com/android/server/wifi/WifiSettingsConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiSettingsConfigStore.java
@@ -327,8 +327,7 @@ public class WifiSettingsConfigStore {
@Override
public void deserializeData(XmlPullParser in, int outerTagDepth,
@WifiConfigStore.Version int version,
- @Nullable WifiConfigStoreEncryptionUtil encryptionUtil,
- @NonNull WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ @Nullable WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
if (in == null) {
// Empty read triggers the migration since it indicates that there is no settings
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointConfigSharedStoreData.java b/service/java/com/android/server/wifi/hotspot2/PasspointConfigSharedStoreData.java
index fe69bcc271..b956983c49 100644
--- a/service/java/com/android/server/wifi/hotspot2/PasspointConfigSharedStoreData.java
+++ b/service/java/com/android/server/wifi/hotspot2/PasspointConfigSharedStoreData.java
@@ -16,12 +16,10 @@
package com.android.server.wifi.hotspot2;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.util.Log;
import com.android.server.wifi.WifiConfigStore;
-import com.android.server.wifi.WifiConfigStoreMigrationDataHolder;
import com.android.server.wifi.util.WifiConfigStoreEncryptionUtil;
import com.android.server.wifi.util.XmlUtil;
@@ -88,8 +86,7 @@ public class PasspointConfigSharedStoreData implements WifiConfigStore.StoreData
@Override
public void deserializeData(XmlPullParser in, int outerTagDepth,
@WifiConfigStore.Version int version,
- @Nullable WifiConfigStoreEncryptionUtil encryptionUtil,
- @NonNull WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ @Nullable WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
// Ignore empty reads.
if (in == null) {
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointConfigUserStoreData.java b/service/java/com/android/server/wifi/hotspot2/PasspointConfigUserStoreData.java
index 84c8be706c..e7de22f551 100644
--- a/service/java/com/android/server/wifi/hotspot2/PasspointConfigUserStoreData.java
+++ b/service/java/com/android/server/wifi/hotspot2/PasspointConfigUserStoreData.java
@@ -16,14 +16,12 @@
package com.android.server.wifi.hotspot2;
-import android.annotation.NonNull;
import android.annotation.Nullable;
import android.net.wifi.hotspot2.PasspointConfiguration;
import android.text.TextUtils;
import android.util.Log;
import com.android.server.wifi.WifiConfigStore;
-import com.android.server.wifi.WifiConfigStoreMigrationDataHolder;
import com.android.server.wifi.WifiKeyStore;
import com.android.server.wifi.util.TelephonyUtil;
import com.android.server.wifi.util.WifiConfigStoreEncryptionUtil;
@@ -118,8 +116,7 @@ public class PasspointConfigUserStoreData implements WifiConfigStore.StoreData {
@Override
public void deserializeData(XmlPullParser in, int outerTagDepth,
@WifiConfigStore.Version int version,
- @Nullable WifiConfigStoreEncryptionUtil encryptionUtil,
- @NonNull WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ @Nullable WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
// Ignore empty reads.
if (in == null) {
diff --git a/service/java/com/android/server/wifi/util/Environment.java b/service/java/com/android/server/wifi/util/Environment.java
index 8ba7ff9f22..b4df26d8ef 100644
--- a/service/java/com/android/server/wifi/util/Environment.java
+++ b/service/java/com/android/server/wifi/util/Environment.java
@@ -33,42 +33,6 @@ public class Environment {
private static final String WIFI_APEX_NAME = "com.android.wifi";
/**
- * Directory to store the wifi config store / shared preference files under.
- */
- private static final String LEGACY_WIFI_STORE_DIRECTORY_NAME = "wifi";
-
- /**
- * Get data/misc directory
- */
- public static File getDataMiscDirectory() {
- return new File(android.os.Environment.getDataDirectory(), "misc");
- }
-
- /**
- * Get data/misc_ce/<userId> directory
- */
- public static File getDataMiscCeDirectory(int userId) {
- return buildPath(android.os.Environment.getDataDirectory(), "misc_ce",
- String.valueOf(userId));
- }
-
- /**
- * Append path segments to given base path, returning result.
- */
- public static File buildPath(File base, String... segments) {
- File cur = base;
- for (String segment : segments) {
- if (cur == null) {
- cur = new File(segment);
- } else {
- cur = new File(cur, segment);
- }
- }
- return cur;
- }
-
-
- /**
* Wifi shared folder.
*/
public static File getWifiSharedDirectory() {
@@ -82,19 +46,4 @@ public class Environment {
return ApexEnvironment.getApexEnvironment(WIFI_APEX_NAME)
.getCredentialProtectedDataDirForUser(UserHandle.of(userId));
}
-
-
- /**
- * Pre apex wifi shared folder.
- */
- public static File getLegacyWifiSharedDirectory() {
- return new File(getDataMiscDirectory(), LEGACY_WIFI_STORE_DIRECTORY_NAME);
- }
-
- /**
- * Pre apex wifi user folder.
- */
- public static File getLegacyWifiUserDirectory(int userId) {
- return new File(getDataMiscCeDirectory(userId), LEGACY_WIFI_STORE_DIRECTORY_NAME);
- }
}
diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto
index 2f3e847c92..d76c8fc6ad 100644
--- a/service/proto/src/metrics.proto
+++ b/service/proto/src/metrics.proto
@@ -775,6 +775,12 @@ message RouterFingerPrint {
// PMK caching enablement
optional bool pmk_cache_enabled = 12;
+
+ // Max Tx link speed (in Mbps) supported by current network (STA and AP)
+ optional int32 max_supported_tx_link_speed_mbps = 13;
+
+ // Max Rx link speed (in Mbps) supported by current network (STA and AP)
+ optional int32 max_supported_rx_link_speed_mbps = 14;
}
message ConnectionEvent {
diff --git a/service/res/values/strings.xml b/service/res/values/strings.xml
index 4bf0a1b696..d6fb5a750f 100644
--- a/service/res/values/strings.xml
+++ b/service/res/values/strings.xml
@@ -122,9 +122,8 @@
<!-- A notification is shown when softap auto shutdown timeout expired. It should be overridden by carrier-specific overlays. -->
- <string name="wifi_softap_auto_shutdown_timeout_expired_title">Mobile Hotspot disabled</string>
- <string name="wifi_softap_auto_shutdown_timeout_expired_summary">Mobile hotspot has been disabled</string>
- <string name="wifi_softap_auto_shutdown_timeout_expired_detail">Mobile hotspot has been disabled due to inactivity timeout expiration.</string>
+ <string name="wifi_softap_auto_shutdown_timeout_expired_title">Hotspot turned off</string>
+ <string name="wifi_softap_auto_shutdown_timeout_expired_summary">No devices connected. Tap to modify.</string>
<!-- A notification is shown when eap-sim/aka/aka' wifi network is disconnected due to sim removal -->
<string name="wifi_sim_required_title">Wi\u2011Fi disconnected</string>
diff --git a/service/tests/wifitests/Android.bp b/service/tests/wifitests/Android.bp
index 920bec2e07..4d808b70c8 100644
--- a/service/tests/wifitests/Android.bp
+++ b/service/tests/wifitests/Android.bp
@@ -411,9 +411,6 @@ android_test {
"com.android.server.wifi.WifiConfigStore",
"com.android.server.wifi.WifiConfigStore$*",
"com.android.server.wifi.WifiConfigStore.**",
- "com.android.server.wifi.WifiConfigStoreMigrationDataHolder",
- "com.android.server.wifi.WifiConfigStoreMigrationDataHolder$*",
- "com.android.server.wifi.WifiConfigStoreMigrationDataHolder.**",
"com.android.server.wifi.WifiConfigurationUtil",
"com.android.server.wifi.WifiConfigurationUtil$*",
"com.android.server.wifi.WifiConfigurationUtil.**",
diff --git a/service/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/service/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
index 7e9c6a292f..7e12c26991 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -21,6 +21,7 @@ import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.DISABLED
import static com.android.server.wifi.ClientModeImpl.CMD_PRE_DHCP_ACTION;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
@@ -1032,6 +1033,7 @@ public class ClientModeImplTest extends WifiBaseTest {
verify(mWifiLockManager).updateWifiClientConnected(true);
verify(mWifiNative).getConnectionCapabilities(any());
verify(mThroughputPredictor).predictMaxTxThroughput(any());
+ verify(mWifiMetrics).setConnectionMaxSupportedLinkSpeedMbps(90, 80);
verify(mWifiDataStall).setConnectionCapabilities(any());
assertEquals(90, wifiInfo.getMaxSupportedTxLinkSpeedMbps());
}
@@ -3557,6 +3559,9 @@ public class ClientModeImplTest extends WifiBaseTest {
assertNull(networkCapabilities.getNetworkSpecifier());
assertEquals(mConnectedNetwork.creatorUid, networkCapabilities.getOwnerUid());
+ assertArrayEquals(
+ new int[] {mConnectedNetwork.creatorUid},
+ networkCapabilities.getAdministratorUids());
// Should set bandwidth correctly
assertEquals(-42, mCmi.getWifiInfo().getRssi());
diff --git a/service/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java b/service/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java
index e75fd27365..f9e05cb326 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreDataTest.java
@@ -17,7 +17,6 @@
package com.android.server.wifi;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -72,8 +71,7 @@ public class ImsiPrivacyProtectionExemptionStoreDataTest {
final ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
in.setInput(inputStream, StandardCharsets.UTF_8.name());
mImsiPrivacyProtectionExemptionStoreData.deserializeData(in, in.getDepth(),
- WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION, null,
- mock(WifiConfigStoreMigrationDataHolder.class));
+ WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION, null);
}
/**
diff --git a/service/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java b/service/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java
index d9b711df31..88bcc92a65 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/NetworkListStoreDataTest.java
@@ -255,14 +255,12 @@ public class NetworkListStoreDataTest extends WifiBaseTest {
private NetworkListSharedStoreData mNetworkListSharedStoreData;
@Mock private Context mContext;
@Mock private PackageManager mPackageManager;
- @Mock WifiConfigStoreMigrationDataHolder mWifiConfigStoreMigrationDataHolder;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(mContext.getPackageManager()).thenReturn(mPackageManager);
when(mPackageManager.getNameForUid(anyInt())).thenReturn(TEST_CREATOR_NAME);
- when(mWifiConfigStoreMigrationDataHolder.getUserSavedNetworks()).thenReturn(null);
mNetworkListSharedStoreData = new NetworkListSharedStoreData(mContext);
}
@@ -294,8 +292,7 @@ public class NetworkListStoreDataTest extends WifiBaseTest {
in.setInput(inputStream, StandardCharsets.UTF_8.name());
mNetworkListSharedStoreData.deserializeData(in, in.getDepth(),
WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION,
- mock(WifiConfigStoreEncryptionUtil.class),
- mWifiConfigStoreMigrationDataHolder);
+ mock(WifiConfigStoreEncryptionUtil.class));
return mNetworkListSharedStoreData.getConfigurations();
}
@@ -694,21 +691,6 @@ public class NetworkListStoreDataTest extends WifiBaseTest {
}
/**
- * Verify that the shared configurations deserialized correctly from OEM migration hook.
- */
- @Test
- public void deserializeSharedConfigurationsFromOemConfigStoreMigration() throws Exception {
- List<WifiConfiguration> oemUserSavedNetworks = getTestNetworksConfig(true /* shared */);
- when(mWifiConfigStoreMigrationDataHolder.getUserSavedNetworks())
- .thenReturn(oemUserSavedNetworks);
-
- // File contents are ignored.
- List<WifiConfiguration> parsedNetworks = deserializeData("".getBytes());
- WifiConfigurationTestUtil.assertConfigurationsEqualForConfigStore(
- oemUserSavedNetworks, parsedNetworks);
- }
-
- /**
* The WifiConfiguration store should follow the sort of the SSIDs.
*/
@Test
diff --git a/service/tests/wifitests/src/com/android/server/wifi/NetworkRequestStoreDataTest.java b/service/tests/wifitests/src/com/android/server/wifi/NetworkRequestStoreDataTest.java
index 1b5373e01d..7f7c770f20 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/NetworkRequestStoreDataTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/NetworkRequestStoreDataTest.java
@@ -95,8 +95,7 @@ public class NetworkRequestStoreDataTest extends WifiBaseTest {
in.setInput(inputStream, StandardCharsets.UTF_8.name());
mNetworkRequestStoreData.deserializeData(in, in.getDepth(),
WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION,
- mock(WifiConfigStoreEncryptionUtil.class),
- mock(WifiConfigStoreMigrationDataHolder.class));
+ mock(WifiConfigStoreEncryptionUtil.class));
}
/**
diff --git a/service/tests/wifitests/src/com/android/server/wifi/NetworkSuggestionStoreDataTest.java b/service/tests/wifitests/src/com/android/server/wifi/NetworkSuggestionStoreDataTest.java
index 1a50447540..74c5d3c55d 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/NetworkSuggestionStoreDataTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/NetworkSuggestionStoreDataTest.java
@@ -266,8 +266,7 @@ public class NetworkSuggestionStoreDataTest extends WifiBaseTest {
final ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
in.setInput(inputStream, StandardCharsets.UTF_8.name());
mNetworkSuggestionStoreData.deserializeData(in, in.getDepth(),
- WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION, null,
- mock(WifiConfigStoreMigrationDataHolder.class));
+ WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION, null);
}
/**
diff --git a/service/tests/wifitests/src/com/android/server/wifi/RandomizedMacStoreDataTest.java b/service/tests/wifitests/src/com/android/server/wifi/RandomizedMacStoreDataTest.java
index 948d2ae928..ad27814a0f 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/RandomizedMacStoreDataTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/RandomizedMacStoreDataTest.java
@@ -81,8 +81,7 @@ public class RandomizedMacStoreDataTest extends WifiBaseTest {
in.setInput(inputStream, StandardCharsets.UTF_8.name());
mRandomizedMacStoreData.deserializeData(in, in.getDepth(),
WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION,
- mock(WifiConfigStoreEncryptionUtil.class),
- mock(WifiConfigStoreMigrationDataHolder.class));
+ mock(WifiConfigStoreEncryptionUtil.class));
return mRandomizedMacStoreData.getMacMapping();
}
diff --git a/service/tests/wifitests/src/com/android/server/wifi/SoftApStoreDataTest.java b/service/tests/wifitests/src/com/android/server/wifi/SoftApStoreDataTest.java
index 037379f961..04955f806f 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/SoftApStoreDataTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/SoftApStoreDataTest.java
@@ -186,7 +186,6 @@ public class SoftApStoreDataTest extends WifiBaseTest {
@Mock private Context mContext;
@Mock SoftApStoreData.DataSource mDataSource;
- @Mock WifiConfigStoreMigrationDataHolder mWifiConfigStoreMigrationDataHolder;
@Mock private WifiMigration.SettingsMigrationData mOemMigrationData;
MockitoSession mSession;
SoftApStoreData mSoftApStoreData;
@@ -232,23 +231,6 @@ public class SoftApStoreDataTest extends WifiBaseTest {
return outputStream.toByteArray();
}
- private SoftApConfiguration createDefaultTestSoftApConfiguration() {
- SoftApConfiguration.Builder softApConfigBuilder = new SoftApConfiguration.Builder();
- softApConfigBuilder.setSsid(TEST_SSID);
- softApConfigBuilder.setBssid(MacAddress.fromString(TEST_BSSID));
- softApConfigBuilder.setPassphrase(TEST_PASSPHRASE,
- SoftApConfiguration.SECURITY_TYPE_WPA2_PSK);
- softApConfigBuilder.setBand(TEST_BAND);
- softApConfigBuilder.setClientControlByUserEnabled(TEST_CLIENT_CONTROL_BY_USER);
- softApConfigBuilder.setMaxNumberOfClients(TEST_MAX_NUMBER_OF_CLIENTS);
- softApConfigBuilder.setAutoShutdownEnabled(true);
- softApConfigBuilder.setShutdownTimeoutMillis(TEST_SHUTDOWN_TIMEOUT_MILLIS);
- softApConfigBuilder.setBlockedClientList(TEST_BLOCKEDLIST);
- softApConfigBuilder.setAllowedClientList(TEST_ALLOWEDLIST);
- return softApConfigBuilder.build();
- }
-
-
/**
* Helper function for parsing configuration data from a XML block.
*
@@ -261,8 +243,7 @@ public class SoftApStoreDataTest extends WifiBaseTest {
in.setInput(inputStream, StandardCharsets.UTF_8.name());
mSoftApStoreData.deserializeData(in, in.getDepth(),
WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION,
- mock(WifiConfigStoreEncryptionUtil.class),
- mWifiConfigStoreMigrationDataHolder);
+ mock(WifiConfigStoreEncryptionUtil.class));
}
/**
@@ -296,8 +277,20 @@ public class SoftApStoreDataTest extends WifiBaseTest {
*/
@Test
public void serializeSoftAp() throws Exception {
- SoftApConfiguration softApConfig = createDefaultTestSoftApConfiguration();
- when(mDataSource.toSerialize()).thenReturn(softApConfig);
+ SoftApConfiguration.Builder softApConfigBuilder = new SoftApConfiguration.Builder();
+ softApConfigBuilder.setSsid(TEST_SSID);
+ softApConfigBuilder.setBssid(MacAddress.fromString(TEST_BSSID));
+ softApConfigBuilder.setPassphrase(TEST_PASSPHRASE,
+ SoftApConfiguration.SECURITY_TYPE_WPA2_PSK);
+ softApConfigBuilder.setBand(TEST_BAND);
+ softApConfigBuilder.setClientControlByUserEnabled(TEST_CLIENT_CONTROL_BY_USER);
+ softApConfigBuilder.setMaxNumberOfClients(TEST_MAX_NUMBER_OF_CLIENTS);
+ softApConfigBuilder.setAutoShutdownEnabled(true);
+ softApConfigBuilder.setShutdownTimeoutMillis(TEST_SHUTDOWN_TIMEOUT_MILLIS);
+ softApConfigBuilder.setAllowedClientList(TEST_ALLOWEDLIST);
+ softApConfigBuilder.setBlockedClientList(TEST_BLOCKEDLIST);
+
+ when(mDataSource.toSerialize()).thenReturn(softApConfigBuilder.build());
byte[] actualData = serializeData();
assertEquals(TEST_SOFTAP_CONFIG_XML_STRING_WITH_ALL_CONFIG, new String(actualData));
}
@@ -513,37 +506,6 @@ public class SoftApStoreDataTest extends WifiBaseTest {
}
/**
- * Verify that the store data is deserialized correctly from OEM migration hook.
- *
- * @throws Exception
- */
- @Test
- public void deserializeSoftApFromOemConfigStoreMigration() throws Exception {
- SoftApConfiguration oemSoftApConfig = createDefaultTestSoftApConfiguration();
- when(mWifiConfigStoreMigrationDataHolder.getUserSoftApConfiguration())
- .thenReturn(oemSoftApConfig);
-
- // File contents are ignored.
- deserializeData("".getBytes());
-
- ArgumentCaptor<SoftApConfiguration> softapConfigCaptor =
- ArgumentCaptor.forClass(SoftApConfiguration.class);
- verify(mDataSource).fromDeserialized(softapConfigCaptor.capture());
- SoftApConfiguration softApConfig = softapConfigCaptor.getValue();
- assertNotNull(softApConfig);
- assertEquals(softApConfig.getSsid(), TEST_SSID);
- assertEquals(softApConfig.getPassphrase(), TEST_PASSPHRASE);
- assertEquals(softApConfig.getSecurityType(), SoftApConfiguration.SECURITY_TYPE_WPA2_PSK);
- assertEquals(softApConfig.isHiddenSsid(), TEST_HIDDEN);
- assertEquals(softApConfig.getBand(), TEST_BAND);
- assertEquals(softApConfig.isClientControlByUserEnabled(), TEST_CLIENT_CONTROL_BY_USER);
- assertEquals(softApConfig.getMaxNumberOfClients(), TEST_MAX_NUMBER_OF_CLIENTS);
- assertEquals(softApConfig.getShutdownTimeoutMillis(), TEST_SHUTDOWN_TIMEOUT_MILLIS);
- assertEquals(softApConfig.getBlockedClientList(), TEST_BLOCKEDLIST);
- assertEquals(softApConfig.getAllowedClientList(), TEST_ALLOWEDLIST);
- }
-
- /**
* Verify that the store data is deserialized correctly using the predefined test XML data
* when the auto shutdown tag is retrieved from
* {@link WifiMigration.loadFromSettings(Context)}.
@@ -602,5 +564,4 @@ public class SoftApStoreDataTest extends WifiBaseTest {
assertEquals(softApConfig.getBlockedClientList(), TEST_BLOCKEDLIST);
assertEquals(softApConfig.getAllowedClientList(), TEST_ALLOWEDLIST);
}
-
}
diff --git a/service/tests/wifitests/src/com/android/server/wifi/SsidSetStoreDataTest.java b/service/tests/wifitests/src/com/android/server/wifi/SsidSetStoreDataTest.java
index 66afa82716..b3b8439f44 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/SsidSetStoreDataTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/SsidSetStoreDataTest.java
@@ -99,8 +99,7 @@ public class SsidSetStoreDataTest extends WifiBaseTest {
in.setInput(inputStream, StandardCharsets.UTF_8.name());
mSsidSetStoreData.deserializeData(in, in.getDepth(),
WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION,
- mock(WifiConfigStoreEncryptionUtil.class),
- mock(WifiConfigStoreMigrationDataHolder.class));
+ mock(WifiConfigStoreEncryptionUtil.class));
}
/**
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WakeupConfigStoreDataTest.java b/service/tests/wifitests/src/com/android/server/wifi/WakeupConfigStoreDataTest.java
index baf43f5a7b..cc7587a369 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WakeupConfigStoreDataTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WakeupConfigStoreDataTest.java
@@ -92,8 +92,7 @@ public class WakeupConfigStoreDataTest extends WifiBaseTest {
in.setInput(inputStream, StandardCharsets.UTF_8.name());
mWakeupConfigData.deserializeData(in, in.getDepth(),
WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION,
- mock(WifiConfigStoreEncryptionUtil.class),
- mock(WifiConfigStoreMigrationDataHolder.class));
+ mock(WifiConfigStoreEncryptionUtil.class));
}
/**
@@ -184,8 +183,7 @@ public class WakeupConfigStoreDataTest extends WifiBaseTest {
public void hasBeenReadIsTrueWhenUserStoreIsLoaded() throws Exception {
mWakeupConfigData.deserializeData(null /* in */, 0 /* outerTagDepth */,
WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION,
- mock(WifiConfigStoreEncryptionUtil.class),
- mock(WifiConfigStoreMigrationDataHolder.class));
+ mock(WifiConfigStoreEncryptionUtil.class));
assertTrue(mWakeupConfigData.hasBeenRead());
}
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java b/service/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java
index 0d3fdf6b60..4b97f69f7c 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WakeupControllerTest.java
@@ -154,8 +154,7 @@ public class WakeupControllerTest extends WifiBaseTest {
try {
mWakeupConfigStoreData.deserializeData(null, 0,
WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION,
- mock(WifiConfigStoreEncryptionUtil.class),
- mock(WifiConfigStoreMigrationDataHolder.class));
+ mock(WifiConfigStoreEncryptionUtil.class));
} catch (XmlPullParserException | IOException e) {
// unreachable
}
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java b/service/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java
index 02b53f5c8e..14cb6043a1 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WifiApConfigStoreTest.java
@@ -56,6 +56,7 @@ import org.mockito.MockitoAnnotations;
import java.io.BufferedOutputStream;
import java.io.DataOutputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -135,7 +136,7 @@ public class WifiApConfigStoreTest extends WifiBaseTest {
/**
* Helper method to create and verify actions for the ApConfigStore used in the following tests.
*/
- private WifiApConfigStore createWifiApConfigStore(File legacyFile) {
+ private WifiApConfigStore createWifiApConfigStore(File legacyFile) throws Exception {
WifiApConfigStore store;
if (legacyFile == null) {
store = new WifiApConfigStore(
@@ -144,7 +145,8 @@ public class WifiApConfigStoreTest extends WifiBaseTest {
} else {
store = new WifiApConfigStore(
mContext, mWifiInjector, mHandler, mBackupManagerProxy,
- mWifiConfigStore, mWifiConfigManager, mActiveModeWarden, legacyFile);
+ mWifiConfigStore, mWifiConfigManager, mActiveModeWarden,
+ new FileInputStream(legacyFile));
}
verify(mWifiConfigStore).registerStoreData(any());
@@ -156,7 +158,7 @@ public class WifiApConfigStoreTest extends WifiBaseTest {
return store;
}
- private WifiApConfigStore createWifiApConfigStore() {
+ private WifiApConfigStore createWifiApConfigStore() throws Exception {
return createWifiApConfigStore(null);
}
@@ -337,9 +339,6 @@ public class WifiApConfigStoreTest extends WifiBaseTest {
// a) On reading the legacy file (new config store not ready yet)
// b) When the new config store is ready.
verify(mWifiConfigManager, times(2)).saveToStore(true);
-
- // The temporary legacy AP config file should be removed after migration.
- assertFalse(mLegacyApConfigFile.exists());
}
/**
@@ -555,7 +554,7 @@ public class WifiApConfigStoreTest extends WifiBaseTest {
* Verify a proper SoftApConfiguration is generate by getDefaultApConfiguration().
*/
@Test
- public void getDefaultApConfigurationIsValid() {
+ public void getDefaultApConfigurationIsValid() throws Exception {
WifiApConfigStore store = createWifiApConfigStore();
SoftApConfiguration config = store.getApConfiguration();
assertTrue(WifiApConfigStore.validateApWifiConfiguration(config));
@@ -603,7 +602,7 @@ public class WifiApConfigStoreTest extends WifiBaseTest {
}
@Test
- public void randomizeBssid_randomizesWhenEnabled() {
+ public void randomizeBssid_randomizesWhenEnabled() throws Exception {
mResources.setBoolean(R.bool.config_wifi_ap_mac_randomization_supported, true);
SoftApConfiguration baseConfig = new SoftApConfiguration.Builder().build();
@@ -614,7 +613,7 @@ public class WifiApConfigStoreTest extends WifiBaseTest {
}
@Test
- public void randomizeBssid_usesFactoryMacWhenRandomizationOff() {
+ public void randomizeBssid_usesFactoryMacWhenRandomizationOff() throws Exception {
mResources.setBoolean(R.bool.config_wifi_ap_mac_randomization_supported, false);
SoftApConfiguration baseConfig = new SoftApConfiguration.Builder().build();
@@ -625,7 +624,7 @@ public class WifiApConfigStoreTest extends WifiBaseTest {
}
@Test
- public void randomizeBssid_forwardsCustomMac() {
+ public void randomizeBssid_forwardsCustomMac() throws Exception {
mResources.setBoolean(R.bool.config_wifi_ap_mac_randomization_supported, true);
Builder baseConfigBuilder = new SoftApConfiguration.Builder();
baseConfigBuilder.setBssid(MacAddress.fromString("11:22:33:44:55:66"));
@@ -738,7 +737,8 @@ public class WifiApConfigStoreTest extends WifiBaseTest {
* Verify the default configuration security when SAE support.
*/
@Test
- public void testDefaultConfigurationSecurityTypeIsWpa3SaeTransitionWhenSupport() {
+ public void testDefaultConfigurationSecurityTypeIsWpa3SaeTransitionWhenSupport()
+ throws Exception {
mResources.setBoolean(R.bool.config_wifi_softap_sae_supported, true);
WifiApConfigStore store = createWifiApConfigStore();
verifyDefaultApConfig(store.getApConfiguration(), TEST_DEFAULT_AP_SSID, true);
@@ -761,7 +761,7 @@ public class WifiApConfigStoreTest extends WifiBaseTest {
}
@Test
- public void testResetToDefaultForUnsupportedConfig() {
+ public void testResetToDefaultForUnsupportedConfig() throws Exception {
mResources.setBoolean(R.bool.config_wifiSofapClientForceDisconnectSupported, false);
mResources.setBoolean(R.bool.config_wifi_softap_sae_supported, false);
SoftApConfiguration sae_config = new SoftApConfiguration.Builder()
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/service/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index 82addc2b34..98c82b88e5 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -2132,6 +2132,27 @@ public class WifiConfigManagerTest extends WifiBaseTest {
}
/**
+ * Verify that the aggressive randomization whitelist works for passpoints. (by checking FQDN)
+ */
+ @Test
+ public void testShouldUseAggressiveRandomizationPasspoint() {
+ WifiConfiguration c = WifiConfigurationTestUtil.createPasspointNetwork();
+ // Adds SSID to the whitelist.
+ Set<String> ssidList = new HashSet<>();
+ ssidList.add(c.SSID);
+ when(mDeviceConfigFacade.getAggressiveMacRandomizationSsidAllowlist())
+ .thenReturn(ssidList);
+
+ // Verify that if for passpoint networks we don't check for the SSID to be in the whitelist
+ assertFalse(mWifiConfigManager.shouldUseAggressiveRandomization(c));
+
+ // instead we check for the FQDN
+ ssidList.clear();
+ ssidList.add(c.FQDN);
+ assertTrue(mWifiConfigManager.shouldUseAggressiveRandomization(c));
+ }
+
+ /**
* Verifies that getRandomizedMacAndUpdateIfNeeded updates the randomized MAC address and
* |randomizedMacExpirationTimeMs| correctly.
*
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java b/service/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java
index 9f749f5792..967c029bad 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java
@@ -24,12 +24,15 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.net.MacAddress;
import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiMigration;
import android.net.wifi.util.HexEncoding;
import android.os.Handler;
+import android.os.UserHandle;
import android.os.test.TestLooper;
import androidx.test.filters.SmallTest;
+import com.android.dx.mockito.inline.extended.ExtendedMockito;
import com.android.server.wifi.WifiConfigStore.StoreData;
import com.android.server.wifi.WifiConfigStore.StoreFile;
import com.android.server.wifi.util.ArrayUtils;
@@ -42,6 +45,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.mockito.MockitoSession;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
@@ -157,13 +161,13 @@ public class WifiConfigStoreTest extends WifiBaseTest {
@Mock private Clock mClock;
@Mock private WifiMetrics mWifiMetrics;
@Mock private WifiConfigStoreEncryptionUtil mEncryptionUtil;
- @Mock WifiConfigStoreMigrationDataHolder mWifiConfigStoreMigrationDataHolder;
private MockStoreFile mSharedStore;
private MockStoreFile mUserStore;
private MockStoreFile mUserNetworkSuggestionsStore;
private List<StoreFile> mUserStores = new ArrayList<StoreFile>();
private MockStoreData mSharedStoreData;
private MockStoreData mUserStoreData;
+ private MockitoSession mSession;
/**
* Test instance of WifiConfigStore.
@@ -185,7 +189,6 @@ public class WifiConfigStoreTest extends WifiBaseTest {
.thenReturn(new EncryptedData(new byte[0], new byte[0]));
when(mEncryptionUtil.decrypt(any(EncryptedData.class)))
.thenReturn(new byte[0]);
- when(mWifiConfigStoreMigrationDataHolder.getUserSavedNetworks()).thenReturn(null);
mSharedStore = new MockStoreFile(WifiConfigStore.STORE_FILE_SHARED_GENERAL);
mUserStore = new MockStoreFile(WifiConfigStore.STORE_FILE_USER_GENERAL);
mUserNetworkSuggestionsStore =
@@ -195,6 +198,12 @@ public class WifiConfigStoreTest extends WifiBaseTest {
mSharedStoreData = new MockStoreData(WifiConfigStore.STORE_FILE_SHARED_GENERAL);
mUserStoreData = new MockStoreData(WifiConfigStore.STORE_FILE_USER_GENERAL);
+
+ mSession = ExtendedMockito.mockitoSession()
+ .mockStatic(WifiMigration.class, withSettings().lenient())
+ .startMocking();
+ when(WifiMigration.convertAndRetrieveSharedConfigStoreFile(anyInt())).thenReturn(null);
+ when(WifiMigration.convertAndRetrieveUserConfigStoreFile(anyInt(), any())).thenReturn(null);
}
/**
@@ -205,7 +214,7 @@ public class WifiConfigStoreTest extends WifiBaseTest {
setupMocks();
mWifiConfigStore = new WifiConfigStore(mContext, new Handler(mLooper.getLooper()), mClock,
- mWifiMetrics, mWifiConfigStoreMigrationDataHolder, Arrays.asList(mSharedStore));
+ mWifiMetrics, Arrays.asList(mSharedStore));
// Enable verbose logging before tests.
mWifiConfigStore.enableVerboseLogging(true);
}
@@ -216,6 +225,9 @@ public class WifiConfigStoreTest extends WifiBaseTest {
@After
public void cleanup() {
validateMockitoUsage();
+ if (mSession != null) {
+ mSession.finishMocking();
+ }
}
/**
@@ -323,7 +335,6 @@ public class WifiConfigStoreTest extends WifiBaseTest {
mWifiConfigStore.read();
assertEquals(TEST_USER_DATA, mUserStoreData.getData());
assertEquals(TEST_SHARE_DATA, mSharedStoreData.getData());
- verify(mWifiConfigStoreMigrationDataHolder).removeStoreIfPresent();
}
/**
@@ -361,7 +372,6 @@ public class WifiConfigStoreTest extends WifiBaseTest {
mWifiConfigStore.read();
assertEquals("abcds", mSharedStoreData.getData());
assertEquals("asdfa", mUserStoreData.getData());
- verify(mWifiConfigStoreMigrationDataHolder).removeStoreIfPresent();
}
@@ -391,7 +401,6 @@ public class WifiConfigStoreTest extends WifiBaseTest {
mWifiConfigStore.read();
assertEquals(TEST_USER_DATA, mUserStoreData.getData());
assertEquals(TEST_SHARE_DATA, mSharedStoreData.getData());
- verify(mWifiConfigStoreMigrationDataHolder).removeStoreIfPresent();
verify(mWifiMetrics, times(2)).noteWifiConfigStoreReadDuration(anyInt());
verify(mWifiMetrics).noteWifiConfigStoreWriteDuration(anyInt());
@@ -420,9 +429,9 @@ public class WifiConfigStoreTest extends WifiBaseTest {
// Ensure that we got the call to deserialize empty shared data, but no user data.
verify(sharedStoreData).resetData();
- verify(sharedStoreData).deserializeData(eq(null), anyInt(), anyInt(), any(), any());
+ verify(sharedStoreData).deserializeData(eq(null), anyInt(), anyInt(), any());
verify(userStoreData, never()).resetData();
- verify(userStoreData, never()).deserializeData(any(), anyInt(), anyInt(), any(), any());
+ verify(userStoreData, never()).deserializeData(any(), anyInt(), anyInt(), any());
}
/**
@@ -449,9 +458,9 @@ public class WifiConfigStoreTest extends WifiBaseTest {
// Ensure that we got the call to deserialize empty shared & user data.
verify(userStoreData).resetData();
- verify(userStoreData).deserializeData(eq(null), anyInt(), anyInt(), any(), any());
+ verify(userStoreData).deserializeData(eq(null), anyInt(), anyInt(), any());
verify(sharedStoreData).resetData();
- verify(sharedStoreData).deserializeData(eq(null), anyInt(), anyInt(), any(), any());
+ verify(sharedStoreData).deserializeData(eq(null), anyInt(), anyInt(), any());
}
/**
@@ -608,9 +617,9 @@ public class WifiConfigStoreTest extends WifiBaseTest {
mUserStore.storeRawDataToWrite(null);
mWifiConfigStore.read();
- verify(storeData1).deserializeData(notNull(), anyInt(), anyInt(), any(), any());
- verify(storeData1, never()).deserializeData(eq(null), anyInt(), anyInt(), any(), any());
- verify(storeData2).deserializeData(eq(null), anyInt(), anyInt(), any(), any());
+ verify(storeData1).deserializeData(notNull(), anyInt(), anyInt(), any());
+ verify(storeData1, never()).deserializeData(eq(null), anyInt(), anyInt(), any());
+ verify(storeData2).deserializeData(eq(null), anyInt(), anyInt(), any());
reset(storeData1, storeData2);
// Scenario 2: StoreData2 in user store file.
@@ -624,9 +633,9 @@ public class WifiConfigStoreTest extends WifiBaseTest {
mUserStore.storeRawDataToWrite(fileContentsXmlStringWithOnlyStoreData2.getBytes());
mWifiConfigStore.read();
- verify(storeData1).deserializeData(eq(null), anyInt(), anyInt(), any(), any());
- verify(storeData2).deserializeData(notNull(), anyInt(), anyInt(), any(), any());
- verify(storeData2, never()).deserializeData(eq(null), anyInt(), anyInt(), any(), any());
+ verify(storeData1).deserializeData(eq(null), anyInt(), anyInt(), any());
+ verify(storeData2).deserializeData(notNull(), anyInt(), anyInt(), any());
+ verify(storeData2, never()).deserializeData(eq(null), anyInt(), anyInt(), any());
reset(storeData1, storeData2);
// Scenario 3: StoreData1 in shared store file & StoreData2 in user store file.
@@ -640,10 +649,10 @@ public class WifiConfigStoreTest extends WifiBaseTest {
mUserStore.storeRawDataToWrite(fileContentsXmlStringWithOnlyStoreData2.getBytes());
mWifiConfigStore.read();
- verify(storeData1).deserializeData(notNull(), anyInt(), anyInt(), any(), any());
- verify(storeData1, never()).deserializeData(eq(null), anyInt(), anyInt(), any(), any());
- verify(storeData2).deserializeData(notNull(), anyInt(), anyInt(), any(), any());
- verify(storeData2, never()).deserializeData(eq(null), anyInt(), anyInt(), any(), any());
+ verify(storeData1).deserializeData(notNull(), anyInt(), anyInt(), any());
+ verify(storeData1, never()).deserializeData(eq(null), anyInt(), anyInt(), any());
+ verify(storeData2).deserializeData(notNull(), anyInt(), anyInt(), any());
+ verify(storeData2, never()).deserializeData(eq(null), anyInt(), anyInt(), any());
reset(storeData1, storeData2);
// Scenario 4: StoreData1 & StoreData2 in shared store file.
@@ -658,10 +667,10 @@ public class WifiConfigStoreTest extends WifiBaseTest {
mUserStore.storeRawDataToWrite(null);
mWifiConfigStore.read();
- verify(storeData1).deserializeData(notNull(), anyInt(), anyInt(), any(), any());
- verify(storeData1, never()).deserializeData(eq(null), anyInt(), anyInt(), any(), any());
- verify(storeData2).deserializeData(notNull(), anyInt(), anyInt(), any(), any());
- verify(storeData2, never()).deserializeData(eq(null), anyInt(), anyInt(), any(), any());
+ verify(storeData1).deserializeData(notNull(), anyInt(), anyInt(), any());
+ verify(storeData1, never()).deserializeData(eq(null), anyInt(), anyInt(), any());
+ verify(storeData2).deserializeData(notNull(), anyInt(), anyInt(), any());
+ verify(storeData2, never()).deserializeData(eq(null), anyInt(), anyInt(), any());
reset(storeData1, storeData2);
}
@@ -780,10 +789,10 @@ public class WifiConfigStoreTest extends WifiBaseTest {
mWifiConfigStore.read();
verify(sharedStoreData, times(1)).deserializeData(
any(XmlPullParser.class), anyInt(),
- eq(WifiConfigStore.INITIAL_CONFIG_STORE_DATA_VERSION), any(), any());
+ eq(WifiConfigStore.INITIAL_CONFIG_STORE_DATA_VERSION), any());
verify(userStoreData, times(1)).deserializeData(
any(XmlPullParser.class), anyInt(),
- eq(WifiConfigStore.INITIAL_CONFIG_STORE_DATA_VERSION), any(), any());
+ eq(WifiConfigStore.INITIAL_CONFIG_STORE_DATA_VERSION), any());
}
/**
@@ -831,10 +840,10 @@ public class WifiConfigStoreTest extends WifiBaseTest {
mWifiConfigStore.read();
verify(sharedStoreData, times(1))
.deserializeData(any(XmlPullParser.class), anyInt(),
- eq(WifiConfigStore.INTEGRITY_CONFIG_STORE_DATA_VERSION), any(), any());
+ eq(WifiConfigStore.INTEGRITY_CONFIG_STORE_DATA_VERSION), any());
verify(userStoreData, times(1))
.deserializeData(any(XmlPullParser.class), anyInt(),
- eq(WifiConfigStore.INTEGRITY_CONFIG_STORE_DATA_VERSION), any(), any());
+ eq(WifiConfigStore.INTEGRITY_CONFIG_STORE_DATA_VERSION), any());
}
/**
@@ -846,7 +855,7 @@ public class WifiConfigStoreTest extends WifiBaseTest {
private boolean mStoreWritten;
MockStoreFile(@WifiConfigStore.StoreFileId int fileId) {
- super(new File("MockStoreFile"), fileId, mEncryptionUtil);
+ super(new File("MockStoreFile"), fileId, UserHandle.ALL, mEncryptionUtil);
}
@Override
@@ -899,8 +908,7 @@ public class WifiConfigStoreTest extends WifiBaseTest {
@Override
public void deserializeData(XmlPullParser in, int outerTagDepth, int version,
- WifiConfigStoreEncryptionUtil encryptionUtil,
- WifiConfigStoreMigrationDataHolder storeMigrationDataHolder)
+ WifiConfigStoreEncryptionUtil encryptionUtil)
throws XmlPullParserException, IOException {
if (in == null) {
return;
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/service/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 34b365f43e..abaf62841e 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -452,6 +452,8 @@ public class WifiMetricsTest extends WifiBaseTest {
private static final boolean IS_MAC_RANDOMIZATION_ON = true;
private static final int NUM_LINK_SPEED_LEVELS_TO_INCREMENT = 30;
private static final int TEST_RSSI_LEVEL = -80;
+ private static final int MAX_SUPPORTED_TX_LINK_SPEED_MBPS = 144;
+ private static final int MAX_SUPPORTED_RX_LINK_SPEED_MBPS = 190;
private ScanDetail buildMockScanDetail(boolean hidden, NetworkDetail.HSRelease hSRelease,
String capabilities) {
@@ -2514,6 +2516,26 @@ public class WifiMetricsTest extends WifiBaseTest {
}
/**
+ * Check max supported link speed
+ */
+ @Test
+ public void testConnectionMaxSupportedLinkSpeed() throws Exception {
+ mWifiMetrics.startConnectionEvent(mTestWifiConfig, "TestNetwork",
+ WifiMetricsProto.ConnectionEvent.ROAM_ENTERPRISE);
+ mWifiMetrics.setConnectionMaxSupportedLinkSpeedMbps(MAX_SUPPORTED_TX_LINK_SPEED_MBPS,
+ MAX_SUPPORTED_RX_LINK_SPEED_MBPS);
+ mWifiMetrics.endConnectionEvent(
+ WifiMetrics.ConnectionEvent.FAILURE_NONE,
+ WifiMetricsProto.ConnectionEvent.HLF_NONE,
+ WifiMetricsProto.ConnectionEvent.FAILURE_REASON_UNKNOWN);
+ dumpProtoAndDeserialize();
+ assertEquals(MAX_SUPPORTED_TX_LINK_SPEED_MBPS, mDecodedProto.connectionEvent[0]
+ .routerFingerprint.maxSupportedTxLinkSpeedMbps);
+ assertEquals(MAX_SUPPORTED_RX_LINK_SPEED_MBPS, mDecodedProto.connectionEvent[0]
+ .routerFingerprint.maxSupportedRxLinkSpeedMbps);
+ }
+
+ /**
* Check ScoringParams
*/
@Test
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java b/service/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
index ae8f1229e8..3d4f33a351 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
@@ -757,6 +757,7 @@ public class WifiNativeTest extends WifiBaseTest {
verify(mWificondControl).startPnoScan(eq(WIFI_IFACE_NAME),
eq(TEST_PNO_SETTINGS.toNativePnoSettings()), any(), captor.capture());
captor.getValue().onPnoRequestSucceeded();
+ verify(mStaIfaceHal).removeAllNetworks(WIFI_IFACE_NAME);
verify(mWifiMetrics).incrementPnoScanStartAttemptCount();
}
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java b/service/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java
index c25648d53b..7c7f369c90 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java
@@ -2971,7 +2971,6 @@ public class WifiNetworkFactoryTest extends WifiBaseTest {
in.setInput(inputStream, StandardCharsets.UTF_8.name());
mNetworkRequestStoreData.deserializeData(in, in.getDepth(),
WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION,
- mock(WifiConfigStoreEncryptionUtil.class),
- mock(WifiConfigStoreMigrationDataHolder.class));
+ mock(WifiConfigStoreEncryptionUtil.class));
}
}
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WifiSettingsConfigStoreTest.java b/service/tests/wifitests/src/com/android/server/wifi/WifiSettingsConfigStoreTest.java
index e783b3766c..2471e090e1 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WifiSettingsConfigStoreTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WifiSettingsConfigStoreTest.java
@@ -121,8 +121,7 @@ public class WifiSettingsConfigStoreTest extends WifiBaseTest {
XmlPullParser in = createSettingsTestXmlForParsing(WIFI_VERBOSE_LOGGING_ENABLED, true);
storeDataCaptor.getValue().resetData();
- storeDataCaptor.getValue().deserializeData(in, in.getDepth(), -1, null,
- mock(WifiConfigStoreMigrationDataHolder.class));
+ storeDataCaptor.getValue().deserializeData(in, in.getDepth(), -1, null);
assertTrue(mWifiSettingsConfigStore.get(WIFI_VERBOSE_LOGGING_ENABLED));
}
diff --git a/service/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigSharedStoreDataTest.java b/service/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigSharedStoreDataTest.java
index 64b2460a2f..3ee3c15f6e 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigSharedStoreDataTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigSharedStoreDataTest.java
@@ -26,7 +26,6 @@ import androidx.test.filters.SmallTest;
import com.android.internal.util.FastXmlSerializer;
import com.android.server.wifi.WifiBaseTest;
import com.android.server.wifi.WifiConfigStore;
-import com.android.server.wifi.WifiConfigStoreMigrationDataHolder;
import com.android.server.wifi.util.WifiConfigStoreEncryptionUtil;
import org.junit.Before;
@@ -82,8 +81,7 @@ public class PasspointConfigSharedStoreDataTest extends WifiBaseTest {
in.setInput(inputStream, StandardCharsets.UTF_8.name());
mConfigStoreData.deserializeData(in, in.getDepth(),
WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION,
- mock(WifiConfigStoreEncryptionUtil.class),
- mock(WifiConfigStoreMigrationDataHolder.class));
+ mock(WifiConfigStoreEncryptionUtil.class));
}
/**
diff --git a/service/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigUserStoreDataTest.java b/service/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigUserStoreDataTest.java
index 0c00875b03..cfa6044f66 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigUserStoreDataTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointConfigUserStoreDataTest.java
@@ -37,7 +37,6 @@ import androidx.test.filters.SmallTest;
import com.android.internal.util.FastXmlSerializer;
import com.android.server.wifi.WifiBaseTest;
import com.android.server.wifi.WifiConfigStore;
-import com.android.server.wifi.WifiConfigStoreMigrationDataHolder;
import com.android.server.wifi.WifiKeyStore;
import com.android.server.wifi.util.TelephonyUtil;
import com.android.server.wifi.util.WifiConfigStoreEncryptionUtil;
@@ -238,8 +237,7 @@ public class PasspointConfigUserStoreDataTest extends WifiBaseTest {
in.setInput(inputStream, StandardCharsets.UTF_8.name());
mConfigStoreData.deserializeData(in, in.getDepth(),
WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION,
- mock(WifiConfigStoreEncryptionUtil.class),
- mock(WifiConfigStoreMigrationDataHolder.class));
+ mock(WifiConfigStoreEncryptionUtil.class));
}
/**