Commit Graph

253 Commits

Author SHA1 Message Date
Ecco Park
bffd531aa3 Fix the system crash issue when secondary user clicks any 802.1x AP on
Wifi Picker.

Catch the exception when keystore failed to list the certs

Bug: 73794111
Test: test it with clicking the Google-A on Wifi Picker.
Test: make ROBOTEST_FILTER="(WifiConfigControllerTest)"
RunSettingsRoboTests -j32
RunSettingsRoboTests: OK (12 tests)

Change-Id: I0db66730261c72ef35d1b299bacd2aed7710d247
2018-03-13 16:49:08 -07:00
Fan Zhang
119ea0f0d1 Merge "Wifi: Restore hidden flag for hidden networks on update network" am: 0138575b8d am: e1c58570d6
am: 935ce87d32

Change-Id: I4ad47e788c1ab591dc82a031ef22dadc65bf8582
2018-02-21 18:04:26 +00:00
Fan Zhang
935ce87d32 Merge "Wifi: Restore hidden flag for hidden networks on update network" am: 0138575b8d
am: e1c58570d6

Change-Id: Ice03d80eedf64fb08a12471b22bfdff53b4f934b
2018-02-21 17:55:50 +00:00
Anurag Das
f44da638bd Wifi: Restore hidden flag for hidden networks on update network
Currently when user modifies any of the network parameter for hidden
networks, hidden flag is not updated. As a result this network is no
longer part of hidden networks, we are unable to reconnect when user
triggers wifi off and on.

This commit sets the value of hiddenSSID flag of config at the Settings
side on network update.

Test: manual test with hidden access point
Bug: 73256783

Change-Id: Ic20f03345645d8bf3bc9c3ff44910dd3f2797fec
2018-02-20 06:56:09 +00:00
jackqdyulei
261c29c485 Add wifi metered controls in wifi settings.
1. Add it in wifi detail page
2. Add it in wifi dialog
2. Remove it in "Mobile network" page

Bug: 68030417
Test: RunSettingsRoboTests
Change-Id: I2e001c55f3c6c75a660e429732dfbece97b0ca9e
2018-01-09 12:44:51 -08:00
Ningyuan Wang
6c12f06bf8 Enforce null check for mAccessPoint
mAccessPoint == null implies this is a new network.
In this case, we don't need to check if it's a carrier AP.

Bug: 68846574
Test: compile, manually test that crash does not happen again.
Test: make RunSettingsRoboTests -j40 aROBOTEST_FILTER=WifiConfigControllerTest

Change-Id: I03b1da5e8f0b8e4270c0c52c67bbc90c999be078
(cherry picked from commit 0117b995f4)
2017-11-08 18:24:48 +00:00
TreeHugger Robot
c90b0196eb Merge "Enforce null check for mAccessPoint" 2017-11-06 17:42:39 +00:00
Ningyuan Wang
0117b995f4 Enforce null check for mAccessPoint
mAccessPoint == null implies this is a new network.
In this case, we don't need to check if it's a carrier AP.

Bug: 68846574
Test: compile, manually test that crash does not happen again.
Test: make RunSettingsRoboTests -j40 aROBOTEST_FILTER=WifiConfigControllerTest

Change-Id: I03b1da5e8f0b8e4270c0c52c67bbc90c999be078
2017-11-03 17:31:03 -07:00
Fan Zhang
a7f135596d Switch to use ThreadUtils.postOnMainThread
Change-Id: I344d25a1a667de9c0b23d6d528d905b4da3a4c40
Fixes: 63896139
Test: rerun tests
2017-10-31 13:27:41 -07:00
Tony Mantler
d9af0b839d Move SimStatus and ImeiInfo Pref Controllers to SettingsLib
Bug: 67410808
Test: RunSettingsRoboTests
Change-Id: Ib55d2365814b5882f7fcae6bb7f1b62cc3d6ad4e
2017-10-23 15:42:43 -07:00
Glen Kuhne
c98eee331a Merge "Allow 64 char HEX string PSKs in WifiSettingsUi" into oc-mr1-dev am: 85f59ff42d
am: 91aeed6f55

