• Home
  • History
  • Annotate
  • only in /frameworks/opt/net/wifi/service/java/com/android/server/wifi/util/
History log of /frameworks/opt/net/wifi/service/java/com/android/server/wifi/util/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3e80f5fa9e07c935c328fd06de555cfd5f43ed26 30-May-2017 Roshan Pius <rpius@google.com> InformationElementUtil: Handle malformed scan results

Malformed scan results will leave the |protocol|, |keyManagement| and
|pairwiseCipher| fields in inconsistent after IE parsing. Handle this
in the |generateCapabilitiesString()| method.
This CL restores the handling of these malformed scan results prior to
ag/2285932.

Bug: 62154614
Test: Unit tests
Change-Id: I1e8998c9d951c7dc4e2d7163c80091fd40ca3672
nformationElementUtil.java
f7364b4baea06722022b7c6519ace0556481cc06 26-May-2017 Ningyuan Wang <nywang@google.com> Support parsing WPS for scan result capabilties string

This CL allows InformaitonElementUtil to parse WPS information
element and append [WPS] to the capabilities string.

This also removes a few lines of unused code.

Bug: 62034562
Test: compile, unit tests, manual test

Change-Id: Ic4ccd58ba3aaf268a81516888815bec8e4b32330
nformationElementUtil.java
c66d00cefbd32ec2fbefcf1fd54c1aaf50b5ce5a 19-May-2017 Ningyuan Wang <nywang@google.com> Support coexistence of wpa and wpa2 IEs in scan result

When there are both wpa1 and wpa2(rsn) ies in scan result,
InformationElementUtil.generateCapabilitiesString() should
handle it and generate capabilties string correctly.

Bug: 37653951
Test: compile, unit tests, manual test, integration test
Change-Id: I7160fcbbd75c07f4fe02de62a3e4539fa628eab3
nformationElementUtil.java
7e9eafab778c3920732a965ca9a0b330c6c676d6 04-May-2017 Glen Kuhne <kuh@google.com> P2P: handle null p2p_dev_address sta auth/deauth

This fixes an issue introduced with the HIDL interface, legacy STA
devices have a null p2p device address, and only use a src address.
The pre-HIDL behaviour was to use the srcAddress if the p2pDeviceAddress
was unavailable, this CL restores that.

Bug: 37961262
Test: Manual verification with LINKS app, added unit test
Change-Id: Ib270228e8a2d1f90423c7057052623115f586f64
ativeUtil.java
2fd9436184ea37a297f2abd5e884d30d0014b620 29-Mar-2017 Rebecca Silberstein <silberst@google.com> WifiServiceImpl: add LOHS permission checks

The new calls to start/stopLocalOnlyHotspot and
getLocalOnlyHotspotConfig need to have permission checks to make sure
only valid callers can turn the hotspot on since that disables wifi.
Enabling LocalOnlyHotspot also requires the location permission and that
Location services are enabled. A utility was added to ease testing.

This CL also adds tests verifying the permission checks.

Bug: 36760523
Bug: 37082656
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh

Change-Id: I91b28ccb44113bb6233a50f643db785e0a509d53
ifiPermissionsUtil.java
3871ff67f4a6970f1831fc8951392746c9e2bfa2 13-Apr-2017 Rebecca Silberstein <silberst@google.com> WifiServiceImpl: setWifiApEnabled unit tests

Add unit tests to cover setWifiApEnabled. This did require a small
change to check a tethering permission and add the user manager.

Bug: 37294233
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I7bdfdcbdfa60605bc2e61f18aa8abeb4bcaf5c56
Merged-In: I77413789b1b2a19c9330f4c9b9978c4a0f5b5bf8
Merged-In: I33ae84d7282dea967a53a644018e20eb2902eca3
ifiPermissionsUtil.java
d44fca25d34d80d98c242423c3a5504a325553ab 31-Mar-2017 Roshan Pius <rpius@google.com> XmlUtil: Restore networks with CURRENT status as ENABLED

When the device reboots while connected to a network, they might have
their status saved as CURRENT in the xml store file. When this is being
restored, we need to set this network status as ENABLED (since it is not
connected at the point of restore).

Bug: 35811529
Test: Unit tests
Change-Id: I282f56a1c5c3e78b98fb23913772636be68e0f20
mlUtil.java
2a1078dc3729bab248bbd28c8336749481e045cf 16-Mar-2017 Roshan Pius <rpius@google.com> SupplicantP2pIfaceHal: Support for P2P client list and save config

Also,
Moved mac address to long conversion methods to NativeUtil to help with
unit tests.

Bug: 36042785
Test: Added unit tests.
Change-Id: I6c1a78abf8c0f8159195c2542dfe217a7b954df0
ativeUtil.java
9ef555a48ac600c8766f703fa60db15b69e20301 10-Mar-2017 Peter Qiu <zqiu@google.com> WifiConfigurationXmlUtil: persist additional fields for legacy Passpoint configuration

When migrating legacy Passpoint configurations, the configuration will only
get migrated when its owner logs in. In the meantime, we will
need persist all the required data in the share store temporarily.
So persist the additional required fields for Passpoint to the storage
to avoid any data loss in the case when migration took multiple
boots to complete.

Bug: 36099588
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: manual test updating a device from N to O, verify all configs
are migrated.

Change-Id: I040dfd9f207ed1a9b2e3ccd50eca50560d6e1444
mlUtil.java
d19743b66ba214a8c4a5166d1fe7d938f97a3f03 14-Mar-2017 Roshan Pius <rpius@google.com> SupplicantHal: Fix Wps PBC/Display setup

For Wps PBC/Display the app can choose to send a null bssid to indicate
that we want to indicate wildcard. So, add support for it.

