History log of /frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
327bd4253115abc757ebaf5f1bddd9f5ad2253e4 22-Jun-2017 Roshan Pius <rpius@google.com> WifiConfigManager: Ignore masked EAP passwords

Whenever an app retrieves one of the saved network configuration using
the WifiManager API's, we mask out the |preSharedKey|, |wepKeys| and
|enterpriseConfig.getPassword()| fields. These apps may however pass the
same network configuration (with some changes) back to the
framework via WifiManager.updateNetwork() or WifiManager.connect() API's.
Since the current update API does not specify which field within the
WifiConfiguration is modified, framework tries to copy over all the
fields sent in thus overriding the real password with the masked value
sent by the app.

Ideally the apps should create a new WifiConfiguration with just the
fields that they want to modify and send it via
WifiManager.updateNetwork(). But, since this is a very common mistake
we have some protection against this in the framework for the
|preSharedKey| and |wepKeys|. But, we're missing this protection for the
|enterpriseConfig.getPassword()| fields.

Bug: 62893342
Test: Unit tests.
Test: Manual test to ensure that masked password sent from settings is
ignored.
Test: Regression tests.

Change-Id: I163c8c44b2717364aff88cb7ca1b2faa3aa6cce9
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
403df479e25031276c738dbea334f09bb7e4bf37 18-May-2017 Ningyuan Wang <nywang@google.com> Remove network from supplicant when it is disabled

This CL expands OnSavedNetworkUpdateListener interface by
replacing onSavedNetworkUpdate() event with a list of
detailed events.
This CL also removes a network from supplicant when it's
disabled.

Bug: 37406637
Test: compile, unit tests, manual tests, integration test

Change-Id: Idfa29cd15b8ad75de3bb7448abd7f3c93f9778f0
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
a8bea9aed9c0e8a16e51568541b90f0900edb9ef 20-May-2017 Randy Pan <zpan@google.com> WifiConfigManager: convert BSSID to lower case

When application specifies a particular BSSID for a
WifiConfiguration, the passed in string can be in any format.
When storing this BSSID field, we now always convert it lower case
to match the format of how BSSID is presented in scan results.

Bug: 38439640
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: Ic39d35694ee766cf83366fe7f00560684a18ac02
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
24ee320f5ef7359514bd5167a4a11e31813e5019 05-Apr-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "WSM: Support add/update/enable network in any state" into oc-dev
19c1d955a4784f12c49714662569c022b51707e6 04-Apr-2017 Randy Pan <zpan@google.com> Merge "Update PNO scan network list upon network update" into oc-dev
5d0addadb370bcbb8900414fb9597bd415e6fea0 03-Apr-2017 Randy Pan <zpan@google.com> Update PNO scan network list upon network update

Add a listener interface in WifiConfigManager to notify events
such as network being enabled, disabled, blacklisted or
un-blacklisted.

WifiConnectivityManager listens to the above events and update
the PNO scan network list if necessary.

Bug: 30399964
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I75523a3a53ff62b14d485fd722354c4d6c3b18c1
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
6f1055408a43428ababffc1d1fa928c825924680 04-Apr-2017 Roshan Pius <rpius@google.com> WifiConfigManager: Persist immediately on enable/disable network

The change in network state due to public API calls should be
immediately persisted (not wait for the buffered write from
updateNetworkSelectionStatus to kick in after 10 seconds).

This was detected in the test: |test_reboot_configstore_reconnect| which
connects to a network and immediately reboots the device. This prevents
the last buffered write (for enabling network) to be flushed out and
hence the network is reloaded as disabled.

Bug: 35811529
Test: Unit tests
Change-Id: I6f769429df67d83ad014ef552901a7b1419c7721
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
dc5eab67d9ca3e0453318071746e76b5d16990d6 30-Mar-2017 Roshan Pius <rpius@google.com> WSM: Support add/update/enable network in any state

WifiConfigManager can support network addition/updation as soon as the
config store is read at bootup. So, add support for it in WSM.

ENABLE_NETWORK handling is duplicated because when wifi is off, we don't
want to trigger a connection request (when disableOthers is true).

Bug: 36773940
Test: Unit tests.
Change-Id: Ib4089e45e61062e1043329b2b77d1d19579cb3c0
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
edf8be948c0879a2153582e853dc048f3060512a 24-Mar-2017 Roshan Pius <rpius@google.com> WSM: Reconnect on network credential change

Currently, we ignore connect request if we're already connected to the
same network. This is not correct for network modifications. Hence,
trigger a reconnect in this case.

Changes in the CL:
1. Add a new |hasCredentialChanged| param in NetworkUpdateResult.
2. Use that in WSM to determine if we need to trigger a reconnect.

