summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorxshu <xshu@google.com>2019-11-26 11:26:08 -0800
committerxshu <xshu@google.com>2019-12-02 16:39:49 -0800
commit151e7bb7b5ac4633bdac673bba401e5b80edf03c (patch)
treee69124cfbb8d529d902ab570f3c4a80046a43b8c /service
parentfe3912fd156bc82e501dac14db9a07aa18a82acc (diff)
Fix boot regression from KeyStore being slow
Getting the secret hashfunction from KeyStore had increased wifi service start time by ~20ms. Moving this to loadFromStore, which happens right after boot complete, should fix the problem. Bug: 144579147 Test: atest FrameworksWifiTests Change-Id: I478f1d558121e56e3d8bdeed4220eb8ba4ef097a Merged-In: I478f1d558121e56e3d8bdeed4220eb8ba4ef097a (cherry picked from: 0c6db026e4463abb4030cdf4f7813152f2dd1996)
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index b5d06ff05..1f53527e2 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -278,7 +278,7 @@ public class WifiConfigManager {
private final WifiInjector mWifiInjector;
private final MacAddressUtil mMacAddressUtil;
private boolean mConnectedMacRandomzationSupported;
- private final Mac mMac;
+ private Mac mMac;
/**
* Local log used for debugging any WifiConfigManager issues.
@@ -454,11 +454,6 @@ public class WifiConfigManager {
Log.e(TAG, "Unable to resolve SystemUI's UID.");
}
mMacAddressUtil = mWifiInjector.getMacAddressUtil();
- mMac = mMacAddressUtil.obtainMacRandHashFunction(Process.WIFI_UID);
- if (mMac == null) {
- Log.wtf(TAG, "Failed to obtain secret for MAC randomization."
- + " All randomized MAC addresses are lost!");
- }
}
/**
@@ -3202,6 +3197,12 @@ public class WifiConfigManager {
* @return true on success or not needed (fresh install), false otherwise.
*/
public boolean loadFromStore() {
+ // Get the hashfunction that is used to generate randomized MACs from the KeyStore
+ mMac = mMacAddressUtil.obtainMacRandHashFunction(Process.WIFI_UID);
+ if (mMac == null) {
+ Log.wtf(TAG, "Failed to obtain secret for MAC randomization."
+ + " All randomized MAC addresses are lost!");
+ }
// If the user unlock comes in before we load from store, which means the user store have
// not been setup yet for the current user. Setup the user store before the read so that
// configurations for the current user will also being loaded.