Change NativeUtil.macAddressToByteArray to allow null/empty strings
which would return all zero'ed bssid.

Bug: 34714021
Test: Unit tests
Test: WPS setup can now be initiated via settings app.
Change-Id: I223eb9666163a0f02fe6b68480b1a05895563803
ativeUtil.java
9e83e33d444446e59aa59fc355972ff804d8eafa 07-Mar-2017 Peter Qiu <zqiu@google.com> util: add utility functions for retrieving Hotspot 2.0 specific IEs

Instead of using the parsed IEs maintained in NetworkDetail, the interested
party can use the newly added utility functions to retrieve the elements
that it is interested in. This allows us to remove the NetworkDetail
dependencies from Passpoint code.

I think if we ever want to maintain a copy of parsed IEs, it should be
in ScanResult instead of NetworkDetail.

Bug: 35888100
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh

Change-Id: I69849728c93d3e1f9b6c7bda1e5c21cfdb40689a
nformationElementUtil.java
b8b3fb8228a1f90106bad8c59ce006b81ef7921c 09-Mar-2017 Roshan Pius <rpius@google.com> Remove all legacy HAL usage from framework

WifiNative now just becomes a module to route calls into the appropriate
native module: WifiVendorHal, WificondControl, SupplicantStaIfaceHal,
SupplicantP2pIfaceHal.

Changes in the CL:
1. Cleanup WifiNative to remove the legacy HAL usage.
2. Remove the |HIDL*| flags in WifiNative.
3. Remove static instance of WifiNative/WifiMonitor.
4. Remove WifiMonitor code parsing the string events from
wpa_supplicant.
5. Remove all unused jni code used for legacy HAL interactions.
6. Remove dependency of libwifi-hal & libwifi-system from framework.

Notes:
a) We can now potentially split up WifiNative into separate chunks:
WifiStaNative, WifiP2pNative, WifiRttNative, etc instead of having a
monolithic WifiNative instance.
b) We may have to add back the local log in WifiNative (b/36059665).

Bug: 35702893
Bug: 34457880
Bug: 34884202
Bug: 35421721
Test: Compiles, existing unit tests pass.
Test: Device boots up and connects to wifi networks.
Test: Verified with wifi regression (b/36068282)

Change-Id: I3e13522c912242af8023471e029edb1ce47fd3e9
elephonyUtil.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
ifiPermissionsUtil.java
ifiPermissionsWrapper.java
f50550926a7bddc24adf822876f35812d7d8c7be 07-Mar-2017 Roshan Pius <rpius@google.com> SupplicantStaNetworkHal: Add support for raw psk

|config.preSharedKey| can either be a quoted ascii passphrase or a raw
psk hexstring. Handle these 2 scenarios and call the corresponding HIDL
methods.

Bug: 36013886
Test: Added Unit tests
Test: Connected to networks with both raw psk and passphrase.
Change-Id: Ifaf31a7ce864aa0f6e86020ec5207ea8dee09205
ativeUtil.java
6a8908d2bc0367397eb92444ac78cc8d43160ef6 03-Mar-2017 Roshan Pius <rpius@google.com> SupplicantStaNetworkHal: Fix wep key handling

According to our public documentation, the wep keys can either be a
quoted ASCII string or a hex string. Since this is similar to the SSID
field, rename the helper function in NativeUtil to reuse for both.

Bug: 35907939
Test: Fixed unit test input for wep networks and validated existing
WEP related tests pass.
Change-Id: I180b9261252dc5745fa3e30e4bc980cde054ba2a
ativeUtil.java
8757adcc5e1f17354d09b4bacd3abda911974448 03-Feb-2017 Paul Stewart <pstew@google.com> Provide SIM identity for PEAP/SIM configurations

Refactor the TelephonyUtil code to take a WifiConfiguration
instead of an EAP method so it can evaluate both the outer and
inner EAP methods. This allows TelephonyUtil to whitelist SIM
authentication methods tunneled under PEAP for SIM authentication
and to provide the proper SIM identity.

Bug: 34835771
Test: Unit tests + manual tests: connect to a PEAP/EAP-SIM AP
Change-Id: I544c58f53bd1fe27fbd34626300928382095ccda
elephonyUtil.java
85d8b1c9985b1baa589877fc951ef7a2fc357076 22-Feb-2017 Chih-Hung Hsieh <chh@google.com> Use Android Gerrit OWNERS file syntax.

* Use email addresses instead of user name.
* No directory path in per-file glob.

Bug: 33166666
Test: default build targets
Change-Id: I0e6c9ad4103333f1d08cfb49ef238786d4b3bc6b
WNERS
67bbcdc2c81824ff671a5a1d8475a598199e342e 22-Feb-2017 Roshan Pius <rpius@google.com> SupplicantStaNetworkHal: Remove enclosing quotes from psk

The settings app seems to be quoting psk passphrase. So, remove those
when we add it to wpa_supplicant.

Bug: 33383725
Test: Unit tests
Test: Able to connect to psk networks now.
Change-Id: I68e9d377a97d7ad1393e14e6e5371ef9f9fab439
ativeUtil.java
82c5c5f2ee520a1066cf5d6421885bb53bbfe269 17-Feb-2017 Roshan Pius <rpius@google.com> SupplicantStaIfaceHal: Handle state change callbacks

This should invoke associated/connected broadcasts along with the state
change broadcast depending on the state.

While there,
Change NativeUtil to return lower case hex string since that is what is
being used everywhere else.