While there,
Removed a couple of unused setters in NetworkUpdateResult.
Fixed WifiConfigManager unit test failure due to mockito change.

Bug: 36505419
Bug: 36020928

Test: Unit tests and manual tests via settings UI.
Test: Will send for regression tests.
Change-Id: I1adaac58108c2f65fb36173a468dff000f5372c8
Merged-In: I1adaac58108c2f65fb36173a468dff000f5372c8
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
2a4eccdb8aab8e028e8bc8e88e13ab73d8627d87 25-Mar-2017 Roshan Pius <rpius@google.com> Revert "WifiConfigManager: Add quotes back for psk"

This reverts commit a63ab49c1d20d7a698537b5253d172a8dffc235f.

Change-Id: Ic1516df6078001260c721cf8400855297d6cf67a
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
28102ffacda0802a1c4aa1b7edbbcc2bf01391a9 24-Mar-2017 Roshan Pius <rpius@google.com> Unit test fixes for WifiConfigManager/WifiVendorHal

Bug: 36407367
Test: tests pass now.
Change-Id: I45fec07e8f041e1043a3bb5da5c855d02e2c27e9
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
3a86cc60b6cd3a5eb7b4982ba98f7e71ad45915e 20-Mar-2017 Peter Qiu <zqiu@google.com> hotspot2: allow Process.WIFI_UID to modify Passpoint networks

Passpoint networks are generated by PasspointManager, and can be
added to WifiConfigManager via either PasspointNetworkEvaluator
(for auto connection) or Settings app (for manual connection).
In either case, the network will need to be removed from
WifiConfigManager once the connection is completed.

Since the Passpoint networks are managed/owned by us, bypass
the permission check for any Passpoint network modifications
made by us (with UID Process.WIFI_UID).

Bug: 36357280
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: manual test
Change-Id: I5b1bcf3cb882a9d63a1643d8db779788c22b8036
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
018e39e2f6201519373e7f4dbb1427f0e5274898 10-Mar-2017 Peter Qiu <zqiu@google.com> WifiConfigMangaer: use updated legacy Passpoint config indicator

Bug: 36101691
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I85cd5619072ec978913df932c0b47ebe696074bc
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
835e781643b79c30fabbab5595770cf01b5861fb 01-Mar-2017 Rebecca Silberstein <silberst@google.com> WifiPermissionsUtil: add checkConfigOverride

Add a helper method to allow callers to check the calling UID for the
override config permission. This CL moves the call from
WifiConfigManager to the util/WifiPermissionsUtil class and adds tests.

Bug: 35870086
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: frameworks/base/wifi/tests/runtests.sh
Change-Id: I5aa1bbc82eb86408272564365d45b7ddbf7cc661
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
a63ab49c1d20d7a698537b5253d172a8dffc235f 07-Mar-2017 Roshan Pius <rpius@google.com> WifiConfigManager: Add quotes back for psk

For user's who lost the quotes around their ASCII psk passphrase, add
them back to be backward compatible.

Bug: 36008106
Test: Unit tests
Test: Verified manually updating a device which had previously
lost it's quotes around psk.
Change-Id: I6ef8ea2059ff044ba9e57d46bb50aa5ee7dcad9b
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
040829fe448045d12cbc90f6143aca7da6b5aa80 23-Feb-2017 Peter Qiu <zqiu@google.com> WifiConfigManager: setup user store when loadFromStore is triggered after user unlock

Instead of performing an user unlock/switch logic after reading from
the store, we only need to setup the user store for the current
user before performing the read.

Bug: 35675098
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I6a8f2695d53c8a2ea8589e64c9dd8e867ae5415e
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
5e4822d5dba15e45c5ff43dfba3ac7803b3f4e28 23-Feb-2017 Peter Qiu <zqiu@google.com> hotspot2: migrate legacy Passpoint configurations

When the legacy Passpoint configuration is read from the legacy
store, it will represented as WifiConfiguration and stored in the
share store. When the owner of the legacy Passpoint configuration
logs in, the configuration will be converted to PasspointConfiguration
and added to PasspointManager, then persist to the user store in the
new format.

Bug: 34206769
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: manually upgrade a bullhead containing Boingo and Global Reach
Passpoint profiles from N to O, verify configurations are
maintained and still able to connect to those APs

Change-Id: Idcd858326968463cea0cdc99452ba67b13d2ac77
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
3f7cd32878130323e2632bc2c6b8b211f6260138 03-Feb-2017 Amin Shaikh <ashaikh@google.com> Add a disabled reason for recommendation providers

When the NetworkRecommendationProvider provides a "do not connect"
recommendation, mark all enabled available saved networks
WifiConfiguration#mNotRecommended. This value is used in
Settings/SystemUI to display a message that the network is not
currently recommended.

