summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2020-03-16 13:33:16 -0700
committerRoshan Pius <rpius@google.com>2020-03-16 14:58:17 -0700
commit92abc19028801ae105e2f4f4046229ebbcc1d98e (patch)
tree2f4ee9432d46c2fc453c2e90c5203fd73c1ab647 /service
parent5c99f2f1d4c31c81ea0fd4d5928ad47cc15a467e (diff)
WifiConfigStore: Remove all usage of WifiMigration.loadFromStore
In preparation of moving away from this API surface to a different mechanism. Bug: 149418926 Test: atest com.android.server.wifi Test: Device boots up and connects to wifi networks. Change-Id: I530d79138ea9219eace686b736e843c4c2d37187
Diffstat (limited to 'service')
-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/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/WifiConfigStore.java14
-rw-r--r--service/java/com/android/server/wifi/WifiConfigStoreMigrationDataHolder.java73
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java3
-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
14 files changed, 14 insertions, 138 deletions
diff --git a/service/java/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreData.java b/service/java/com/android/server/wifi/ImsiPrivacyProtectionExemptionStoreData.java
index 065ccf1db..acfba80c5 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 4c2bf7782..33c511ba4 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 7d06a70e1..763f267b9 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 05cf4cc92..f59fe35aa 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;
@@ -122,8 +121,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 8c7c9bd83..a03be6056 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/SoftApStoreData.java b/service/java/com/android/server/wifi/SoftApStoreData.java
index 299f51507..ac32ae66a 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 e5636f603..e3374ddbe 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 f828930b6..074393b81 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/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java
index f2f48be1f..b5c3534cc 100644
--- a/service/java/com/android/server/wifi/WifiConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiConfigStore.java
@@ -190,7 +190,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 +235,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.
@@ -572,8 +568,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.");
}
@@ -622,7 +616,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 +671,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
@@ -877,14 +871,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 7ecae0f1f..000000000
--- 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/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index e67c06851..8e9d6a0a1 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/WifiSettingsConfigStore.java b/service/java/com/android/server/wifi/WifiSettingsConfigStore.java
index 7a1931cf2..872d0d437 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 fe69bcc27..b956983c4 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 84c8be706..e7de22f55 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) {