Bug: 33383725
Test: Unit tests
Change-Id: I87cbd33819ec05bc529af76d17a3e1be84a304da
ativeUtil.java
0a3dcd72290481cb1fcbaaec268cccf343e4ff48 14-Feb-2017 Roshan Pius <rpius@google.com> SupplicantStaIfaceHal: Expose current network methods

Expose methods to set bssid of the currently configured network and
retrieve the NFC token of the network.

While there,
Add unit test for the removal of all networks from wpa_supplicant.

Bug: 33383725
Test: Unit tests.
Change-Id: Ibfff7a3349967c851a3cde62e082aa5d6ec2ee91
ativeUtil.java
6d8d20617e742e68d9dc53380664a85dbaa3f927 15-Feb-2017 Michael Plass <mplass@google.com> New helper class BitMask

Helpful for translating bit flags.

Test: New unit test
Bug: 34902105
Change-Id: Id5bdcc0b22c3171fb3111d4fd3343f74de059ea1
itMask.java
42ac0dbf1eafcb7b04548922c5cfe33a631061f2 11-Feb-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "NativeUtil: Create utility for native modules"
99ee64591d5d0ac986b1dbd676382b8a1409a36f 09-Feb-2017 Roshan Pius <rpius@google.com> NativeUtil: Create utility for native modules

This class will contains helper functions for converting data format for
modules interacting with native daemons (WifiVendorHal,
SupplicantStaIfaceHal, WifiCondControl).

SSID is encoded/decoded differently based on whether it represents an
ASCII string or not.

Bug: 35154749
Test: Unit tests
Change-Id: I466ca7bc1fe14720a922715d31376a1ca7d6c988
ativeUtil.java
6296902ef69724b106973b57b268c30ea4f1ab51 10-Feb-2017 Roshan Pius <rpius@google.com> XmlUtil: Persist WifiConfiguration.status field

Since WifiConfiguration.status field is publicly exposed we need
to persist this field across reboots. We could either,
a) Directly persist this field, or
b) Reset the field on every load using the retrieved NetworkSelectionStatus.

Going with option a) since i want to try and avoid too much logic like
this in the data loading path as much as possible. We don't use this
field internally and it's only used for external apps to check the
status of the network.

Bug: 35210874
Test: Unit test
Change-Id: I80d692affe628a29c29ad2f4b66f8c1e522b114b
mlUtil.java
f2d2a31c8c98f17545f72033abe0d281c829c055 27-Jan-2017 Rebecca Silberstein <silberst@google.com> WifiPermissionsUtil: add WifiInjector

Instead of calling the WifiInjector.getInstance method that is used for
the makeLog command, pass the instance of WifiInjector so the unit tests
can pass stand alone (or when run out of order by the automated test
process).

Bug: 34764965
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh -e class
com.android.server.wifi.util.WifiPermissionsUtilTest

Change-Id: I782135fa55d1bbf760c271344a7502687a2ba591
ifiPermissionsUtil.java
d9e0e830e4b4f3c8397460cf5e197345df62c802 10-Jan-2017 Sohani Rao <sohanirao@google.com> Fix WifiScanningServiceImpl stand-alone unit test failure

WifiAsyncChannel and WifiHandler objects use lazy intialization for the
logging objects. WifiInjector.getInstance() may return a null object if
the unit test is run by itself or if earlier tests have not created it.

If the unit tests are able to update these instances with a logging
objects that are not null, then unit test can pass stand-alone.
- Add a method in FrameworkFacade to return new instances of
WifiAsyncChannel
- Update WifiAsyncChannel to expose setWifiLog() API for testing only
- Call this method on instances of WifiAsyncChannel returned by the mock
of FrameworkFacade factory to ensure mLog is not null
- Add a method in WifiScanningServiceImpl, also meant for testing only
to update WifiHandler with logging object
- Change unit tests to call this method after starting scanning service

Bug: 34127212
Test: WifiScanningServiceTest by itself and all unit tests pass
Change-Id: I0bc7a55d6d6862e2360bfb20897828e84358dd39
Merged-In: I0bc7a55d6d6862e2360bfb20897828e84358dd39
ifiAsyncChannel.java
25f5cad21b4cd0ad8aa302623463c5c861a885b0 19-Jan-2017 Jeremy Joslin <jjoslin@google.com> Use NetworkScoreManager.isCallerActiveScorer().

The previous method from NetworkScorerAppManager has been deprecated,
the new call is cheaper but otherwise the same as the old call.

Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: ./frameworks/base/wifi/tests/runtests.sh
Bug: 33781558
Change-Id: Ic8419a7f9b60661fb030973fde2653ea4cdfbc88
ifiPermissionsUtil.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
ifiPermissionsWrapper.java
b86089a48fae8878b5a27533a116c97b0be6d0e7 10-Jan-2017 Peter Qiu <zqiu@google.com> util: fix parsing logic for ExtendedCapabilities IE

The IEEE 802.11 standard specified that Extended Capabilities IE contained
a bit field of variable length. So use BitSet to represent the data instead
of an integer.

Bug: 34179560
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I1df2c92c475f1dbc4e7b17c243b4560d822ff129
nformationElementUtil.java
3872e4cd3900c7b179371028dbe0e94d9b0a7380 20-Dec-2016 Amin Shaikh <ashaikh@google.com> Populate fields in RecommendedNetworkEvaluator.

- Find corresponding ScanResult for recommended WifiConfiguration
- Set WifiConfiguration#{allowedKeyManagment,ephemeral} bits
- Add new WifiConfiguration for ephemeral networks