Change-Id: I65d9d59816f9a1b248bfa9bcf7e801260f60bc01
2017-10-12 19:14:50 +00:00
Glen Kuhne
ddf705903e Allow 64 char HEX string PSKs in WifiSettingsUi
A check for valid PSKs in the settings UI didnt capture the 64 character
HEX string case. Added a check for it.

Test: tests/app/src/com/android/settings/wifi/WifiSettingsUiTest.java
Test: manual verification
Bug: 67492639
Change-Id: Ide738c4a67f23b613883b4a69f8264a0ffb8a0bc
2017-10-10 13:12:21 -07:00
Eric Schwarzenbach
5a7e46dd80 Add modify button to WifiNetworkDetailsFragment.
Adds pencil icon to Wifi Detail action bar to modify the network.
Modifies package/public visibility to allow the detail package to
use the WifiDialog. Listens for changes in WifiConfigurations to
propagate changes to the UI in WifiNetworkDetailsFragment.

Changes WifiNetworkDetail preference launch to conform to pattern
of other Settings apps. Removes unused WifiDetailActionBarObserver.

Bug: 36483704, 37082355
Test: make -j40 RunSettingsRoboTests
Change-Id: Ie9dc1892eaefdfad4a6bd7040bfc5dbf6236cfb4
2017-09-08 13:39:22 -07:00
Peter Qiu
486fc9dca9 wifi: WifiConfigController: fix possible NPE in showSecurityFields
Bug: 64438040
Test: make RunSettingsRoboTests -j40 ROBOTEST_FILTER=WifiConfigControllerTest

Change-Id: I2ddc5c07a3c95cba91cef532dc2c84529146d100
2017-08-07 10:10:15 -07:00
pkanwar
0ce5e17792 Add support for carrier wifi in UI.
Make changes to the UI, so that it does not ask for additional
information while connecting to Carrier Wifi. Also, indicate in wifi
picker if the wifi is a carrier network.

Bug:30988281
Test: make RunSettingsRoboTests -j40 ROBOTEST_FILTER=WifiConfigControllerTest
Test: manual
Change-Id: Iecbcd77d400264aaaa16a6a95a2093d58f2748f9
2017-08-02 15:29:39 -07:00
Fan Zhang
78d5efdfea Refactor hotspot into a full page
- Deprecated WifiAPEnabler, and copied most of its logic into various
  controllers and WifiTetherSettings.
- Added tests

Fix: 37253404
Fix: 36181835

Test: make RunSettingsRoboTests
Change-Id: Iad994d61b694ad7f1113d045a3e7500eeaec178b
2017-06-14 12:32:44 -07:00
Fan Zhang
cc07043497 Ensure wifi ssid cannot exceed 32 bytes.
Change-Id: I5c2c50ca8599f6843da47c01b9a0447e2c85d763
Fix: 36898746
Test: make RunSettingsRoboTests
2017-06-05 16:21:09 -07:00
Shinji Sogo
8b23c35954 Show security info in saved network list
When an access point linked to a saved network is not found,
security info should be shown in dialog of saved network.
Notes that in Android N this list is created with saved networks
and scan result, and that causes security info is not shown for
access points seen around user, but in Android O only saved
networks are used to create a list. That means security info is
shown for all access points listed in the screen.

Bug: 38102896
Test: make RunSettingsRoboTests

Change-Id: Ia0c5184ae7a1325f2628f4c08e29350c5793a08f
(cherry-pick of a8382c11f58ecbfbc5b8d908b97c53d59cf774fe)
2017-05-12 10:35:08 -07:00
Glen Kuhne
3c5bd235f3 Fix null pointer exception in wifi settings
Fixes a null pointer exception that can occur during setup wizard.

Bug: 37873425
Test: make RunSettingsRoboTests -j40 ROBOTEST_FILTER=WifiConfigControllerTest
Change-Id: I40de883fae6ccde13ad264f9b8b2d9da9745eb24
2017-05-03 15:53:16 -07:00
Glen Kuhne
92119d7f55 Disable submit button when PSK pass is invalid
Modified the logic of when to enable the 'connect'/'save'(submit)
button.
PSK is now also recognized as invalid when over 63 characters in length.
Removed the 'isSavedAp' check that only applied the invalid password
check to new networks. Users must now modify networks with a valid psk.

While I was here: Fixed WifiSettingsUiTest from failing due to invalid
WIFI_PREFERENCES string

