diff options
author | NedaTopoljanac <tneda@google.com> | 2018-09-05 18:29:30 +0100 |
---|---|---|
committer | Ecco Park <eccopark@google.com> | 2018-09-13 17:47:47 +0000 |
commit | 21d4c6e06c6235c8971324be1bace324ba2b7481 (patch) | |
tree | 36e2c737e7d4d646fa0bb34ba914e07b1bfe391f | |
parent | ceafd95ecce73d175fde04ee1010fb91f1b29c4e (diff) |
Cleaning up unnecessary code for TLS reconnect sequence.
Previously, when user unlocks the screen for the first time after reboot,
it was necessary to start reconnecting sequence in order to connect to WiFi.
Since it isn't a case anymore this code is redundant.
Bug: 64033284
Test: Manually, set up screen lock, reboot and check if it is connecting to WiFi before unlocking it.
Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I5c85457bf60054f8993164dbf4472289ac26363f
4 files changed, 1 insertions, 76 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index f376a6d5f..7781805b2 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -547,9 +547,6 @@ public class ClientModeImpl extends StateMachine { /* Supplicant is trying to associate to a given BSSID */ static final int CMD_TARGET_BSSID = BASE + 141; - /* Reload all networks and reconnect */ - static final int CMD_RELOAD_TLS_AND_RECONNECT = BASE + 142; - static final int CMD_START_CONNECT = BASE + 143; private static final int NETWORK_STATUS_UNWANTED_DISCONNECT = 0; @@ -732,11 +729,6 @@ public class ClientModeImpl extends StateMachine { */ private final WorkSource mLastRunningWifiUids = new WorkSource(); - /* - * Note if we have seen the user sign in - */ - private boolean mFirstUserSignOnSeen = false; - private TelephonyManager mTelephonyManager; private TelephonyManager getTelephonyManager() { if (mTelephonyManager == null) { @@ -1574,13 +1566,6 @@ public class ClientModeImpl extends StateMachine { } /** - * Reload networks and then reconnect; helps load correct data for TLS networks - */ - public void reloadTlsNetworksAndReconnect() { - sendMessage(CMD_RELOAD_TLS_AND_RECONNECT); - } - - /** * Add a network synchronously * * @return network id of the new network @@ -3436,9 +3421,6 @@ public class ClientModeImpl extends StateMachine { case CMD_DISABLE_EPHEMERAL_NETWORK: mMessageHandlingStatus = MESSAGE_HANDLING_STATUS_DISCARD; break; - case CMD_RELOAD_TLS_AND_RECONNECT: - mFirstUserSignOnSeen = true; - break; case CMD_SET_OPERATIONAL_MODE: // using the CMD_SET_OPERATIONAL_MODE (sent at front of queue) to trigger the // state transitions performed in setOperationalMode. @@ -4158,20 +4140,6 @@ public class ClientModeImpl extends StateMachine { mLastConnectAttemptTimestamp = mClock.getWallClockMillis(); mWifiNative.reassociate(mInterfaceName); break; - case CMD_RELOAD_TLS_AND_RECONNECT: - // TODO(b/64033284): determine if this code is still necessary - if (mFirstUserSignOnSeen) { - // a user has already been seen, nothing to do - break; - } - if (mWifiConfigManager.needsUnlockedKeyStore()) { - logd("Reconnecting to give a chance to un-connected TLS networks"); - mWifiNative.disconnect(mInterfaceName); - mLastConnectAttemptTimestamp = mClock.getWallClockMillis(); - mWifiNative.reconnect(mInterfaceName); - } - mFirstUserSignOnSeen = true; - break; case CMD_START_ROAM: mMessageHandlingStatus = MESSAGE_HANDLING_STATUS_DISCARD; return HANDLED; diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 558a1f3bb..e1dbf6dc1 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -2494,23 +2494,6 @@ public class WifiConfigManager { } /** - * Any network using certificates to authenticate access requires unlocked key store; unless - * the certificates can be stored with hardware encryption - * - * @return true if we need an unlocked keystore, false otherwise. - */ - public boolean needsUnlockedKeyStore() { - for (WifiConfiguration config : getInternalConfiguredNetworks()) { - if (WifiConfigurationUtil.isConfigForEapNetwork(config)) { - if (mWifiKeyStore.needsSoftwareBackedKeyStore(config.enterpriseConfig)) { - return true; - } - } - } - return false; - } - - /** * Helper method to perform the following operations during user switch/unlock: * - Remove private networks of the old user. * - Load from the new user store file. diff --git a/service/java/com/android/server/wifi/WifiKeyStore.java b/service/java/com/android/server/wifi/WifiKeyStore.java index e36c50188..3054fe5e0 100644 --- a/service/java/com/android/server/wifi/WifiKeyStore.java +++ b/service/java/com/android/server/wifi/WifiKeyStore.java @@ -269,25 +269,4 @@ public class WifiKeyStore { } return true; } - - /** - * Checks whether the configuration requires a software backed keystore or not. - * @param config WifiEnterprise config instance pointing to the enterprise configuration of the - * network. - */ - public static boolean needsSoftwareBackedKeyStore(WifiEnterpriseConfig config) { - String client = config.getClientCertificateAlias(); - if (!TextUtils.isEmpty(client)) { - // a valid client certificate is configured - - // BUGBUG(b/29578316): keyStore.get() never returns certBytes; because it is not - // taking WIFI_UID as a parameter. It always looks for certificate - // with SYSTEM_UID, and never finds any Wifi certificates. Assuming that - // all certificates need software keystore until we get the get() API - // fixed. - return true; - } - return false; - } - } diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java index e3dbc3ebf..fc7e66481 100644 --- a/service/java/com/android/server/wifi/WifiServiceImpl.java +++ b/service/java/com/android/server/wifi/WifiServiceImpl.java @@ -2362,12 +2362,7 @@ public class WifiServiceImpl extends IWifiManager.Stub { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); - if (action.equals(Intent.ACTION_USER_PRESENT)) { - // TLS networks can't connect until user unlocks keystore. KeyStore - // unlocks when the user punches PIN after the reboot. So use this - // trigger to get those networks connected. - mClientModeImpl.reloadTlsNetworksAndReconnect(); - } else if (action.equals(Intent.ACTION_USER_REMOVED)) { + if (action.equals(Intent.ACTION_USER_REMOVED)) { int userHandle = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0); mClientModeImpl.removeUserConfigs(userHandle); } else if (action.equals(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)) { |