Bug: 34745259
Bug: 35671673
Test: ./runtests.sh
Change-Id: Id623963c5ae88f19935fae9f38f3a1bc0a116be3
Merged-In: Id623963c5ae88f19935fae9f38f3a1bc0a116be3
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
f9c69201a95062e33cf62d7bacd465e799788a8f 11-Feb-2017 Rebecca Silberstein <silberst@google.com> WifiStateMachine: allow config removal

Allow FORGET_NETWORK and REMOVE_NETWORK commands to be handled in the
DefaultState. This means we can now remove configs in any state.

Proper handling for loaded config checks are handled by
WifiConfigManager. A test was added to confirm calling removeNetwork
with a random int properly returns false when no network configs are
loaded.

Bug: 32809235
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: frameworks/base/wifi/tests/runtests.sh
Test: All automated Sanity tests passed
Change-Id: I66dbef26530e3376f00537a3f1241bfd4f8a0d8b
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
0a0b5035ce8013ed327a0802357a1b7df3061912 07-Feb-2017 Peter Qiu <zqiu@google.com> Wifi configuration store data refactor

Currently, the unified config store files contained data for
network list and deleted ephemeral SSID list. Since both of them
are owned by WifiConfigManager, it is tightly integrated into
WifiConfigManager, results in complexities when need to add
new data that's not owned by WifiConfigManager (e.g. Passpoint
configurations) to the store file.

To reduce the complexity, an abstraction is provided for the store
data to be persist to the store files. Any interested module
can register its own store data to the store file. Then at read/
write time, WifiConfigStore will iterate through each registered
store data to deserialize/serialize configuration data from/to
a XML block, to be persist to the store file.

So each StoreData is responsible for serialization/deserialization
of a XML block denoted by its tag. For example,
WifiNetworkListStoreData is responsible for the XML block under
tag <NetworkList>.

Bug: 31065385
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: Manual test to verify saved networks are persisted over boots
Test: Manual test to verify migration of legacy store file still works
Test: Regression integration test
Change-Id: I83c2eb7cd907188f392b5179405f19182ee13bb9
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
d7e8058288bdc5085b54fef77dbfa38597cea348 01-Feb-2017 Peter Qiu <zqiu@google.com> WifiConfigManager: do not delete certificates and keys for passpoint network

They will be deleted when the Passpoint profile is uninstalled.

While there, avoid triggering a perisistent store save when adding or
removing a WifiConfiguration for a Passpoint network.

Bug: 34888235
Test: Verify connecting to a Passpoint network works after
is disconnected previously

Change-Id: I204eaf7053d047b5f4983c6167e6e520bcf643ff
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
249f241b74b783d8c42af201d40f453ea637b32a 31-Jan-2017 Roshan Pius <rpius@google.com> WifiConfigManager: Handle user switch after fresh install

Need to handle user switch after a fresh install. Since, there are no
store files after a fresh install, we need to reset the
|mPendingStoreRead| flag to allow user switch handling.

Bug: 34834491
Test: Added unit test
Change-Id: I097ea506c2e536413feab89182d03826829eabce
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
850116348dacd6baf16645641c3383970e4a1157 31-Jan-2017 Peter Qiu <zqiu@google.com> hotspot2: cache ScanDetail for Passpoint network

When a new WifiConfiguration is created/added for a Passpoint network,
we need to cache the initial ScanDetail for it. So that others can
get more detail information about the network (e.g. NetworkDetail)
when needed.

Bug: 34735964
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: Ia8ee3fef2eab3c4bcd81c23a0adf9b805abaaf6f
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
23ed63d91b8af8f1d3569371daedc4162e323cc0 30-Jan-2017 Roshan Pius <rpius@google.com> WifiStateMachine: Allow network list retrieval in Default state

Now that we've moved the config store loading to DefaultState, we should
be able to start supporting network list retrieval in DefaultState as
well. This should allow apps to query the list of networks configured
even when wifi is turned off.

Bug: 33391502
Test: Added unit test
Test: Verified that the saved networks list is visible in settings even
wifi is turned off.
Test: Regression tests
Change-Id: I1b0716d59a2262fc269d95138cd7f90a442eb18b
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
d7e826a86f845e439715eae57d43731d1ca9a404 26-Jan-2017 Roshan Pius <rpius@google.com> WifiConfigManager: Cleanup the pending store read logic

I had assumed that user unlock would always come after boot completed,
but it turns out that it's not always the case (especially for non
encrypted devices).

Couple of flags added to handle this race:
1. mPendingStoreRead: Used to indicate if we have invoked
|loadFromStore| or |migrateFromStore| once. This flag is used to defer
any user unlock or switching handling untill we do load from store.
2. mDeferredUserUnlockRead: Used to indicate if we deferred a user
unlock handling because we had not yet loaded from store.