Test: runtest frameworks-wifi
Bug: 33702806
Change-Id: I4aaeabe626c68b13bb7aa75b89adc4cb2663508c
canResultUtil.java
865cdd20600fff47cca95971f2a343fc960bb217 19-Dec-2016 Treehugger Robot <treehugger-gerrit@google.com> Merge "Cleanup support for parsing various length integer and string from ByteBuffer"
7275c974c1d7b9451d1e67ae8d56a9d57742303c 18-Nov-2016 Sohani Rao <sohanirao@google.com> Subclass Handler to log incoming messages

A new class WifiHandler that overrides handleMessage() method to log
incoming messages and associated unit tests. In order to instantiate
WifiLog, an instance of WifiInjector is required. WifiHandler is
expected to be used by any service in wifi, including WifiP2pService.
Since this service is started before WifiService is started,
WifiInjector which is created in WifiServiceImpl would not be available
to instantiate WifiHandler if is required in the constructor. For now,
we use lazy initialization and invoke WifiInjector.getInstance() once
to get the WifiInjector and then make a WifiLog object the first time
a message is logged. In order to enable testing of this class, a hidden
API is exposed only for testing to set the logging field in the class.

Bug: 33085782
Test: Unit test suite, Sanity tests (power on, Wifi connection)

Change-Id: I9110eacb28a5faea331a818998ef25295aa589a8
ifiHandler.java
fa04a81daf829e6e5c099c9a249b8dd8dd112102 02-Dec-2016 Peter Qiu <zqiu@google.com> Cleanup support for parsing various length integer and string from ByteBuffer

Move and cleanup the parsing functions from
com.android.server.wifi.hotspot2.anqp.Constants to the newly created
ByteBufferReader, since these are generic parsing functions (not
specific to ANQP).

An unchecked runtime exception will be thrown when an error is
encountered. The possible exceptions are documented for each
API. It is the caller's responsibility to handle those
exceptions appropriately (e.g. propagate the exceptions upwards
with appropriate documentation or catch the exception).

The handling of unchecked runtime exceptions for ANQP elements
parsing will be added in the follow-on CL as part of the ANQP cleanup.

b/33296974 is filed for tracking handling of unchecked runtime
exceptions for parsing information elements.

Bug: 33000864
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I6964520e7cc86071b2096408d6cb0503e0f618ff
nformationElementUtil.java
8ca4ac971a9b862fbd69c57af3a3c0029a6b9f4d 18-Nov-2016 Peter Qiu <zqiu@google.com> hotspot2: anqp: update package name to reflect the updated location

Bug: 33000864
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: If842197a027a2c8381aacf5b256191f81bcbd1bb
nformationElementUtil.java
cb46b737eaf8f59f07270e57b37bfddcfc121fdb 22-Nov-2016 Amin Shaikh <ashaikh@google.com> Refactor NetworkScoreAppManager for testing.

Bug: 32913019
Test: runtest frameworks-wifi
Change-Id: If4bef94b6a275215ce47c8e77edb1af8cf4df3c0
ifiPermissionsUtil.java
ifiPermissionsWrapper.java
fef4b474b74c838edf9d810bf13df757012571a3 02-Nov-2016 Ningyuan Wang <nywang@google.com> Use enum instead of strings to store security parameters

Bug: 32512793
Test: compile, unittests

Change-Id: Ic7c1d9a029adad7008f9f8ad32a1139fa1262d75
nformationElementUtil.java
01282351e9b99a4929a6f30ac9813c2567c7f829 13-Sep-2016 Peter Qiu <zqiu@google.com> Remove HomeSP dependency from ScanDetail

Processing of scan result and mapping to passpoint service provider
will be done inside of PasspointManager, so no need to carry it
around in ScanDetail.

Bug: 31364818
Test: runtest frameworks-wifi

Change-Id: Ie1df66bf2d62fda0d715e94eb385d51e144fd9fe
canResultUtil.java
a541bf342d7014f6ca9dde2194e0304e1553cee0 10-Nov-2016 Sohani Rao <sohanirao@google.com> Merge "Async Channel with Logging for Wifi Services"
862b2876315938851baf9b8f4e69a2b64261f9c8 03-Nov-2016 Sohani Rao <sohanirao@google.com> Trace permissions check to access scan results

To help debug denial of permission to access scan results, add logging
to WifiPermissionsUtil.

Bug: 32616662
Test: Unit tests and verified logging in verbose mode
Change-Id: I4e7c16ee46b8c6e01c250308c4ada994ffb53156
ifiPermissionsUtil.java
cda805612a020057f7363b8e89be72ca9d6958f9 19-Oct-2016 Sohani Rao <sohanirao@google.com> Async Channel with Logging for Wifi Services

Subclassing AsyncChannel to override and add logging calls to
- sendMessage()
- replyToMessage()
- sendMessageSynchronously()

Bug: 31746964
Test: Flash and bringup phone, verify logging for services
using the WifiAsyncChannel instead of AsyncChanel

Change-Id: I0b075f3db16284ffcae0fa2881e5e73310c14e72
ifiAsyncChannel.java
fd413331c84f7fade11830efb3d9ed3dddc4e98f 31-Oct-2016 Ningyuan Wang <nywang@google.com> Merge "Add group and pairwise cipher suite info to Capabilities object"
63a4c8e9abc4f75f7885331360e67e8ac8c4f7dd 25-Oct-2016 Sohani Rao <sohanirao@google.com> WifiPermissionsUtil: Resolve refactoring bug

The function canAccessScanResults() changes the semantics of the
permissions check. Specifically, it enforces INTERACT_ACROSS_USERS_FULL
permission on all callers. The original code only enforces this when
the user or profile is not current. Update WifiPermissionsUtil and
WifiPermissionsUtilTest to ensure this functionality. Also, ensure
there's no logical change in the permissions check needed.

Bug: 32400436
Test: Unit test, cherry-pick to master and verify SetupWizard
can access scan results even though it may not have the
INTERACT_ACROSS_USERS_FULL permission