Bug: 37152520
Bug: 36709852
Test: runtest WifiSettingsUiTest & m RunSettingsRoboTests pass
Change-Id: I273560cbf9124d16034962a2084f36c93973ee83
2017-04-26 13:04:56 -07:00
Paul Stewart
9b26496d03 Allow user to specify EAP-SIM under PEAP
Allow the user to select EAP-SIM methods as a second phase after
an outer PEAP authentication.  This hides the "identity" and
"password" fields if one of these methods is selected.

Bug: 34835771
Test: Manual: Connect to PEAP/EAP-SIM AP
Change-Id: I7e448fbebd352a4b0facbfafa74afaff6b704386
2017-04-07 10:28:49 -07:00
Peter Qiu
ae727fbb73 wifi: managed Passpoint configurations in "Saved Networks" page
Instead of going through WifiTracker to retrieve saved network
configurations (including both WiFi networks and Passpoint provider
configurations), use the WifiManager's APIs to retrieve the
configurations directly, to avoid any unnecessary complexities.

Also update to use the appropriate APIs for configuration removal
based on the configuration type.

Bug: 34207710
Test: manual test by removing a Passpoint configuration from
      "Saved Networks" page.

Change-Id: I549cc484d8825b6c38895428c1b7941390bb5f1f
2017-03-29 13:57:32 -07:00
Salvador Martinez
2b55d2f527 Fixed talkback feedback for wifi menu am: 7c59e7ab53
am: ce18d5ea14

Change-Id: I6f1fc0922cfab21da53219e560a46d94156e3533
2016-09-27 21:59:34 +00:00
Salvador Martinez
7c59e7ab53 Fixed talkback feedback for wifi menu
When you go to add a existing or new access
point for wifi talkback would say the
incorrect thing when you tapped on the
advanced options dropdown menu toggle.
This fixes what talkback says to more
accurately reflect what the widget does.

Test: Accessibility Scanner
Bug: 31623421
Change-Id: I9a00c4e8723014b0b3097f046dbcd1de01636e76
2016-09-27 14:51:10 -07:00
Paul Stewart
aa5afb18fe Merge "Display connect button in the wifi connection menu" am: 9126cfba19
am: ace9f52725

* commit 'ace9f527253a5464308f8dd3aa97f841d5d2d996':
  Display connect button in the wifi connection menu

Change-Id: Ia72d92c7e50cfb316772609e561b34d0b8c62333
2016-05-27 15:06:06 +00:00
Pierre Imai
47f67c1ff7 Prevent multicast addresses in static Wifi config.
Change-Id: I1961b10d67d322fb863620813fe9039b63bb7895
2016-03-29 16:04:47 +09:00
Damien Vagner
41a57e23a3 Display connect button in the wifi connection menu
When you quickly try to reconnect after forgeting the AP, the connection
is in DISCONNECTED state and we may still display the connect button

Change-Id: I755a259fdf68fab470d7f69aa461f5bcedddfd5b
Signed-off-by: Damien Vagner <damienx.vagner@intel.com>
Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
2016-03-01 16:11:39 +08:00
Samuel Tan
18d9865388 WifiConfigController: set ca_path and ca_cert to null if unused
am: d147f0090c

* commit 'd147f0090ce28e1ad70f7a9b582dec91161139e8':
  WifiConfigController: set ca_path and ca_cert to null if unused
2016-02-20 00:12:03 +00:00
Samuel Tan
d147f0090c WifiConfigController: set ca_path and ca_cert to null if unused
The WPA supplicant ca_cert and ca_path directives should not
both be non-null, since our EAP settings logic only allows one
or the other to be used.

Modify logic in getConfig() to explicitly set ca_path or ca_cert
to null if it is not used. This explicit null value is necessary
to override a previously non-null value saved in an existing
configuration.

Also, always set the domain_suffix_match directive, which
will lead to this directive to be reset when the Domain
field is hidden.

BUG: 27194668
TEST: 1) Install custom ca certificate onto device as "testcert"
TEST: 2) Configure an EAP-TLS network with CA certificate
         "testcert", Domain "testdomain",
         User certificate "Do not provide", identity empty, and save.