User switching requires a UI interaction and cannot occur until the
BOOT_COMPLETED broadcast is received. So, there is no need to handle
that. A wtf was added to alert for out of order notifications.

Bug: 34741678
Test: Added Unit tests.
Change-Id: Id17d233f8da2540210b84cbd313b2a3efff90d70
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
4f294fab991c91d629b9dfab5ed3a35a69ed3ce6 20-Jan-2017 Roshan Pius <rpius@google.com> WifiConfigManager: Restructure config store load

Currently, we load from config store only when we start wpa_supplicant
in SupplicantStartingState. However, we handle the user unlock/switch
in the DefaultState. This could lead to cases where we handle the user
unlock (& thus overwrite the config store file) even before we have had
the opportunity to read the existing data out.

Changes in the CL:
1. Decouple the migration of data out of legacy store and the load of
data from new store files.
2. The new config store loading will now happen in BOOT_COMPLETED
message handling. If it's a bootup after fresh install or upgrade from
N, this will be a no op.
3. Whenever wpa_supplicant is started, attempt to migrate data out of
the old config store. If the data has already been migrated, this will
be a no op.
4. User unlock/switch before migration is performed is ignored.

PS: This will also help us handle the
|WifiManager#getConfiguredNetworks| API even if wifi is disabled.

Bug: 33966771
Bug: 33391502
Test: Added unit tests
Test: Will send for integration tests
Change-Id: I3e4f7e21dc88bad5ae8581a150b29850fbac0afa
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
0d14dbc1da819e72054b9f168c8e3db767dd34bf 01-Sep-2016 Glen Kuhne <kuh@google.com> Http Proxy Profile & Device Owner permission check

Adding permissions checks to ensure callers of
WifiManager.SAVE_NETWORK and addOrUpdateNetwork() have either
Profile Owner policy, Device Owner policy, or the System Uid. if
they're setting the Http Proxy.

While I was here: Fixed a bug where IpManager wasn't notified of an IP
settings change when a WifiConfiguration's STATIC proxy was modified.

Bug: 14669153
Bug: 32584568
Test: extended WifiConfigManagerTest
Change-Id: I5bc3b1bff6628ffeea7bf6ecd0f6f25a671ab682
Merged-In: I5bc3b1bff6628ffeea7bf6ecd0f6f25a671ab682
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
9cc8b06885dc5889a1ed503b25faff5b83d20978 04-Jan-2017 Peter Qiu <zqiu@google.com> Fix unit tests related to EAP networks

Currently, the tests assumes all EAP networks are Passpoint networks,
which is not true. So remove this assumption and fix tests that
are broken by this.

Bug: 34076701
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: Id340fa1162035741e7391849b274295f30a66bdb
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
1fe1065da82165183fa057ddbbd2e33bc5708c1b 01-Dec-2016 Robin Lee <rgl@google.com> Send CMD_DISCONNECT after removing app/user configs

Otherwise they might linger in wpa_supplicant longer than they were
supposed to.

This is already done by every other callsite for removing networks which
might still be in use.

Test: runtest -x tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
Bug: 32660379
Change-Id: I45b0bcc87129be02bcce940f07f7c48543207bf0
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
1cb361461f6ecc684761fc3940c1db622192cad1 29-Nov-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Disconnect from private network on user switch

If the device is connected to the old user's private network when
switching to a new user, trigger a disconnect.

Bug: 32802464
Test: Unit tests.
Test: Will send for regression testing.
Change-Id: Ibe1523fcf9e88a05dd7e8ee34b0a0decab1235f0
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
2ce074c7dfa6f99812f67cad3c1a98a6edd36028 28-Nov-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Don't load shared networks on user unlock/switch

Currently, we reload all the store data (private + shared) on user
switching/first unlock. Loading of shared store data is unnecessary and
causes undesired side effect of the shared networks changing it's ID
after the reload. Instead, add a new method in WifiConfigStore to only
read the user's store file (holding private network configurations).

Changes in the CL:
1. Modify the |WifiConfigStore.switchUser| method to switch the user
store and also read out the data from the user store file.
2. When handling user switches/unlocks, delete only the private networks
of the old user from memory and then load the new user's private
networks.

TODO: This CL will handle the case where the device was connected to a
shared network when the user unlocked or switched. Still need to initiate
disconnect if we're connected to one of the old user's private networks.
This will be added in a follow up CL.

Bug: 32802464
Test: Added Unit tests.
Test: Will send for regression testing.
Change-Id: I84f6f011bbd851f986e4294262af7a47e525524b
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
60ecc292c27e34df1a9414da0d6482cce718efbc 11-Nov-2016 Randy Pan <zpan@google.com> WifiConfigManager: partial scan channel list