Change-Id: I84565946f1a62258b84af0a7b817bcff248d2eda
Merged-In: I84565946f1a62258b84af0a7b817bcff248d2eda
ifiPermissionsUtil.java
4d11585ede6636fee294ffb89e832e2f7f271c12 28-Oct-2016 Ningyuan Wang <nywang@google.com> Add group and pairwise cipher suite info to Capabilities object

This parses the group and pairwise cipher suite from IEs, and stores
them in InformationElementUtil.Capabilities object.

This repaces buildCapabilities() with from() and generateCpabilities
String(). This decouples security capabilities information from the
capabilities string, which is exposed to API and need to match
supplicant format.

This add the pairwise cipher to capabilities string to match the
supplicant format.

This also fixes the WPA IE structure in comments.

Bug: 32481849
Change-Id: Iaf9ec222886375ed4e5ba66b1d8e0e408acd0a20
Test: compile, manual test, unit tests
nformationElementUtil.java
92f4d52b14d8847f6f81712bf3bbfa0f1203eef5 01-Sep-2016 Sohani Rao <sohanirao@google.com> Wifi Permissions Utility to check scan permissions

Abstracted permissions check for returning scan results into a
central module - WifiPermissionsUtil
- provides a method that validates the calling uid's permissions
to access scan results
- fix permission bug by ensuring the calling uid is used instead
of uid of the system server
- ensures backward compatilibity for legacy apps and enforces
location permissions on apps of a certian version or later
Added a class WifiPermissionsWrapper to wrap static methods and
dependencies to enable testing

Bug: 30761439
Test: Unit tests, Added unit tests, Tested manually
Merged-In: Ic212821830a67a3799bd99ae9cd09fcaeae1d0e1

Change-Id: Ic212821830a67a3799bd99ae9cd09fcaeae1d0e1
ifiPermissionsUtil.java
ifiPermissionsWrapper.java
241605aebc6a8f55624026e8b72246bceb1c2ac2 03-Sep-2016 Roshan Pius <rpius@google.com> XmlUtil: Add couple of missing elements in WifiConfiguration

Add the cipher elements missing in the serialization/deserialization of
WifiConfiguration data. These fields generally have a default value set
in wpa_supplicant and so it wasn't detected earlier.
Also, add the missing requirePMF field.

BUG: 31246524
TEST: Unit tests
TEST: Verified that we can still connect to an EAP TLS network after
reboot.
Change-Id: I7bf1850738f15ec9d25b32521312db0b678c1e19
mlUtil.java
d83ef7d8c4948afc328d8ef0e746b32c195f271e 02-Sep-2016 Roshan Pius <rpius@google.com> Changes in tests for the WifiEnterpriseConfig refactor

The |getFieldValue| with prefix has been made private now. So, change to
the public version of it everywhere.

BUG: 31246524
TEST: Unit tests
TEST: Integrated with config store and verified that a previous TLS
EAP connection failure is no longer seen.

Change-Id: Ib23a384088ad17bcd928c7b5c1ac997e5e289c94
mlUtil.java
59f9a74676831ba4634b35d56a1e2bbe9bf4e322 01-Aug-2016 Glen Kuhne <kuh@google.com> WiFiMetrics: Count hidden & passpoint networks

1. Extended the WiFiMetrics proto to include counts for hidden and
passpoint networks, counting these for all saved networks, connections
and scan results.
2. Extended the counting of Open, Personal and Enterprise network to
include scans.
3. Extended ConnectionEvent logging to detect and flag passpoint network
connections.
4. Implemented the checks that detect if a scan Result is a hidden network.
While I was here: Cleaned up a couple old WifiMetrics <TODO>s, which we will not be doing.
BUG=28634987

Change-Id: I2e22bf8d79ccbda84ead700272ff0f1b0f13d2e7
Test: Extended unit tests, executed manually
nformationElementUtil.java
55b645ab4d044fbe7e0aa1c8cbb9bfdb5c17ff1d 25-Aug-2016 Roshan Pius <rpius@google.com> ScanResultUtil: Add a method to create ephemeral networks

Add a method to create ephemeral network configuration from provided
scan result.

While there,
Move the scan result matching to network matching logic entirely to
ScanResultUtil.

Change-Id: Ibf88ba1640ff71f864b1eec1c25d89404f33cd38
TEST: Added unit tests.
BUG: 31009287
canResultUtil.java
259fb5a5265e0a2aa8a851d5e694d28afe9a87f2 28-Jun-2016 Mitchell Wills <mwills@google.com> Move some of the SIM network code out of WifiStateMachine

Also add unit tests

TEST: Unit tests, boots and connects to open network
Bug: 29776729
Change-Id: I79161f87cee55abce464fb1bdbc643a92c069ffb
elephonyUtil.java
0e2540a1c1ba3c541a229b039a90789f93c41ee7 28-Jul-2016 Roshan Pius <rpius@google.com> XmlUtil: Store NetworkSelectionStatus strings

Storing direct enum values in the XML file makes it difficult to
deprecate these enums later. So, instead store the string associated
with these status/disable reason in the XML file. If any of the
status/disable reason is deprecated, the reverse lookup of the index
from the corresponding string array will fail. Such networks are
restored as enabled (along with any temp disabled networks).

Also, moved the existing logic to re-enable temporarily disabled
networks to the |parseFromXml| method since we anyway need to perform
the above checks there.

BUG: 30448209
Change-Id: Ib8b8b1ab2b730853dddb7a1d716a2150b1a0f491
TEST: Unit tests
mlUtil.java
e7399556522efdd3f137aba31c49cbb8d95c59d6 22-Jul-2016 Samuel Tan <samueltan@google.com> Remove Venue Group and Venue Type parsing code