TEST: 3) Read network variables in data/misc/wifi/wpa_supplicant.conf
         and ensure that ca_cert is "testcert", ca_path is not
         present, and domain_suffix_match is "testdomain".
TEST: 4) Modify that same EAP-TLS network configured in step 2 with
         CA certificate "Use system certificates", Domain "testdomain",
         User certificate "Do not provide", identity empty, and save.
TEST: 5) Read network variables in data/misc/wifi/wpa_supplicant.eonf
         and ensure that ca_cert is "keystore://CACERT_testcert",
         ca_path is not present, and domain_suffix_match is
         "testdomain".
TEST: 6) Modify that same EAP-TLS network configured in step 2 to be
         an EAP-PWD network. Leave Identity and Password blank, and
         save.
TEST: 7) Read network variables in data/misc/wifi/wpa_supplicant.eonf
         and ensure that ca_cert, ca_path, and domain_suffix_match are
         not present.

Change-Id: I547f3e359bc8e9b77e51e10e60356b857230636f
2016-02-19 09:01:21 -08:00
Samuel Tan
aedb058e1b Allow trusted system certificates to be used in EAP network configs
am: 2b16cd3920

* commit '2b16cd3920f95b2cd5c2426d81b5e1584ffc682d':
  Allow trusted system certificates to be used in EAP network configs
2016-02-09 18:24:20 +00:00
Samuel Tan
2b16cd3920 Allow trusted system certificates to be used in EAP network configs
Add an option to the "CA certificate" field of the EAP network
configuration menu, "Use system certificates". Choosing this option
will cause the trusted, pre-installed, system CA certificates
to be used to validate EAP servers during the authentication process.
This only applies to EAP-TLS, EAP-TTLS, and EAP-PEAP network
configurations, where the CA certificate option is available.

If the user selects "Use system certificates" and leaves the
"Domain" field empty, display a warning and prevent the
EAP network configuration from being saved. Such a configuration
would be insecure--the user should constrain the domain that
the system certificates can be used to validate.

BUG: 26879191
TEST: 1)  Set up AP connected to test RADIUS server.
TEST: 2)  Generate a self-signed cert (Cert 1)
TEST: 3)  Use Cert 1 to sign another cert (Cert 2) with common name
          "sub1.sub2.domain.com"
TEST: 4)  Setup RADIUS server, and configure it to present Cert 2 to EAP peer.
TEST: 5)  Build angler image with Cert 1 installed in
          /system/etc/security/cacerts/
TEST: 6)  Set up an AP connected to the RADIUS server to broadcast
          a WPA-Enterprise network.
TEST: 7)  On Angler, connect to this WPA-Enterprise network with settings:
            Network name: (AP SSID)
            Security: 802.1x EAP
            EAP method: TLS
            CA certificate: Use system certificates
            Domain: domain.com
            User certificate: (test certificate from RADIUS setup)
            Identity: (identity used for RADIUS setup)
TEST: 8)  Verify that we connect successfully to the AP.
TEST: 9)  Verify that connection still succeeds if Domain is set to
          "sub2.domain.com" and "sub1.sub2.domain.com".
TEST: 10) Verify that connection fails if Domain is set to
          "sub0.sub1.domain.com" and "otherdomain.com".
TEST: 11) Verify that network configuration cannot be saved, and an
          warning message "Must specify a domain" is displayed if Domain
          is left blank in the configuration in step 7
TEST: 12) Verify that the "Do not validate" option still appears in the
          CA certificate dropdown menu.

Change-Id: I346d4d301305719033b84ec4599bf3d57d9d4ee5
2016-02-08 08:54:42 -08:00
Samuel Tan
5e5038255c Correctly load saved EAP CA cert and user cert options
am: 3d8cdb10f6

* commit '3d8cdb10f6103a794e4cb68adb5de03a325d1c8f':
  Correctly load saved EAP CA cert and user cert options
2016-02-05 20:58:15 +00:00
Samuel Tan
3d8cdb10f6 Correctly load saved EAP CA cert and user cert options
Previously, we did not properly load the "Do not validate"
and "Do not provide" options for the CA certificate and
User certificate EAP network configuration fields respectively
when the user previously selected these options and saved the
configuration.

Fix this by properly checking the saved CA certificate and user
certificate aliases in the saved enterprise config.

