From 6b3f8a279d1bd2cde761a9fee3d9c96436324b6f Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 28 Mar 2019 12:42:03 -0700 Subject: WifiConfigManager: Ignore user unlock for non current user Changes in the CL: a) Ignore user unlock if the user id is not for current active user. b) Reset the |mDeferredUserUnlockRead| on a user switch( mDeferredUserUnlockRead might be set from a previous user unlock). Bug: 129434351 Test: Ensured that the device persists the saved networks on reboot. Test: Will send the patch to Android auto team to ensure that their issue is resolved. Test: atest com.android.server.wifi Test: Will send for full regression. Change-Id: If3c1dd8026323b8747d086a767e49a0d899ee990 --- service/java/com/android/server/wifi/WifiConfigManager.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'service/java/com/android/server/wifi/WifiConfigManager.java') diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 81b513920..701b010bd 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -2871,6 +2871,8 @@ public class WifiConfigManager { Log.w(TAG, "User switch before store is read!"); mConfiguredNetworks.setNewUser(userId); mCurrentUserId = userId; + // Reset any state from previous user unlock. + mDeferredUserUnlockRead = false; // Cannot read data from new user's CE store file before they log-in. mPendingUnlockStoreRead = true; return new HashSet<>(); @@ -2905,12 +2907,16 @@ public class WifiConfigManager { if (mVerboseLoggingEnabled) { Log.v(TAG, "Handling user unlock for " + userId); } + if (userId != mCurrentUserId) { + Log.e(TAG, "Ignore user unlock for non current user " + userId); + return; + } if (mPendingStoreRead) { Log.w(TAG, "Ignore user unlock until store is read!"); mDeferredUserUnlockRead = true; return; } - if (userId == mCurrentUserId && mPendingUnlockStoreRead) { + if (mPendingUnlockStoreRead) { handleUserUnlockOrSwitch(mCurrentUserId); } } -- cgit v1.2.3