We currently do not use the Venue Group and Venue Type
codes that are parsed from the ANQP Venue Name Element,
so remove the code that parses and internally exposes these
fields.

Note: The Venue Name Duples in Venue Name ANQP element are
exposed on the ScanResult public API, so keep the parsing code
for that field.

BUG: 30291919
TEST: Framework compiles successfully.

Change-Id: I7c20daec9e5c9fe41253fb322c2cfce231846701
nformationElementUtil.java
22b5eca14a99c2bbeeae8361c665923ce71e1603 28-Jun-2016 Roshan Pius <rpius@google.com> WifiConfigManagerNew: Scan results to config lookup

Add methods to perform:
1. Scan results to saved network lookup.
2. Cache the scan results for each saved network. Also, need to maintain
this list so that it doesn't grow uncontrolled.
3. Rename ScanDetailUtil to ScanResultUtil to accomodate scan result
helper classes for encryption type lookup.
4. Change ScanDetailCache to always trim the cache to the provided fixed
size.

While there,
Fix couple of checkstyle errors in the test.

BUG:29822168
TEST: Unit tests
Change-Id: I281ddcd606d73b8d04d6c9b33b9fc2d4f408f173
canDetailUtil.java
canResultUtil.java
bef58daefbccf81df1a6b7a9a2d103cee7819d69 27-Jun-2016 Mitchell Wills <mwills@google.com> resolve merge conflicts of cebad71 to master

Change-Id: I9d7656a52838045aa770bb47c2b72076057e5045
3c8094ab45f3320dbe45e6460c5d62dcc24ce7ae 04-May-2016 Mitchell Wills <mwills@google.com> Clear auth identity if sim removed while the device is off

TEST: Validated that changing a SIM both when the device is on and when
it is off results in the correct identity being used when trying
to authenticate with an EAP-SIM network.
Fixes: 28163651
Change-Id: I3dda95308a527be225a9f70636c727c9826ac939
elephonyUtil.java
642b0bb43ed856bac0503d3169d67026de2c1b02 13-Jun-2016 Roshan Pius <rpius@google.com> XmlUtil: Add WifiEnterpriseConfigXmlUtil

Add a utility for |WifiEnterpriseConfig| class serialization/
deserialization.

While there,
Add missing java doc on the |writeToXml| methods.

BUG: 29318473
Change-Id: I83266631e17f42f55ce1b1a4fc263c975f414419
TEST: Unit tests
mlUtil.java
c00a9331ab2a51babc3c3acd69f44be3d341c4b9 13-Jun-2016 Roshan Pius <rpius@google.com> XmlUtil: Report all parsing errors

Detect all XML parsing errors in XmlUtil and raise exceptions for them.
Changes in the CL:
1. Add new |gotoNextSection|* methods to raise exception when it does
not find a section with the expected tag name.
2. Raise exceptions for all errors in |WifiConfigurationXmlUtil|, etc.
3. |IpConfiguration| can never be null in WifiConfiguratin object, so
remove the conditional check in WifiBackupRestore.

While there,
Shorten the method names in |WifiConfigurationXmlUtil|, etc to
parseFromXml/writeToXml.

BUG: 29312911
Change-Id: I5bb152e9757f039410dd81afebaad009644e1414
TEST: Unit tests
mlUtil.java
5d3609b1931180c37d7292619146ad7d33df9a21 10-Jun-2016 Roshan Pius <rpius@google.com> NetworkSelectionStatusXmlUtil: Add utility

Add a utility for |NetworkSelectionStatus| class serialization/
deserialization.

While there,
Fix the doc strings in the existing utils to add links to the original
object they're trying to serialize deserialize.

PS: Will add a follow up CL to shorten the method names of all these
utils: NetworkSelectionStatusXmlUtil.parseFromXml/writeToXml. The
current names are unnecessarily long.

BUG: 29273147
Change-Id: I59f056a2b99e8583930b716707284d4ccf14392a
TEST: Added Unit tests
mlUtil.java
030c5debfefddf0512cd53fec48b269c08d9972e 10-Jun-2016 Roshan Pius <rpius@google.com> WifiConfigurationXmlUtil: Serialize all data for store

Add the remaining elements of WifiConfiguration that needs to be
persisted in config store and add unit-tests for verification.

PS: These elements are not serialized for backup/restore. Backup/Restore
only stores a selected subset of elements from WifiConfiguration.

While there,
Add the missing EAP configuration serialization unit tests.

BUG: 29251622
Change-Id: Ic1f22191ed1d7e654190fde5e70bfdf3545eb5d4
TEST: Unit-tests
mlUtil.java
2fafcc56fda54b1adf8b6743beaac59dbb84dfec 08-Jun-2016 Roshan Pius <rpius@google.com> WifiBackupRestore: Handle network UIDs

Don't save creatorUID element for backup/restore. All networks will be
restored with the System UID set as the creatorUID. The creator UID is
hard to preserve across backup/restore.

Also, since the creatorUID is not being backed, there are genuine cases
where the configKey mismatch might occur. So, move the |configKey|
mismatch check out of |XmlUtil| and let backup/restore & config store
handle it differently as needed.

PS: Need to also figure out if we should stop backing up all networks
not saved by settings agent (creatorUid != SYSTEM_UD). Will wait for
discussions in b/29201888 to decide on that.

BUG: 29201888
TEST: Unit-tests
Change-Id: I668281893de9260a803872c04646b5af28ee45e5
mlUtil.java
06a2281303248446bacc87a00ab66ea1fdf0392d 08-Jun-2016 Roshan Pius <rpius@google.com> WifiBackupRestore: Handle single WEP key configs