BUG: 26686071
Change-Id: If180c611f7210718cfb11c0578545b6f027827b5
TEST: Saved EAP network with the abovementioned options.
TEST: Long-pressed saved network on Wifi menu and selected "Modify Network"
TEST: "Do not validate" and "Do not provide" options are re-loaded.
2016-02-03 13:29:54 -08:00
Samuel Tan
3848ddc1a0 Allow domain suffix match to be set in UI for EAP configurations
am: d54bbd5193

* commit 'd54bbd519303b8eb0a7822cea00c55ef5e4f6652':
  Allow domain suffix match to be set in UI for EAP configurations
2016-02-02 18:59:52 +00:00
Samuel Tan
d54bbd5193 Allow domain suffix match to be set in UI for EAP configurations
Add a "domain" field that allows the user to specify a domain
suffix match for an EAP network configuration. This field
will only be available when the user specifies a CA certificate for
an EAP-PEAP, EAP-TLS, or EAP-TTLS network. Under the hood, the
value entered into this field will be passed to WPA supplicant
as the |domain_suffix_match| configuration variable.

BUG: 25180141
Change-Id: Ib69b9519f475e90e40441ddff61c80be43cf624b
TEST: On angler, domain field appears for the EAP-PEAP, EAP-TLS
TEST: and EAP-TTLS networks.
2016-01-29 15:40:43 -08:00
Samuel Tan
57c329c9f9 Display warning if users does not provide CA cert in EAP config
Display an explicit warning in the WiFi configuration menu if
the user selects the option to not validate the EAP server (i.e.
does not provide a CA certificate) in an EAP configuration.

BUG: 26686071
Change-Id: I73620b60defdcf40865f8c67d5de24b5dad636f8
TEST: Warning appears when the abovementioned option is selected.
2016-01-27 14:10:40 -08:00
Samuel Tan
f827c929dd Add menu options for not specifying a EAP CA cert and User cert
Add the "Do not validate" and "Do not provide" menu
options for not providing a CA certificate and User certificate
respectively for EAP configurations.

Choosing these options are essentially equivalent to leaving
these fields alone as "(unspecified)" (when that option existed),
but now we require the user to make a conscious choice not to
provide these certificates.

BUG: 26686071
Change-Id: I4b9c07528d6d2ba3eb0787e7cfff69d05dd25679
TEST: Both the added options appear in the relevant menus.
TEST: Choosing both these added options in an EAP-TLS configuration
TEST: allows the configuration to be saved.
2016-01-27 14:10:34 -08:00
Samuel Tan
fffc5936b9 Disable configuring EAP-TLS without user certificate.
Disallow configuring EAP-TLS without a user certificate,
since this is probably an invalid configuration.

Also:
- change the wording of the default option for
  EAP CA and user certificates from "(unspecified)" to
  "Please select", to make it obvious that a choice
  needs to be made to proceed.
- Fix style issues found in WifiConfigController.java by checkstyle.py.

BUG: 26686071
Change-Id: I7ccfdf40db97328e3297a03cc43033ff2428980f
TEST: Save option is grayed out when configuring EAP-TLS network
TEST: while leaving "User Certificate" left at "Please select".
2016-01-27 14:10:25 -08:00
Samuel Tan
03a117bcfa Display warning if users does not provide CA cert in EAP config
Display an explicit warning in the WiFi configuration menu if
the user selects the option to not validate the EAP server (i.e.
does not provide a CA certificate) in an EAP configuration.

BUG: 26686071
Change-Id: I73620b60defdcf40865f8c67d5de24b5dad636f8
TEST: Warning appears when the abovementioned option is selected.
2016-01-26 17:45:32 -08:00
Samuel Tan
30f7b5a7cf Add menu options for not specifying a EAP CA cert and User cert
Add the "Do not validate" and "Do not provide" menu
options for not providing a CA certificate and User certificate
respectively for EAP configurations.

Choosing these options are essentially equivalent to leaving
these fields alone as "(unspecified)" (when that option existed),
but now we require the user to make a conscious choice not to
provide these certificates.