Always include the channel of the currently connected network in
the channel set returned by
fetchChannelSetForNetworkForPartialScan().

Bug: 32745312
Test: Wifi unit tests.
Change-Id: I94a653a2e15222c7f615e9f2c1c3234ba0f1bb09
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
b2c8d28046e96c4506482e030c6320cda6db8f30 11-Nov-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Remove legacy store files

This was commented out in the initial submission. Ensure that the old
config store files (networkHistory.txt, ipconfig.txt) are removed after
migration.

Bug: 31273501
Test: Unit tests
Test: Will send for integration testing.
Change-Id: I5fbdd53372f720fcdcbd43d4ced388a2aee3c01c
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
bbf3b21e42e6f13bddd1c30e4266b5be0d1404be 11-Nov-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Don't trigger store writes for ephemeral networks

Don't trigger store writes for ephemeral network additon/removal.
The ephemeral network is anyway removed from the list to persist
in |saveToStore|. So, this write is redundant.

Bug: 32809494
Test: Added unit tests.
Change-Id: I547ae5aa3b5361a4320d2611f2571e3a379b410a
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
b3706e8c20fdf0a0e2b4ec15355ae6f98588b732 10-Nov-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Remove unnecessary loads from store

We are currently loading from store for every user unlock. This is
unnecessary. We want to load from store only in the following scenario:
1. First unlock after device bootup.
2. First unlock after user switch if user was locked during switch.

This should fix the crash in the associated bug where the networkID
changed because of a user unlock (and hence caused an unnecessary store
load previously).

Bug: 32777050
Test: Unit tests
Change-Id: Ie7731900a790e1ecfaf0ad6d7b42addb461b6d40
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
5c96fb2af01e2db3060aab970891355fa63542fd 14-Sep-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Handle duplicate network adds

When apps add multiple networks with an empty |allowedKeyMgmt| & same
|SSID| field, we end up adding multiple networks with the same config
key currently. This is because the configKey (SSID + allowedKeyMgmt)
changes once the defaults for the network configuration are set (when
the respective fields are empty in the provided config).

Changes in the CL:
1. When a new config is added, first check if we already have a network
with the same configKey in our internal records.
2. If no, create a new network with the defaults set and fields merged
from the external config.
3. Then check again if we have a duplicate network with the same
configKey as the new internal config.
4. If yes, treat this as a network update instead of add.

Refactored existing methods for the above changes.

BUG: 31473411
TEST: Added Unit test fails without the fix.
Change-Id: I2044503d5d14e46412713e9309ae77b018421cf1
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
5c6da02cf7736d4ba9fc388151177f5277464c89 12-Sep-2016 Roshan Pius <rpius@google.com> WifiConfigManagerNew: Hidden network list retrieval

Add a method to retrieve the hidden saved networks and sort this list
similar to PNO scans. We want to prioritize recently/most often
connected hidden networks over the others since the driver supports
limited number of such networks per scan.

BUG: 29503772
TEST: Added unit test.
Change-Id: I86d55501edf23501552453cb3bed25654b31756a
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
cdd9c486c7c3282ba95f4b52c68457b4ff12e93f 09-Sep-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Trigger buffered store writes

Trigger buffered store writes for frequently occuring internal
configuration updates. The buffered write API of WifiConfigStore
batches together all writes in a 10 second window.

While there,
Convert the scan detail cache to a normal hash map. This was a
concurrent hash map in the old config manager. But, there are no
multithreading concerns in the wifi stack now.

BUG: 31380765
TEST: Unit tests
Change-Id: I537af4f02e9bf3a50de1883598118077d8eab583
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
42ed8f87e72cdf7780dc3cc87da751253a6d74ed 08-Sep-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Enhance the dump method

Dump method should print out the list of saved networks along with
other internal state of the network.

While there, rename couple of internal variable names to better reflect
what they're representing:
1. Rename |mLastSelectedNetwork| to |mLastSelectedNetworkId|.
2. Rename |mLastNetworkId| to |mNextNetworkId|.

BUG: 31375675
Change-Id: Id51133bd6942e71f800026b24f05f34eede79bc9
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
0ce3ad57f3ce7fcfab17930e8cd48e6da57006fb 08-Sep-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Ensure new networks are disabled

According to WifiManager.addNetwork documentation, all newly added
networks start out disabled and need to be enabled explicitly later. So,
ensure that the status field of newly added networks are always disabled.

BUG: 31364809
TEST: Unit tests
Change-Id: I816789f3d95b1a25b0d628be7d9d556352106b9d
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
0f166e9103c4ef46eaa49ad20359ce0db2ef9791 01-Sep-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Fix a bug in key updation

Pass in the new internal WifiConfiguration object to WifiKeyStore for
enterprise networks.