Handle backup/restore of partial WEP key configs. |XmlUtils| cannot
handle arrays with different types (string & null). So, need to convert
all null keys to empty strings while backing up and restore it
accordingly.

BUG: 28967335
Change-Id: I6133e3e5744f64c7b55a45462efe092d597e2f8b
TEST: Unit tests
mlUtil.java
052b948a8b8a009486e35cb56dbd7bb9516e8626 08-Jun-2016 Roshan Pius <rpius@google.com> Fix checkstyle errors

Fixed all checkstyle errors in the new files added for
backup/restore.

BUG: 29201893
Change-Id: I48674d5a234a40e48f2f59f84555a4c6cce4bba4
mlUtil.java
e33a4bb414892435c016486585c26022cafdab68 06-Jun-2016 Roshan Pius <rpius@google.com> XmlUtil: Move Wifi/IP-Configuration serialization

Move the serialization/deserialization of WifiConfiguration &
IpConfiguration objects to XmlUtil. This helps us to share this logic
between WifiBackupRestore & WifiConfigStore.

Changes in the CL:
1. Create |WifiConfigurationXmlUtil| for WifiConfiguration
serialization.
2. Create |IpConfigurationXmlUtil| for IpConfiguration
serialization.
3. Change the XML structure of backup data to remove nesting of objects.
Nesting of objects makes it difficult to deserialize especially when we
start adding elements in future revisions. So, move |IpConfiguration|
object outside the |WifiConfiguration| object.

BUG: 29071904
Change-Id: Id08040bf11e4914638ec9f8d9d27d7983e27e42a
TEST: Unit-tests
TEST: Manual verification of backup/restore using bmgr commands.
mlUtil.java
2b7e486db94455a4a4c0124b5ba5e57c837ef10e 31-May-2016 Roshan Pius <rpius@google.com> XmlUtil: Create a utility for XML formatting

This is a thin wrapper over the existing XmlUtils provided by Android
core. This will be used for persisting Wifi config store as well as for
Wifi backup/restore.

BUG: 29039447
Change-Id: Iac1f960c0f6f16379ab125882c2aced8857b005c
mlUtil.java
5e550bdccf8aaace892366fbbaf90bd0a7c456af 14-May-2016 mukesh agrawal <quiche@google.com> packet fate: include status code for auth+associate

During 802.11 authentication, we've seen wpa_supplicant
report error information that is at odds with
over-the-air traffic.

For systems that provide packet fate for these early
frames, we can gather better information about the
auth process from the frames themselves.

Specifically: we can include the status code in the
packet fate summary. Make it so.

While there:
- fix a whitespace issue in parseIeee80211FrameCtrlType()
- rename frameControlField, since it didn't really hold
all of the frame control info. (frameControlField
omitted the frame control flags.)
- modify some packet fate tests to be less specific about
expected whitespace; it's too hard to maintain the tests
when exact whitespace matching is required

BUG=28717266
TEST=unit tests
TEST=manual

Manual test
- configure hostapd to allow zero connections
- configure bullhead to connect to hostapd
$ adb shell dumpsys > /tmp/dumpsys
- verify that packet fate summary shows auth frame with status 17

Change-Id: Ib8742091d0a9acc7fdde0423229d150bf4c1c6d8
rameParser.java
70b4f7f1b8f57c5ae449dedb48edc0d07b6b5c41 14-Apr-2016 Samuel Tan <samueltan@google.com> Add FrameParser

Add FrameParser, a utility class that parses the contents
of a network frame, and stores it in its public member fields.
This utility will be used to print out summarized versions of
the contents of packet fate report frames.

In this initial implementation of FrameParser, we only parse out
the information we are interested in printing (i.e. the most specific
networking protocol, and the type of packet within this protocol).

BUG: 28150622
Change-Id: Ice7dad5a7800736605043688955027893fadffc7
TEST: 'runtest frameworks-wifi -c \
com.android.server.wifi.util.FrameParserTest' passes.
rameParser.java
2b7a4daa21df85f6a8ca2c4992ba53634071cac6 14-Apr-2016 Mukesh Agrawal <quiche@google.com> Merge changes I8da6c1a4,I619b9c81,I22a753d7,If818bc37 into nyc-dev

* changes:
wifi service: nuke verbose logs on no-verbose
wifi service: add support for driver dump HAL API
WifiLogger: make firmware dump conditional on verbose
wifi service: add utility to check printability
e31290e1c2eebf70c5ab22091a9520c7a001161e 12-Apr-2016 mukesh agrawal <quiche@google.com> wifi service: add utility to check printability

When logging data, it's useful to know whether or not
the data is plain ASCII. (If so, we can print the
data raw. Otherwise, we need to base64 encode the data.)

To meet this need: add a utility method to check if a byte
buffer contains (only) printable ASCII.

BUG=27554392
TEST=unit tests

Change-Id: If818bc378c6f146e7517f6ae4bb36b4b5bb8db48
tringUtil.java
1a572a27cffc6ee853f9b6a40d83eef18963e2b0 08-Apr-2016 Randy Pan <zpan@google.com> Merge "Build ESS into the GScan result's Capabilities" into nyc-dev
ca0bac5826ab430d1b765b201a609f7bc38401ee 06-Apr-2016 mukesh agrawal <quiche@google.com> ByteArrayRingBuffer: add ability to resize buffer

When verbose mode is enabled, we'd like to use
larger ring buffers. To support this, add the
ability to resize a ByteArrayRingBuffer.

BUG=27578082
TEST=unit tests