BUG: 26686071
Change-Id: I4b9c07528d6d2ba3eb0787e7cfff69d05dd25679
TEST: Both the added options appear in the relevant menus.
TEST: Choosing both these added options in an EAP-TLS configuration
TEST: allows the configuration to be saved.
2016-01-26 17:45:32 -08:00
Samuel Tan
933b6ed98f Disable configuring EAP-TLS without user certificate.
Disallow configuring EAP-TLS without a user certificate,
since this is probably an invalid configuration.

Also:
- change the wording of the default option for
  EAP CA and user certificates from "(unspecified)" to
  "Please select", to make it obvious that a choice
  needs to be made to proceed.
- Fix style issues found in WifiConfigController.java by checkstyle.py.

BUG: 26686071
Change-Id: I7ccfdf40db97328e3297a03cc43033ff2428980f
TEST: Save option is grayed out when configuring EAP-TLS network
TEST: while leaving "User Certificate" left at "Please select".
2016-01-26 17:23:11 -08:00
Sanket Padawe
30e812b731 [DO NOT MERGE] Disable configuring EAP-TLS/TTLS/PEAP without CA certificates.
Bug: 15162357
Change-Id: I9b1be9837b104670adc1cc7ed47a5095ff38d335
2016-01-26 16:51:39 -08:00
Rubin Xu
b557817abc resolve merge conflicts of 55d7fcbfc2 to master.
Change-Id: Ib0876ea153e8a8f7c8ad5438915d39c9ae97e51b
2016-01-27 00:34:53 +00:00
Rubin Xu
e34ea11fca Support multiple CA certs when editing a saved Wifi network.
SSID with multiple CA certs can only be added programmtically. However it
can still be edited in the UI by long-pressing the item when currently
connected to the network. This change makes sure the UI shows up with
 meaningful indications that the SSID is configured with multiple CA certs.

Bug: 22547958
Change-Id: I5d42313efb141db521dd09ff3fbc520915b6fb79
2016-01-27 00:25:10 +00:00
Bartosz Fabianowski
1058c0cc3d Allow user to specify whether a new network is shared or private
* Add a check box to the WiFi configuration dialog that lets the user
  choose whether a newly created configuration is shared with other
  users (defaults to true)
* Disable the check box when modifying an existing network

BUG=25600871

Change-Id: Ifc6713602ee61b0407e55f45097c1b311fa19cb4
2016-01-25 18:47:39 +01:00
Jason Monk
39b467482d Depend on support lib preferences
Bug: 24576551
Change-Id: Ic6190bacd3f7582c9bbc8de972da4612bd92421e
2015-10-13 10:12:20 -04:00
Maurice Lam
771fac591f [WifiSettings] Add Wi-Fi dialog activity
Add a Wi-Fi dialog activity that can be started by setup wizard to
connect to a Wi-Fi access point.

Also refactored mEdit and mModify in WifiConfigController into an
int-enum mMode, with modes view, connect and modify. This is how the
new modes maps to the old flags:

MODE_VIEW     --  mEdit = false, mModify = *
MODE_CONNECT  --  mEdit = true, mModify = false
MODE_MODIFY   --  mEdit = true, mModify = true

Bug: 23426311
Change-Id: I8e2221fd3c42577068e07686dab245dd5888e0ae
2015-09-17 16:03:49 -07:00
Maurice Lam
2662df8433 [WifiSettings] Submit Wi-Fi dialog with enter key
Add a OnKeyListener for hardware keyboards and an
OnEditorActionListener for on-screen IMEs to submit the Wi-Fi dialog
with the currently entered information.

Before committing the action, check for whether the dialog is
submittable -- that is checking whether all necessary information has
been entered. If not the enter key behaves the same as it is before
the change.

Bug: 22211604
Change-Id: Idede4233a7385d3bcd8fd6614948270280536bf1
2015-09-14 12:07:06 -07:00
Sanket Padawe
a1423547cf Disable configuring EAP-TLS/TTLS/PEAP without CA certificates.
Bug: 15162357
Change-Id: I9b1be9837b104670adc1cc7ed47a5095ff38d335
2015-09-11 01:08:53 +00:00
Sanket Padawe
f1165c14c5 Avoid sending identity along with EAP sim, aka & aka'.
Bug: 22358498
Change-Id: I829b3f9fe688efc933483506e1b5944195e1975f
2015-08-11 18:42:36 -07:00