While there,
Cleanup logging in WifiSupplicantControl. Few error logs are wrongly
under the verbose logging flag.

BUG: 31185953
TEST: Sending for ACTS sanity retest.
TEST: Added unit test.
Change-Id: Ie5c0b8224c003a3b782ccf9425664352cb4716a4
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
a6eb5e6da171c5426a96a8d0f97c75d1b8a46db0 29-Aug-2016 Roshan Pius <rpius@google.com> Rename new WifiConfigManager/Store class and tests

Replace the old WifiConfigManager/Store clas with the new ones.

BUG: 31009287
TEST: Unit tests
TEST: Integrated with WSM and verified wifi connectivity.
Change-Id: Ieadf85d6f2f2852e643b45d29661aa8cfc193dd8
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
01d42ec8106d27cd6ff47101dd6020c4a39e5226 29-Aug-2016 Roshan Pius <rpius@google.com> Remove old WifiConfigManager class and tests

This will be replaced with the new class in following CL's.

BUG: 31009287
TEST: Unit tests
TEST: Integrated with WSM and verified wifi connectivity.
Change-Id: I58b9ad84ec989af305f5ce9a4e42b9dc2e61e890
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
1a731d9b8078e156b99dd281b814d93ab025e363 16-Jun-2016 Roshan Pius <rpius@google.com> WifiConfigStore: Remove class

Remove the existing WifiConfigStore class. Move all the existing
functionality to two separate classes:
1. WifiSupplicantControl: For any wpa_supplicant operations.
2. WifiKeyStore: For any key management operations.

This CL doesn't change any functionality, it's only a refactor.

BUG: 29394274
BUG: 29396499
Change-Id: Ic3d3f9eb3c241f34f2fddcfa67374c9a98277e0a
TEST: Unit tests
TEST: Successfully associated the device with GoogleGuest.
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
256ee9e914f0e7470a4a0f804d2d5ce7f1a9697d 21-May-2016 Roshan Pius <rpius@google.com> resolve merge conflicts of cbb193c to master

Change-Id: I8ba39ea770cef1f5163452fd322631356de80d15
ee0ab818341d44614ffe56ae73ecc08b974c2cbb 20-May-2016 Roshan Pius <rpius@google.com> Change clock for time interval/elapsed measurments

1. Use the clock retrieved from WifiInjector in more modules: QNS,
Scanner, WifiConfigManager.
2. Use |elapsedRealtime| for time interval/elapsed measurments. Things
like scan results, config elements still continue to use
|currentTimeMillis|

Also,
1. Had to make |tryEnableQualifiedNetwork| public to prevent mockito from
calling the real method in WifiConfigManager.
2. Move keystore also into WifiInjector.

BUG: 28299258
BUG: 28824635
Change-Id: I91272aa5665abb741da7530d8920d09c8c5ea41f
TEST: Compiles & unit-test passes
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
f4267b6840dbc7f430638c35c5448187b6e83846 19-May-2016 Christopher Wiley <wiley@google.com> Move test components into its own static library

This allows us to share the class with networking code
in frameworks/base/services. Moved:
- MockLooper
- BidirectionalAsyncChannel*
- MockAlarmManager
- MockAnswerUtil

Bug: 28848133
Test: These tests continue to pass

Change-Id: I97bba188da1eb07aa8f6fccf6f051c48b197d5f1
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
e70ba4d25583efb1528f5e7bb32e0fea39a7ab41 22-Apr-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Modify meaning of config.status

Change |config.status| field to track the status of a network within the
android framework rather than the status of network within
wpa_supplicant. |config.status| is enabled/disabled from only within
updateNetworkSelectionStatus now and will only change when
|enableNetwork| & |disableNetwork| public API's are invoked.

config.status is set to ENABLED when:
We set the status as enabled whenever network selection is set to
enabled.
config.status is set to DISABLED when:
(a) We set the status as disabled whenever network selection permanently
disables it. This is usually done when the app/user explicitly disables
the network or the current logged-in user changes. Newly created
networks are also DISABLED by default.
(b) We also need to mark all networks disabled when we start WPS.
(c) enableNetwork() public API with |disableOthers| flag set to true
disables all other saved networks.

While there,
1. Refactor the |updateNetworkStatus| method.

BUG: 28219928
TEST: Compiles & unit-test passes
TEST: Ran CTS tests
Change-Id: Id3cac801fa92e28984e451300f21f6f5b76de87a
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
c38419bd95b0934cb1dfc6f1e1f29eca9929da8c 14-Apr-2016 Rebecca Silberstein <silberst@google.com> Merge "Update hasEverConnected for wifi networks" into nyc-dev
93332917bf29ddbe853a495816e486150f49da40 29-Mar-2016 Rebecca Silberstein <silberst@google.com> Update hasEverConnected for wifi networks