Change-Id: I976a2ec05ade3f5c2c0fe5dc50cbb391534ab241
yteArrayRingBuffer.java
9b5773d2805e8c6141ca75de272921a84941546b 07-Apr-2016 Randy Pan <zpan@google.com> Build ESS into the GScan result's Capabilities

Obtain this piece of information from the beacon and build it
into the Capabilities string.

Bug: 27810218
Change-Id: Iffa57f6e1c0997e5705da779a3693de9e3108e37
nformationElementUtil.java
e367514651d7f888dda870fb472eea6bcfd9ec5d 14-Mar-2016 Paul Stewart <pstew@google.com> Don't crash if no supported rates are given

The com.android.server.wifi.hotspot2.NetworkDetail class
crashed with an ArrayIndexOutOfBoundsException if a an empty
supported rates IE was encountered. This CL fixes this by
checking the array size in the validity check of the IE.

Bug: 27619848
Change-Id: I9569d063d7c64d3cc3f80ced9cf9d1425f97abbd
nformationElementUtil.java
9947ed6dfddffe1746d98bf01499a81d7c3de123 08-Mar-2016 Glen Kuhne <kuh@google.com> Merge "Add Supported Rates and 802.11 Mode detection" into mm-wireless-dev
f5cc6a0c7ede374b33de1cf5156bf149e2e76c13 01-Mar-2016 Glen Kuhne <kuh@google.com> Add Supported Rates and 802.11 Mode detection

Added an Information Element parser for Supported and Extended Supported
Rates.
Uses this information and other IEs to determine the 802.11 Mode
(a/b/g/n/ac) being used by APs, stores it in their scan results.
Modified WifiMetrics to receive and store this metric from a ScanDetail
Added calls to WifiMetrics from WifiStateMachine to give it a ScanDetail
Minor fix to WifiStateMachine's tracking of TargetNetworkId, which it
was clearing incorrectly on NETWORK_DISCONNECTION_EVENT

BUG=25691077
BUG=27446779
Change-Id: I63af5911916bfec87628aeb4e1ed4f9138acfafa
nformationElementUtil.java
cc84bc6179db408b1e45168d43e10ba0ab089fca 01-Mar-2016 mukesh agrawal <quiche@google.com> add ByteArrayRingBuffer

We want to manage the debug ring buffers by total spaced used,
rather than by the number of entries in the ring. Add a new
class, ByteArrayRingBuffer, to provide the needed functionality.

BUG=27264379
TEST=(new) unit tests

Change-Id: I6e1ce82e028fc621f3fc9c96a5cb0cbd71c2d4e3
yteArrayRingBuffer.java
55b5d3d0e887313ece26bad8ebf8f8c25ac66e3f 19-Feb-2016 Glen Kuhne <kuh@google.com> Merge "InformationElementUtil TIM element parser" into mm-wireless-dev
947e55415eab3989f2f5cede0c03745cf9268309 09-Feb-2016 Glen Kuhne <kuh@google.com> InformationElementUtil TIM element parser

Added a parser to InformationElementUtil for the beacon frame Traffic
Indication Map element. Only current use for this is to get DTIM
interval for metrics.

BUG=25691077
Change-Id: I1aba8ca658e446ae5697b6d749687b0dd24f790d
nformationElementUtil.java
e5b93fbfe451bc57c07b3f72191b52b6bd237d5b 09-Feb-2016 Peter Qiu <zqiu@google.com> Add SoftApManager class

The newly created class is responsible for managing soft AP
instance and tethering state transitions.

This class will be integrated to WifiStateMachine in an upcoming
CL, which will remove the existing soft AP and tethering related
code from WifiStateMachine.

Bug: 26876260
TEST=runtest frameworks-wifi

Change-Id: I25568649b8c9d18ce78019dac614bafb9c5a3448
pConfigUtil.java
3571366ac36c70746b9f013ec2b54482861c9292 03-Feb-2016 Randy Pan <zpan@google.com> Build 'capabilities' string for gscan results

Populate the WiFi beacon capability information from gscan to
WifiNative. Build ScanResult 'capabilities' string based on this
value and the information elements.

Add unit tests.

Bug: 26908033
Bug: 26908558
Change-Id: I661bb501a09d3e79ee0b0a8e141e7e47c72687f7
nformationElementUtil.java
e4e3b8cb884dd9e754a437ea6feac502191f1767 07-Feb-2016 Mitchell Wills <mwills@google.com> Add ScanDetailUtil to convert ScanResult to ScanDetail

Also move InformationElementUtilTest to util package

Change-Id: I4a2c6a561ce6106d7c8c671cec225cf5ae6532f0
canDetailUtil.java
da51c12f413d54517aea317e37ba82e45d1e4a30 16-Dec-2015 Rebecca Silberstein <silberst@google.com> Tests for InformationElementUtil

Add tests for parsing InformationElements. Covers multiple types of invalid
input.

In addition, added check to parseInformationElements to check for null
input. If the input byte array is null, returns an empty
InformationElement array.

Bug: 26228026
Change-Id: I49e0f6ca938e07c7d961853279645f8511dbd0c3
nformationElementUtil.java
9f743918a412fec9ad5a0386fbf6cf0361313f58 05-Nov-2015 xinhe <xinhe@google.com> Center frequency is incorrectly parsed for 40MHz

b/25499446

Change-Id: Ice9884f860e4b68ec62d87ed24adeab8864beb3f
nformationElementUtil.java
5d31cedf4024e0f038b4dfc2081016c8631ee8fe 28-Jul-2015 Mitchell Wills <mwills@google.com> Moved Wifi InformationElement parsing to a common utility class

Change-Id: If3e58aa01ad2a75c0f4942428392c0e7f833143c
nformationElementUtil.java