summaryrefslogtreecommitdiffstats
path: root/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
Commit message (Collapse)AuthorAgeFilesLines
* Enterprise suggestion's catificate share same lifecycle as suggestionNate(Qiang) Jiang2020-03-041-1/+5
| | | | | | | | | | Enterprise network suggestion's catificate will add to keystore immediately after add the suggestion, and will only remove after suggestion is removed. Bug: 150500247 Test: atest com.android.server.wifi Merged-In: I85fb81a98f16b6a343fb35ce31e1426e333773b0 Change-Id: Icbe49911d7ca93b03dfdf728ad88057c31aa5974
* fix soft reboot caused by KeyStore exceptionxshu2020-01-141-5/+19
| | | | | | | | | | | | | | | | | | | The Mac handle obtained from AndroidKeyStore is sometimes invalidated by the AndroidKeyStore based on some LRU technique. This change make sure that we always get a valid handle. And adds exception handling to make sure a crash will not happen for the same reason again. If KeyStore continuously fails to generate MAC address, we will use locally generated MAC as it is the next best option. Bug: 146203882 Test: atest FrameworksWifiTests Merged-In: I8a3b810ba95898a96d81fe57979db4787e1a46c4 Change-Id: I8a3b810ba95898a96d81fe57979db4787e1a46c4 (cherry-picked from e299359a6e6e9e13217862f7f66627eccbff46ce)
* MAC randomization SSID hotlist supportxshu2019-12-091-1/+38
| | | | | | | | | | | Reads from DeviceConfig and parses a comma separated of SSIDs. Bug: 144172117 Test: atest FrameworksWifiTests Test: Manually tested on device Change-Id: I53b15e884ecba377277eac81f9e3ca86474f5c13 Merged-In: Ie42ce853810aa5dfd4eef89dff281740dafaf3be (cherry picked from a522b345fa15716a21fd9edcf523cf3c1331dd94)
* Merge changes I478f1d55,I39bb0916 into qt-qpr1-devOscar Shu2019-12-031-3/+15
|\ | | | | | | | | | | * changes: Fix boot regression from KeyStore being slow [MAC rand] Fix unit test slowness
| * Fix boot regression from KeyStore being slowxshu2019-12-021-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| * [MAC rand] Fix unit test slownessxshu2019-12-021-3/+5
| | | | | | | | | | | | | | | | | | | | Removing usage use spyStatic to speed up unit test. Bug: 143712485 Test: atest WifiConfigManagerTest is back to normal speed now Change-Id: I39bb0916bf3a88f73a1ca869af347e3442f2384b Merged-In: I39bb0916bf3a88f73a1ca869af347e3442f2384b (cherry picked from: 316dd9f75f489c8e4c26efaae56f1cdefe9a56b9)
* | Revert submissionHai Shalom2019-11-211-131/+0
|/ | | | | | | Reason for revert: Incomplete fix that causes additional issues which were not anticipated earlier. Change-Id: Ie75fe87dd671ebe00add8c858da47dff793077a4 Merged-In: I526410612fe2f733ae41efe7ed1a20ab6d620458
* [WPA3] Fix WPA3-Personal transition modeHai Shalom2019-11-161-0/+131
| | | | | | | | | | | | | Fix WPA3-Personal in transition mode issues. Current solution will create an upgraded WPA3 connection if there is a WPA2 saved network and AP is in transition mode. Bug: 143843364 Test: Manual tests Test: atest ConfigurationMapTest ScanResultMatchInfoTest WifiConfigManagerTest Change-Id: Ia4c6d9a36c99fccc7f5144bef4898761b57610b0 Merged-In: I09d589b56d3f0c09cbf8d7f627776c9f87a27162
* WifiConfigStore: Encrypt credentials for networks (4/4)Roshan Pius2019-11-141-1/+1
| | | | | | | | | | | | | | | | | | | Add a setting to turn on/off encryption. This global setting will be turned on for devices which require encrypted credentials. We don't need to support flipping the global settings back n forth. Only needs to support the one way toggle from off to on once for the lifetime of the device. Bug: 140485110 Test: atest com.android.server.wifi Test: Manual verification - Store a PSK network config on older build - Upgrade to build with this CL - adb shell settings put global niap_mode 1 - Ensured that the psk was read correctly on upgrade - Ensured that the psk was encrypted when stored on disk after upgrade Change-Id: Ibabe0814bfc42a7bf610d18e89a7b82bacfdfeed Merged-In: Ibabe0814bfc42a7bf610d18e89a7b82bacfdfeed
* [MAC rand] Removing persistent storagexshu2019-10-251-1/+17
| | | | | | | | | | | | | | | | | | | | Will now calculate the randomized MAC address directly for new wifi networks. For existing networks that already have saved randomized MAC address, we will continue to use the saved MAC. Bug: 140065828 Test: unit tests before and after factory reset Test: Verified that new MAC address entries are not populated into WifiConfigStore.xml Test: Manually verified calculated MAC addresses are consistent and valid. Test: Manually verified that the device secret is persisted over different builds Change-Id: Ie216fbaf33e2582ae1a0030c5046b0d4162255d9 Merged-In: I4b4e2cc6fe304d277661c4743e4fb86bb7500f16 (cherry picked from commit I4b4e2cc6fe304d277661c4743e4fb86bb7500f16)
* Revert "WifiConfigStore: Limit integrity checks to single user devices"Roshan Pius2019-08-061-2/+1
| | | | | | | | | | This reverts commit 8e70909c098f29b008d062e0cb30f313d300542d. Removing workaround. Proper fix in CL above. Bug: 138482990 Test: N/A Change-Id: Iaee7746a3afc0fd6e80daa77ce5034e660261e8b
* WifiConfigStore: Limit integrity checks to single user devicesRoshan Pius2019-08-011-1/+2
| | | | | | | | | | | Bug: 138482990 Test: atest com.android.server.wifi Test: Device boots up & verified that config store files are not integrity protected. Test: Will send for full wifi regression tests. Change-Id: I1bf8ae320935cc1bf70625792c4c1a5e0d54f034 (cherry-picked from 3d3f64e670c5a2e3469fd9577b0e635447cbe70d)
* Mask out macRandomizationSetting when feature is unsupportedxshu2019-07-101-0/+39
| | | | | | | | | | | | | | All wifi networks will use factory MAC to connect when the config_wifi_connected_mac_randomization_supported feature flag is set to false. Making macRandomizationSetting always return "false" in the above case. Bug: 137230966 Test: unit tests Test: manual test on a unsupported device - verifying network details page is always showing the factory MAC address. Change-Id: I3ed8599a7123a084bdf20d8f30ba6dcbcea83356
* Get isSimPresent() directly from TelephonyDavid Su2019-05-101-63/+57
| | | | | | | | | | | | | | | | | Instead of caching isSimPresent in Wifi, directly call the Telephony API to query if a SIM card is loaded. Also reset identity/anonymous identity of Wifi networks using SIM-based authentication when the SIM card is removed rather than when the SIM card is inserted, to support multi-SIM use cases. Bug: 130875004 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: On a device with multiple SIMs, connect to a EAP-SIM network using one SIM, then remove that SIM. Wifi network should disconnect and not re-connect. Change-Id: Id878c0402e3611b9f23c09bf8df87ab0a0ef8e60
* Fix all Wifi calls to TelephonyManager to explicitly use default data ↵David Su2019-05-071-9/+11
| | | | | | | | | | | | | | | | subscription Previously, calls to TelephonyManager APIs did not specify which subscription to use, and different Telephony APIs have different default subscriptions to use, leading to inconsistent data being retrieved. Fix these API calls to consistently use the default data subscription. Bug: 112741663 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: Connect to EAP-SIM network with one SIM for voice and one SIM for data. Change-Id: Id352372a21fc2dca60b9df88ced1bc3fb47f28d8
* Merge "WifiConfigManager: Remove user choice on disableEphemeralNetwork" ↵Roshan Pius2019-04-221-0/+31
|\ | | | | | | into qt-dev
| * WifiConfigManager: Remove user choice on disableEphemeralNetworkRoshan Pius2019-04-181-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | For ephemeral networks, disableEpehemeralNetwork() call is equivalent to the user forgetting the network (albeit for 24 hours). So, remove user choice set by that network on any other networks. Also, a minor refactor of disableEphemeralNetwork(return early on null). Bug: 130816398 Test: Manual verification Test: atest com.android.server.wifi.WifiConfigManagerTest Change-Id: I92c01b71ecad4bff3da77bc0cdaf3aa979037bd8
* | Merge "WifiConfigManager: Handle file creation errors gracefully" into qt-devTreeHugger Robot2019-04-201-0/+9
|\ \ | |/ |/|
| * WifiConfigManager: Handle file creation errors gracefullyRoshan Pius2019-04-181-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If the user's CE directory is not accessible for some reason, all of the user store file creation/read will fail. Handle these errors more gracefully by checking for nulls in that path. Note: If there are errors accessing the CE directory, any existing data within the user store files will be lost. This CL does not attempt to fix that. Bug: 130366402 Test: Existing ACTS tests for config store. Change-Id: I4c51b224e35e0d1b352359cd3be1dbbe2e66936f
* | PasspointNetworkEvaluator: Ignore networks disconnected by user.Ecco Park2019-04-171-5/+29
|/ | | | | | | | | | | WifiConfigManager maintains a blacklist of all ephemeral networks that the user decided to disconnect. Avoid connecting back to them in all the evaluators (already handled in suggestion & scored evaluators). Bug: 130309348 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: If72207b166b76bd32ad1bcfcd70fb069464d650f Signed-off-by: Ecco Park <eccopark@google.com>
* Merge "Change MAC mapping to use <SSID,SecurityType>"Oscar Shu2019-03-301-1/+1
|\
| * Change MAC mapping to use <SSID,SecurityType>xshu2019-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wificonfiguration#configKey does not always return SSID + SecurityType, which is causing the MAC for passpoint networks to be stored not according to specs. This CL makes sure that SSID + SecurityType is always used as the key to store randomized MAC addresses. Bug: 128911090 Test: unit tests Test: Connect to "Boingo", then adb pull /data/misc/wifi/WifiConfigStore.xml and verify storage <string name="&quot;Passpoint Secure Google&quot;WPA_EAP">ce:98:95:f2:f7:90</string> Test: Forget "Boingo" network, reconnect back, and verify randomized MAC stays the same Change-Id: I45b7d5e2b73c251526ba43dff3c69e07fa0e0b28
* | WifiConfigManager: Ignore user unlock for non current userRoshan Pius2019-03-291-0/+75
|/ | | | | | | | | | | | | | | 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
* Merge "Revert "WifiConfigManager: Temporarily blacklist on disconnect""Roshan Pius2019-03-251-3/+1
|\
| * Revert "WifiConfigManager: Temporarily blacklist on disconnect"Roshan Pius2019-03-221-3/+1
| | | | | | | | | | | | | | | | | | This reverts commit 0cd22728c628e51e8f259f8404a97dec49804424. Bug: 126503889 Reason for revert: UI changes was punted to R. No rationale in making this API changing behavior now. Change-Id: Ie8cd931980d2eb0c7bf660cb0fa646848d315a71
* | carrier-wifi: Support RFC4648 encoding methodEcco Park2019-03-221-0/+2
|/ | | | | | | | | | | If carrier wifi configuration has the encoding method, it will be used for decoding SSID and encoding identity. Otherwise, default encoding method (RFC2045) will be used. Bug: 109795427 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: Iabf4f8a76184ca8f3956d1e0b1cb6f1561738548 Signed-off-by: Ecco Park <eccopark@google.com>
* WifiConfigManager: Temporarily blacklist on disconnectRoshan Pius2019-03-141-1/+3
| | | | | | | | | | | When an external entity (settings for example) triggers WifiManager.disconnect() API, ensure that we blacklist the network temporarily for 1 hour. Any internal disconnects triggered by the stack will not result in blacklisting the network. Bug: 126503889 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: If66fd078fa74b8153a9d1aca2ed362b2246f276d
* Merge "LRWD: consistent Watchdog trigger with BSSID/SSID blacklist"TreeHugger Robot2019-03-111-3/+41
|\
| * LRWD: consistent Watchdog trigger with BSSID/SSID blacklistRoger Wang2019-02-231-3/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | Ignore BSSID/SSID blacklist before Watchdog trigger. Thus, Watchdog would trigger faster and have a chance to recover. Bug: 123349476 Test: Manually test check BSSID/SSID won't count before Watchdog trigger check Watchdog won't trigger again to connect issue SSID Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: Ifc478b5abc27ae9a80bfa0ce7b85de59d55fbe25
* | Merge "Filter out WifiConfiguration for Passpoint in getConfiguredNetworks"Ecco Park2019-03-011-1/+19
|\ \
| * | Filter out WifiConfiguration for Passpoint in getConfiguredNetworksEcco Park2019-02-151-1/+19
| |/ | | | | | | | | | | | | | | | | | | When savedOnly flag is set, we need to return only wifiConfiguration for saved network. Bug: 124522563 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: I01c443ecbe7b6839eabfa837b3a1a37007a8c6c5 Signed-off-by: Ecco Park <eccopark@google.com>
* | WifiConfigManager: Set "last selected" even if app has no permissionRoshan Pius2019-02-261-9/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | We've allowed apps to use the legacy API surface to connect to networks that they don't have permission to modify/control the network. Ensure we set/reset the |lastSelectedNetwork| flag for such requests. Note: These apps cannot still enable/disable the network for auto-connect purposes. Bug: 121221919 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: I74525b3b8c9f7cf65aa8329c18b9db545cb03f38
* | Remove the ephemeral network when new config represents same network.Ecco Park2019-02-131-0/+59
|/ | | | | | | | | | | | | | | | | | | | | | Problem: While we are in the procedure of OSU, if we click different entry that is actually same one with OSU under the hood to connect on Wifi Picker, nothing will happen and it will be blocked in the stagei because we do not disconnect OSU AP to abort current flow. Root cause: The configuration for OSU and Captive portal network represents same network, so it has same network ID. Solution: Remove the corresponding ephemeral network before we add/update the network with new configuration. Bug: 121223278 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: Tested with OSU AP that supports captive portal and OSU function at the same time. Signed-off-by: Ecco Park <eccopark@google.com> Change-Id: I2f715974ae11a57d75df61736a9e3973da36b706
* WifiConfigManager: Expire deleted ephemeral ssid entriesRoshan Pius2019-02-111-31/+71
| | | | | | | | | | | | | | | | | | The deleted ephemeral ssid entries were persisted forever, this could lead to really poor experience for apps using the suggestion API surface. So, expire these entries after a day. The entries are reaped passively (i.e only when there is a lookup for the entry from one of the evaluators). Also, changed couple of asserts in the unit test to compare strings to help with debugging failures. Bug: 123360912 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: Manually verify the config store migration (for verifying the tranistion from the deleted ephemeral set to a map) Change-Id: I3e54d40042d3d6ce5e224d705b4e34c7e1bcb5ed
* Revert "Revert "WifiConfigStore: Remove legacy modules""Roshan Pius2019-02-111-111/+2
| | | | | | | | | This reverts commit e9471f7d35cb5a39af883b5379812eeaba8b12d0. Bug: 123929173 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: Device boots up & connects to wifi networks. Change-Id: Iaa141f902b589f70a03cdfb56a714aee62c2fe6a
* Make sure all saved networks have rand mac at bootupxshu2019-02-061-0/+36
| | | | | | | | | | | | | When the device is updated to Q for the first time, generate randomized MAC address and store them to permanent storage. Bug: 122991465 Test: unit tests Test: flash P build, add networks, then flash new build. Verify that the randomized MAC address stays the same after forgetting and re-adding those saved networks. Change-Id: I6dadc0f730bdf49dd0d2ca094dd6b75d1abea69a
* WifiConfigManager: App attribution for suggestion/requestRoshan Pius2019-01-231-7/+87
| | | | | | | | | | | | | | Add new field to mark a WifiConfiguration as created from a network specifier or suggestion. WifiConfiguration.creatorName for such networks will contain the package name of the app that added the corresponding specifier/suggestion. This can be used by the settings app to display the app's name in the wifi picker summary. Bug: 115504887 Bug: 113878056 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: I673a9e309a3faeb01723211d8f80f75d9477994a
* Persist randomized MAC over forget networkxshu2019-01-181-1/+55
| | | | | | | | | | Create and save a Map from configKey to the randomized MAC address for each unique network ever created. Bug: 122991465 Test: Unit tests Test: Verified on device with MAC randomization on, add network, examine MAC address, forget network, add the same network again and verify the MAC address is the same as the previous one. Change-Id: Ic703ec6fd3c9ccf36582b32721c0a4d703e66cc7
* [WIFI] Add exemptions to allow DO/PO/Carrier apps to obtain randomized MAC ↵Etan Cohen2019-01-181-11/+36
| | | | | | | | | | | | | address The randomized MAC address is not available to apps (exceptions are for other parts of the stack and Settings). Add exemptions for DO, PO, and Carrier apps (Carrier apps only for configs which they created). Bug: 112205095 Test: atest com.android.server.wifi Change-Id: I6cc0cf59a2134963bd1003769bf0eba26a0bf344
* Merge "WifiConfigManager: Allow setupwizard to modify proxy settings"TreeHugger Robot2019-01-141-1/+30
|\
| * WifiConfigManager: Allow setupwizard to modify proxy settingsRoshan Pius2019-01-071-1/+30
| | | | | | | | | | | | | | | | Allow both settings & setupwizard to modify proxy settings. Bug: 116075069 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: I75738a62e504a876fe26f894f629dcb03e27e0df
* | Merge "WifiConfigManager: Retrieve package name for shared uids"Roshan Pius2019-01-141-10/+27
|\ \
| * | WifiConfigManager: Retrieve package name for shared uidsRoshan Pius2019-01-121-10/+27
| |/ | | | | | | | | | | | | | | | | | | The package name retrieved using PackageManager.getNameForUid() contains a concatenation of package name & uid. Retrieve the package name out of that string for comparison during app removal. Bug: 120623236 Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: Ia266297b8c702e3d72f2d816270f4c059a763c9a
* / passpoint-r2: remove WifiConfiguration when removing a passpoint profileEcco Park2019-01-111-0/+14
|/ | | | | | | | | | | | | | | | After moving removeAllEphemeralOrPasspointConfiguredNetworks API from disconnected state to disabled state, Passpoint configuration still exists in the memory until wifi is off. However, if we remove the Passpoint profile, we need to remove the corresponding WifiConfiguration. Otherwise, wifi picker shows the Access point with current configurations as "SSID available via service name" Bug: 121223278 Test:./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: tested with R1 and R2 AP under the test scenario. Change-Id: I7284e30f2e2e561712d35832a0c38a43f7893305 Signed-off-by: Ecco Park <eccopark@google.com>
* Take 2 of Migrate frameworks/opt/net/wifi to androidx.testBrett Chabot2018-12-191-1/+2
| | | | | | | | See go/jetpack-test-android-migration Test: atest FrameworksWifiTests Bug: None Change-Id: I76a3394fe1e4f5b268ed2716291b33d1db8f9f85
* Merge "Revert "Migrate frameworks/opt/net/wifi to androidx.test""Brett Chabot2018-12-191-2/+1
|\
| * Revert "Migrate frameworks/opt/net/wifi to androidx.test"Brett Chabot2018-12-191-2/+1
| | | | | | | | | | | | | | | | | | This reverts commit 560ff95760cd1fc1da022e0972a5e29b739fcc52. Reason for revert: Broke master Exempt-From-Owner-Approval: build fix, pure revert Change-Id: I9f155cff6a712a6831be6af6b4dc671a35cd2ee1
* | Merge "Migrate frameworks/opt/net/wifi to androidx.test"TreeHugger Robot2018-12-191-1/+2
|\|
| * Migrate frameworks/opt/net/wifi to androidx.testBrett Chabot2018-12-141-1/+2
| | | | | | | | | | | | | | | | See go/jetpack-test-android-migration Test: make checkbuild Bug: None Change-Id: I68f37d8eaf20b82a4e26ef7914e13460495e9762
* | Merge "Add unit test for giving Setup Wizard permission"Oscar Shu2018-12-181-1/+34
|\ \