Set hasEverConnected to true for a network that completes a connection.

Set hasEverConnected to false when a network config changes.

Add tests to confirm hasEverConnected was added on a successful
connection and cleared when connection or credential related
configuration changes are made.

Also removed some unused imports to fix checkstyle issues in
WifiStateMachine and WifiConfigStore.

BUG: 27856374

Change-Id: Ica633166892b4673683f21ff98e3ded1607dedec
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
49db6a0f9104fea99013fa6cfe6fcf2bdc7aa661 12-Apr-2016 Rebecca Silberstein <silberst@google.com> Merge "WifiConfigStore: read requirePMF config variable" into nyc-dev
eaea4b75c2ecfd192d5dcefcf67bb851bf031f5e 12-Apr-2016 Rebecca Silberstein <silberst@google.com> WifiConfigStore: read requirePMF config variable

When saving a wifi configuration, we set the requirePMF variable from
the config, but it is never read back.

Add the getNetworkVariable call for pmfVarName and add a call to verify
the attempt to read it back in the WifiConfigManagerTest.

Additionally fixed a checkstyle issue for unused imports.

BUG: 28088226
Change-Id: Ib7b2ba796e31ae57273c34b6845c218419125b72
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
60969bf2c849011fb585cf6dc914dbd779dfb8cf 11-Apr-2016 Samuel Tan <samueltan@google.com> Rename WifiConfigManager.getConfiguredNetworks()

Rename WifiConfigManager.getConfiguredNetworks() and related methods
to WifiConfigManager.getSavedNetworks, since it better reflects
what this method does (i.e. get all configured networks except
ephemeral networks). While there, add comments for some previously
undocumented helper methods.

BUG: 28088229
Change-Id: I30e144b46277605f5847371d9e65b70306013cf5
TEST: 'runtest frameworks-wifi' passes.
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
ac69b83c9cafb9a839b578c3b5b71eb3439244ad 08-Apr-2016 Samuel Tan <samueltan@google.com> WifiConfigManager: remove WifiStateMachine field

Remove the WifiStateMachine field from WifiConfigManager, since the
latter no longer calls methods of the former. Also, change calls
to the WifiConfigManager constructors to accomodate this change.

BUG: 27405059
Change-Id: I468f74259d45d9a1a61e00b987533eaa66846024
TEST: 'runtest frameworks-wifi' succeeds.
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
06636d2de935ad5d2e8fb6483c406fe922c75ff2 05-Apr-2016 Samuel Tan <samueltan@google.com> Remove getCurrentUserId() and getCurrentUserProfiles() from
...WifiStateMachine

Move getCurrentUserId() from WifiStateMachine to WifiConfigManager,
and remove WifiStateMachine.getCurrentUserProfiles(), so that
WifiConfigManager no longer makes calls to WifiStateMachine to
perform these two tasks.

Achieve this by moving the bookkeeping for the current user ID
from WifiStateMachine to WifiConfigManager.

BUG: 27405059
Change-Id: I06a8be88f24fd81cbfe785c4304883ddc44658f8
TEST: 'runtest frameworks-wifi' succeeds.
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
73a52d3336a40903965b946f6d3624a223ad5aac 07-Apr-2016 Samuel Tan <samueltan@google.com> WifiConfigManager: rename member and constant fields

Rename fields in WifiConfigManager to properly reflect that
they are members (m* prefix), and constants (all caps with
underscores). To accomodate this change, also modify uses
of these fields outside WifiConfigManager (e.g. in WifiStateMachine).

Also:
- Remove default values given to WifiConfigManager member fields
that are initialized in its constructor, since the initalization renders
the default values useless.
- Remove member fields and constants that are unused.
- Replace the "*Milli" suffix on fields with "Ms".
- Re-ordered fields in a logical manner (i.e. static, public, then
private).
- Fixed checkstyle issues.

BUG: 27300099
Change-Id: Ifaef76bc04960f12f09267a581b9a02da7c5ab5c
TEST: 'runtest frameworks-wifi' passes.
TEST: Checkstyle returns only missing javadoc errors.
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
8c0c14b2c98bc26e6a09f66cff1244f0a30f44cb 05-Mar-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Change PNO network list type

Change the PNO network list type from WifiNative to WifiScanner type
since that is the new public interface for starting PNO scans.

1. Remove the PnoNetwork constructore from WifiNative
2. Create a temporary conversion function in WifiStateMachine to
convert to WifiNative.PnoNetwork.

BUG: 27167559
Change-Id: I7c845321eab20f822f5d7d5231294181343ef2be
TEST: Compiles & unit-test passes
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
9bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bd 02-Mar-2016 Roshan Pius <rpius@google.com> PNO: Changes in Native for new interface

