summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-01-27 01:15:12 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-01-27 01:15:13 +0000
commit69dfa6e3f6657d5505c881133fe1320edd066589 (patch)
tree18af84ad98254c4ba79f7cec22c99be263d129a6 /service
parent8eb5377c60cb75a63da07df1ebb5d0e8320b57cb (diff)
parentd7e826a86f845e439715eae57d43731d1ca9a404 (diff)
Merge "WifiConfigManager: Cleanup the pending store read logic"
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java33
1 files changed, 27 insertions, 6 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 1424a8c0d..e4bf1e4f4 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -262,6 +262,16 @@ public class WifiConfigManager {
*/
private boolean mPendingUnlockStoreRead = true;
/**
+ * Flag to indicate if we have performed a read from store at all. This is used to gate
+ * any user unlock/switch operations until we read the store (Will happen if wifi is disabled
+ * when user updates from N to O).
+ */
+ private boolean mPendingStoreRead = true;
+ /**
+ * Flag to indicate if the user unlock was deferred until the store load occurs.
+ */
+ private boolean mDeferredUserUnlockRead = false;
+ /**
* This is keeping track of the next network ID to be assigned. Any new networks will be
* assigned |mNextNetworkId| as network ID.
*/
@@ -2293,12 +2303,6 @@ public class WifiConfigManager {
if (mVerboseLoggingEnabled) {
Log.v(TAG, "Loading from store after user switch/unlock for " + userId);
}
- // Don't handle user unlock or switch unless the migration from legacy stores is complete.
- if (mWifiConfigStoreLegacy.areStoresPresent() && !mWifiConfigStore.areStoresPresent()) {
- Log.d(TAG, "Legacy store files found. Ignore user switch/unlock until migration is "
- + "complete!");
- return;
- }
// Switch out the user store file.
if (loadFromUserStoreAfterUnlockOrSwitch(userId)) {
saveToStore(true);
@@ -2328,6 +2332,10 @@ public class WifiConfigManager {
Log.w(TAG, "User already in foreground " + userId);
return new HashSet<>();
}
+ if (mPendingStoreRead) {
+ Log.wtf(TAG, "Unexpected user switch before store is read!");
+ return new HashSet<>();
+ }
if (mUserManager.isUserUnlockingOrUnlocked(mCurrentUserId)) {
saveToStore(true);
}
@@ -2358,6 +2366,11 @@ public class WifiConfigManager {
if (mVerboseLoggingEnabled) {
Log.v(TAG, "Handling user unlock for " + userId);
}
+ if (mPendingStoreRead) {
+ Log.w(TAG, "Ignore user unlock until store is read!");
+ mDeferredUserUnlockRead = true;
+ return;
+ }
if (userId == mCurrentUserId && mPendingUnlockStoreRead) {
handleUserUnlockOrSwitch(mCurrentUserId);
}
@@ -2483,6 +2496,7 @@ public class WifiConfigManager {
Log.w(TAG, "No stored networks found.");
}
sendConfiguredNetworksChangedBroadcast();
+ mPendingStoreRead = false;
}
/**
@@ -2539,6 +2553,13 @@ public class WifiConfigManager {
}
loadInternalData(storeData.getSharedConfigurations(), storeData.getUserConfigurations(),
storeData.getDeletedEphemeralSSIDs());
+ // If the user unlock comes in before we load from store, we defer the handling until
+ // the load from store is triggered.
+ if (mDeferredUserUnlockRead) {
+ Log.i(TAG, "Handling user unlock after loading from store.");
+ handleUserUnlockOrSwitch(mCurrentUserId);
+ mDeferredUserUnlockRead = false;
+ }
return true;
}