Changes in WifiNative to accomodate the new Scanner based PNO interface.
Currently, we're just setting the |wifi_epno_network| list member in
|wifi_epno_params| structure. All the other values are being ignored.

1. Change the native |android_net_wifi_setPnoListNative| to accept the
PNO settings parameter instead of directly accepting the list of
networks.
2. Changes in WifiNative to send down the new |PnoSettings| structure
down to the native code instead of directly sending the list.
a. Keep the existing interface from |WifiStateMachine| which accepts a
|PnoNetwork| list and converts it into |PnoSettings| structure.
This interface will be removed once all the new Scanner based
interface plumbing is complete.
3. Add a separate native API to reset PNO list.

While there,
Remove redundant "Wifi" prefix from Pno class names.

BUG: 27167559
Change-Id: I78d35c20b4bb7a12c51d0c2cc609fb7bcb5ae516
TEST: Compiles & unit-test passes
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
dc61ad4fe8a84909a288af50a8b187c98e2194b6 26-Feb-2016 Roshan Pius <rpius@google.com> WifiConfigManager: Refactor remove network

Move the actual removal of network from database into a common utility
method which can be invoked in handleUserSwitch & removeNetwork.

This CL is part 1 of refactoring some repeating patterns in
WifiConfigManager.

BUG: 27364882
Change-Id: I374a31f4d5cf4d7ec480b9b40f26af33e1deb8b1
TEST: `runtest frameworks-wifi`
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
2d65b9aaaa740ecf66bf4734c12aea3df88e352a 24-Feb-2016 Roshan Pius <rpius@google.com> WifiConfigStore: New WifiConfigStore (Part 2)

Integrate the new WifiConfigStore into WifiConfigManager class.
Most of the public methods that have been moved to ConfigStore have been
stubbed out in WifiConfigManager. Some of the methods have been changed
to make it consistent with the other methods.

The end goal of this CL to remove all WifiNative usages in
WifiConfigManager class.

Other related changes:
1. Changes in unit-tests to use mock wifiNative everywhere.
2. Change WifiConfigManager to accept an instance of KeyStore so that it
can be mocked out in unit-tests.

BUG=27299172
TEST:`mmma -j32 frameworks/opt/net/wifi/service/ && runtest
frameworks-wif`

Change-Id: I1656d81aec0ae3337bd794541b5a0bde9cddd48e
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
c485ebf64d1049d17db8108b85653f53fcdc8949 23-Feb-2016 Glen Kuhne <kuh@google.com> WifiConfigStore Refactor read&write NetworkHistory

Created a new helper class: WifiNetworkHistory
Moved readNetworkHistory() and writeKnownNetworkHistory() from
WifiConfigStore into this class, replacing them with calls to the
helper.

BUG=27294533
Change-Id: I10d43e3fd37e251d1845ef726fea0faf136d9626
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
9d7489491984e86915b2cf4fac38a882de1c8cdb 09-Feb-2016 Roshan Pius <rpius@google.com> Disable all networks in supplicant

Temporary changes to test if we can disable all the networks in
supplicant conf file except the one we want to connect to.

Changes:
1. Remove all existing native enableNetwork invocations and replace
it with a single selectNetwork call in |WifiConfigStore.selectNetwork|.
selectNetwork enables the provided network and disables all others in
wpa_supplicant.
2. Enable all networks in wpa_supplicant before enabling PNO. These will
be disabled when we come out of PNO and decide to conneect to one of
them via selectNetwork.
3. Save the network status in networkHistory.txt and ignore the status
stored in wpa_supplicant.conf.
4. Some other cleanups:
a. Remove |enableNetworkWithoutBroadcast| definition/usages and
replace with |selectNetworkWithoutBroadcast|.
b. Add enableAllNetworksNative/disableAllNetworksNative methods to
just enable the network in wpa_supplicant.
c. Move all wpa_supplicant network enable/disable to a common API.
d. Fixed all the unit-test expectations.

BUG:26984166
TEST: `mmma frameworks/opt/net/wifi/tests && runtest frameworks-wifi`

Change-Id: Ib5a089f054557071ece6be25aad03b6458c0217c
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
c2a0ff06d58e1cfb9b69fa5b6a8fef5929812f27 22-Feb-2016 Roshan Pius <rpius@google.com> Rename WifiConfigStore to WifiConfigManager

Rename WifiConfigStore class to WifiConfigManager and replace all
existing occurences of WifiConfigStore.
This is in preparation of refactoring WifiConfigStore into a
separate class which will only deal with storing/reading configurations
from a perisistent database.

BUG: 27296463
Change-Id: Ib4c4bd3bdf3fa28771a646e1f3d244f73b690d5e
TEST: Ran unit-tests
/frameworks/opt/net/wifi/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java