Commit Graph

54 Commits

Author SHA1 Message Date
Jacky Wang
2e265d4a7a [Catalyst] Introduce SettingsContract file
The new file contains all contract constants for external usages (e.g.
slice, external Get/Set API). Also reuse existing constants in
SettingsSlicesContract.

NO_IFTTT=Catalyst only

Bug: 388061003
Flag: EXEMPT refactor
Test: atest
Change-Id: I449b7b6cf82e1e102f2c96a21835191605f09943
2025-02-04 18:24:46 +08:00
tomhsu
90553d91f1 [Settings]Check the Satellite modem state instead of enabled state only.
Flag: EXEMPT bugfix
Fix: 354806125
Test: Manual test pass
Change-Id: Iaa8d1c9d3df36e40fafda0117234036d9451a4fa
2024-08-01 03:38:48 +00:00
Tom Hsu
c495d92a25 Merge "Show dialog on Wifi, and APM' entries in Settings" into main 2024-05-08 04:37:28 +00:00
tomhsu
29b2f16edf Show dialog on Wifi, and APM' entries in Settings
- When satellite mode is switched on Wifi, and APM entry shall show the warning dialog and avoid user uses these functions.

Bug: 337154438
Test: Manual test.
Test: atest pass
Change-Id: I45cd92a8688e7a619613361ea4a8d58a0984d99f
2024-05-08 03:53:32 +00:00
Mill Chen
4c061771b7 Deprecated Wifi panel and relevant objects
Bug: 328529085
Test: robotest
Change-Id: I960718acbdf1d2be6c3b6b396cf2ac69d4aa3046
2024-05-06 22:22:52 +00:00
Weng Su
c826558805 Show Hotspot network icon (Wi-Fi Slice)
- Show Hotspot device type icons without signal strength (no Wi-Fi level)

Bug: 268550769
Test: manual test
make RunSettingsRoboTests ROBOTEST_FILTER=WifiSliceTest

Change-Id: I2a707cf20fc1a6d519ef5ca54db64e913daec969
2023-08-24 11:54:05 +08:00
Tsung-Mao Fang
e1f72b7f3c Wi-Fi panel doesn't need to check permission
Prior to this cl, we use #getPackagesForUid()
to get a list of calling package names and
pick up 1st package name in the list as target
calling package. And then go to check the
Wi-Fi permission.

This implementation is ok for most apps without
sharing system uid. However, this may not work
if the caller is set as sharing system ui.
In this case, we get a list of packages
and we don't know which one is caller. So, if we
decide to choose the 1st package of list as our
calling package, then it could fail to pass
permission check since that package could not
a calling package.

In this cl, we skip permission check for those
packages running with system uid. So, it can resolve
this Wi-Fi Panel problem since Wi-Fi panel running
on settings process and also promise the security
issue at the same time.

Test: 1. adb shell am start -a android.settings.panel.action.WIFI
2. Verify on assistant app and system ui launcher and search app.
Bug: 240531998

Change-Id: Ia825853dde2e966e3d390cecfbe1a99f6439d31e
2022-08-11 16:07:42 +08:00
Weng Su
5f421125ab Restrict WifiSlice functionality for guest user
- Hide Wi-Fi toggle and show Wi-Fi status only if the user is a guest.

Bug: 232798363
Test: manual test
make RunSettingsRoboTests ROBOTEST_FILTER=WifiSliceTest

Change-Id: I35418477808eb5082f4651f5689f018dbb8e42ac
2022-06-09 06:07:55 +08:00
Tsung-Mao Fang
cb641fa6eb Show slice without toggle when there's no wifi permission
When the presenter app doesn't have certain permissions,
it's safer to go with a generic fallback slice
which just redirects user to the actual settings page.

Test: test on the presenter app. robo test
Fix: 178014725
Change-Id: I6f5358af2e00cb2fedba0b3f1474a026135986c6
2022-05-05 12:05:38 +08:00
Weng Su
2d3d9b9305 Hide Wi-Fi toggle in the Wi-Fi slice
- Hide Wi-Fi toggle and show restriction message in the Wi-Fi slice if Wi-Fi state is disallowed to change

- See the result screenshot in b/203168097#comment30

Bug: 203168097
Test: manual test
make RunSettingsRoboTests ROBOTEST_FILTER=WifiSliceTest

Change-Id: I09ccb6349dadf64a2f903245ba203ce77c86d1e1
2022-05-04 10:26:50 +08:00
Tsung-Mao Fang
821608c5be Do not expose wifi slice when no permission
Prior to this cl, slice provider always exposes wifi slice
to calling package without confirming any wifi permissions.

For current solution, we will check calling package's permission state
and decide whether slice provider should expose wifi slice or not.

Because settings search is a part of settings app,
this permission checker won't be applied to settings intelligence.

Test: manual, robotest, cts
Also run manul
Bug: 178014725

Change-Id: I2770b5b43366a5aa65c7519efc4243d350a21b26
2022-04-19 08:07:35 +00:00
changbetty
39ebb7c9a8 Remove feature flag for provider model in wifi settings
Bug: 206338507
Test: manual test
Change-Id: I1ec83c94f801b489bcc716a6d78cbe7beab9638f
2021-11-17 15:57:14 +00:00
Jason Chiu
5b7230d355 Check the page searchability for both wifi and network provider page
Fix: 205976868
Test: manual, robotest build pass
Change-Id: Ic056852cb2524a6724dcf4a67b535fd927478338
2021-11-12 03:00:17 +00:00
Jason Chiu
2989c50a23 Add highlight menu keys for all toggle pref controllers and custom slices
Bug: 204695404
Test: manual, robotest build pass, unit
Change-Id: Iad2e28ada8ddb766ffa7eff2c8dc581250cbd6f8
2021-11-01 15:00:18 +08:00
Weng Su
29f4a35dea [RESTRICT AUTOMERGE] Add new ACTION_WIFI_DETAILS_SETTINGS to Settings
- Need to export the interface to Quick Settings to launch Wi-Fi Network
details settings.

- Rename WifiNetworkDetailsFragment.class

Bug: 191475923
Test: manual test with the topic CLs.
make RunSettingsRoboTests
atest -c SettingsUnitTests:com.android.settings.wifi \
         SettingsUnitTests:com.android.settings.network

Change-Id: Id2fd8c9b3b113ffbb49168305b05c67392fa4d87
(cherry picked from commit e8a4e13a80)
2021-08-26 04:24:39 +00:00
Weng Su
3d2950c8af Introduce new Disconnect functionality for Wifi networks in Internet
Panel only

- Display the close icon on the Wi-Fi network connected to the Internet,
and performs the same action as tapping on the carrier network when
tapped it.

- Display the cog icon on the Wi-Fi network if it has no the Internet
access.

- Screenshot:
  https://screenshot.googleplex.com/YBQ8onG2dFJ8Q2a

Bug: 187995278
Test: manual test
atest -c ProviderModelSliceTest

Change-Id: Id54a94c1fdfc37aff5cc37d6fb9f5478c0dccb00
2021-05-19 01:52:05 +08:00
Weng Su
a0d4c657c7 [Provider Model] Show "!" icon when Wi-Fi is not validated (panel)
- Screenshot:
  https://screenshot.googleplex.com/BLNcfXiJFnuoT9N

Bug: 185454486
Bug: 185637977
Bug: 186543071
Test: manual test
atest -c ProviderModelSliceTest
make RunSettingsRoboTests ROBOTEST_FILTER=WifiSliceTest

Change-Id: Idff6bb8b394db5553cf399d2020aa28d9dedfc74
2021-05-12 10:17:54 +00:00
Weng Su
439cc64b1c [Provider Model] Move the Internet unavailable Wi-Fi down
- Check the Wifi network have both INTERNET and VALIDATED capabilities
to achieve effective network access

- Move the Internet unavailable Wi-Fi down to the top of Wi-Fi list

- Don't paint color for the Internet unavailable Wi-Fi

- Screenshot:
  https://screenshot.googleplex.com/w82kbALssdTZmg4

Bug: 178457619
Bug: 178926547
Bug: 178978070
Test: manual test on device
atest -c InternetUpdaterTest \
         NetworkProviderWorkerTest \
         ProviderModelSliceTest

Change-Id: Idf04e556ab5a87abc5bc96d1934f5e8fd91fbfaa
2021-03-26 23:24:14 +08:00
Weng Su
e9f4928ef1 [Provider Model] Internet Panel UI update
- Add gear icon to connected non-carrier network

- Update "View airplane mode networks" wording

- Update "Turn off airplane mode" wording

- Check WiFi disable to show airplane mode message

- Screenshot
  https://screenshot.googleplex.com/BRjcKyMaMS4ujYN

Bug: 173413889
Test:
- Manual Test
- adb shell am start -a
android.settings.panel.action.INTERNET_CONNECTIVITY

Change-Id: Icf7b77e514cffa68cf103dbc9e7df93d58f9f762
2021-01-06 02:11:46 +00:00
SongFerngWang
a97b4faa67 The helper for slice of carrier and non-Carrier, used by ProviderModelSlice.
create a helper file.
create a res/drawable/ic_signal_strength_zero_bar_no_internet.xml
create string at res/values/strings.xml

Bug: 173971144
Test: atest ProviderModelSliceHelperTest
Change-Id: I7f63a6b04784325989e776cb140017314ebde4ce
2020-12-22 21:50:40 +08:00
Yi-Ling Chuang
49cda22b76 Add mutability flag to WifiSlice.
Starting Android S, PendeingIntent should have a explicit mutability
flag to avoid vulnerability.

Fixes: 172204181
Test: 1. adb shell am start -a
android.settings.panel.action.INTERNET_CONNECTIVITY and play on the wifi
panel.
2. Enable contextualWifiSlice and play on it.
3. Adjust volume on the volume panel.

Change-Id: I23f03cae8c481d9f5836b7fb967f734e9c99cd65
2020-12-09 21:35:15 +08:00
Weng Su
bd482c986c Add a mutability flag to the PendingIntent
- Request from Android Platform Security team.
  go/immutable-pendingintents

Bug: 170162129
Test:
1. adb shell am start -a
android.settings.panel.action.INTERNET_CONNECTIVITY
2. make RunSettingsRoboTests ROBOTEST_FILTER=WifiSliceTest
Change-Id: If3032959649206f2fb6736244d7aa8b9a8419378
2020-11-12 08:44:14 +00:00
Arc Wang
0496d2c142 [Wi-Fi] Apply WifiTrackerLib objects in Wi-Fi Slice
This change uses WifiTrackerLib's WifiPickerTracker & WifiEntry
to replace SettingLib's WifiTracker & AccessPoint.

This change includes

1. WifiScanWorker has the callbacks similar to a lifecycle component
   but it's not a lifecycle component. Let WifiScanWorker implements
   LifecycleOwner and provides #getLifecycle() for WifiPickerTracker.

2. Remove captive portal related code because WifiEntry#connect will
   handle captive portal login if it's necessary.

3. Create WifiSliceItem to wrap WifiEntry because WifiEntry is an
   abstract object and it does not provide copy constructor.
   Without copy construcor, Wi-Fi Slice may show unexpected information
   when a WifiEntry is updated.

Bug: 155613549
Bug: 152571756
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.wifi.slice
      make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.wifi
Change-Id: I2d66ea4905daca3244ec4cf8f2935cda817480b1
2020-07-22 07:53:18 +00:00
Greg Kaiser
9e9255fb2a Revert "[Wi-Fi] Apply WifiTrackerLib objects in Wi-Fi Slice"
This reverts commit 7b1aded2a6.

Reason for revert: Settings is crashing for WiFi selection in SetupWizard on wembley

Bug: 161434533
Change-Id: I1d90e9bae1b31862fba674db0d7497e43f987a7f
Test: Locally reverted, reflashed, and was able to select WiFi without Settings crashing.
Exempt-From-Owner-Approval: Revert to clear up P0 while all owners are outside of work hours
2020-07-16 14:47:31 +00:00
Arc Wang
7b1aded2a6 [Wi-Fi] Apply WifiTrackerLib objects in Wi-Fi Slice
This change uses WifiTrackerLib's WifiPickerTracker & WifiEntry
to replace SettingLib's WifiTracker & AccessPoint.

This change includes

1. WifiScanWorker has the callbacks similar to a lifecycle component
   but it's not a lifecycle component. Let WifiScanWorker implements
   LifecycleOwner and provides #getLifecycle() for WifiPickerTracker.

2. Remove captive portal related code because WifiEntry#connect will
   handle captive portal login if it's necessary.

3. Create WifiSliceItem to wrap WifiEntry because WifiEntry is an
   abstract object and it does not provide copy constructor.
   Without copy construcor, Wi-Fi Slice may show unexpected information
   when a WifiEntry is updated.

4. Use WifiTrackerLib's NetworkDetailsTracker & WifiEntry in
   WifiDialogActivity because it gets a WifiEntry key from Wi-Fi Slice.
   NetworkDetailsTracker can get the WifiEntry of th key.

Bug: 155613549
Bug: 152571756
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.wifi.slice
      make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.wifi
Change-Id: I0718f4647cea007a9b701922f3121a388dd43918
2020-07-16 15:56:42 +08:00
Jason Chiu
8ac1e4d49d Update icon tint color when the user toggles Dark theme
- Reload theme in slice provider when Dark theme mode changes for slices
- Reload theme in onCreate of Panel activity for its non-slice header
- Remove applyTheme from individual slices

Test: robotest
Fixes: 153700819
Change-Id: I40a7d2817c4b9100d7b2f2962a69c8a9ce6f7906
2020-05-12 10:58:54 +08:00
Jason Chiu
509c0119fb Add icons to contextual Wi-Fi card header
Fixes: 149666241
Test: robotest
Change-Id: I67076eb561bc496b272b28dc54bce8845d8d622f
2020-04-30 18:34:33 +08:00
Arc Wang
3fd7e31e3c [Wi-Fi] Fix crash when launch Wi-Fi detail from slice
Wi-Fi slice does not been applied to WifiTracker2, should not
launch the UI component for WifiTracker2.

Bug: 151065311
Test: manual
      Settings -> disable/enable Wi-Fi -> click the connected Wi-Fi
      See if Wi-Fi detail carshed.
Change-Id: I9cea305db85aab1bb694c21f95b81afd6a35321e
2020-03-10 11:06:59 +08:00
Jason Chiu
dd1fbd68d0 Wifi slice improvement
- always show toggle

Bug: 149666241
Test: robotest
Change-Id: I602d26abf2dfa631a939ee79e9adc63bed44ade0
2020-02-20 17:38:01 +08:00
Jason Chiu
fbf3d7574a Implement new design of Wi-Fi card
- always show Wi-Fi card
- collapse the card in the new UI session when connecting to a stable
  network
- hide toggle, show a level icon and subtext in the new collapsed mode
- show loading row when the AP list is not full

Test: robotest
Fixes: 147473096
Change-Id: I893064ef04d40d8e7cb8e62c1e72a2cb5e97f6ac
2020-01-21 17:26:29 +08:00
Arc Wang
75dc89b122 [Wi-Fi] Create WifiNetworkDetailsFragment related version 2 files for WifiTracker2 development
Create below version 2 files for WifiTracker2 development, we can
check the feature flag only a few times and easily remove version 1
files in the future.

    src/com/android/settings/wifi/details2/
    src/com/android/settings/wifi/savedaccesspoints2/
    tests/robotests/src/com/android/settings/wifi/details2/
    tests/robotests/src/com/android/settings/wifi/savedaccesspoints2/

Bug: 143326832
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.wifi.details2
      make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.wifi.savedaccesspoints2

Change-Id: I4d2caf1ce313871605252395764b02747240f217
2019-11-15 14:41:23 +08:00
TreeHugger Robot
8bc21da216 Merge "Remove On/Off subtext next to the Wi-Fi toggle" into qt-dev 2019-05-14 04:44:27 +00:00
Jason Chiu
2c3e6c6434 Fix automatically directing the user to the captive portal in Wi-Fi Slice
The feature failed after the CL "Force the adapter to rebind cards with
a toggle".

Because toggle slices have been forced to rebind after starting another
activity and when any slice is updating. This unpins Wi-Fi slice and
stops WifiScanWorker and then clears the saved clicked network.

Solution:
1. Change ConnectToWifiHandler from activity to receiver and send
   broadcasts to it with FLAG_RECEIVER_FOREGROUND, so Wi-Fi slice won't
   be forced to rebind.
2. Seperate Wi-Fi scan worker and contextual Wi-Fi scan worker. Keep the
   original logic for the generic one, and then add the logic below to
   the contextual one.
3. Do not clear the saved clicked network when slice is unppined because
   it happens frequently in contextual homepage.
4. Introduce a static long in ContextualWifiScanWorker that updates once
   in every visible UI session. A session is when the screen is visible
   to user.
5. Use session token to determine whether auto-starting captive portal
   is needed.

Fixes: 128056349
Test: robotest, visual in homepage and network panel
Change-Id: I9e03c379806e124fa7253b2a635574b2433f6afc
2019-05-11 03:26:57 +00:00
Jason Chiu
46294872c7 Remove On/Off subtext next to the Wi-Fi toggle
Fixes: 132312797
Test: robotest, visual
Change-Id: I2c3b39e8deda211d23be0b2a73426778dbbf53db
2019-05-09 15:19:02 +08:00
Jason Chiu
6a6787cdc0 Add subtext for Wi-Fi items on Wi-Fi slice
- Sync the Wi-Fi slice items subtexts with Wi-Fi page, and add
  "Not connected" when the returned subtext is empty
- Wi-Fi slice header subtext just simply reveals on/off state
- Add a placeholder to the loading row to sync its height with other
  rows
- Show contextual Wi-Fi slice when the connected network is captive
  portal, is invalidated, or has limited connectivity

Bug: 130751985
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.wifi
Change-Id: I0b2715295f00edc8dd7d6d75b7fdc18263675797
2019-05-03 16:18:42 +08:00
Jason Chiu
8f6c06974c Add prompt to sign in at captive portal to Wi-Fi Slice
- Support signing in captive portal APs in WifiSlice
- Show ContextualWifiSlice when signing in is required
- Generifies SliceBackgroundWorker.getInstance() to return <T extends SliceBackgroundWorker>

Fixes: 128056349
Test: make RunSettingsRoboTests -j
Change-Id: Ib4d3942591a65e81018389e4c0bbddfea6854dbc
(cherry picked from commit dd9f92280b)
2019-04-04 16:51:02 +00:00
Jason Chiu
53d147dd5c Refactor WifiScanWorker
Extracted WifiScanWorker from WifiSlice

Bug: 128056349
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.wifi
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.slices
Change-Id: I9b3c809ee6c2b7466c959631840b257b91b49d88
2019-04-01 16:40:59 +08:00
Mill Chen
a77a05d5ae Add keywords for wifi slice
Wifi slice didn't have a bunch of keywords for search, so users have to
type full matched text to search for wifi setting. We added keywords for
wifi slice to fix it, in which keywords are defined in strings.xml.

Fixes: 109922806
Test: rebuild
Change-Id: Ibe3b65c186cf6f43ae744c1f478d8985e270374c
2019-03-21 17:21:33 -07:00
Jason Chiu
b056c3a2b6 Show connecting and connected messages on the header subtext of Wi-Fi slice
Fixes: 128631698
Test: robotest
Change-Id: I1ea2a65d09eca9b3dd06f56c4ae69ef7f68ffd86
2019-03-21 18:49:09 +08:00
Jason Chiu
d4ab14969f Merge "Fix the bug of "Connecting" is rarely appearing on Wi-Fi slice" 2019-03-18 10:13:56 +00:00
Jason Chiu
4e42f53896 Fix the bug of "Connecting" is rarely appearing on Wi-Fi slice
- AccessPoint treats connected and connecting as equal so slice doesn't
refresh in this case
- Add a new method to determine if two lists are the same in SliceBackgroundWorker
- WifiScanWorker overrides this method to check the access point states

Fixes: 123941320
Test: robotest
Change-Id: I78d610da4b6b1d40f5785ba6701fb71b987fe31c
2019-03-18 16:01:48 +08:00
Jason Chiu
ec5ace3e19 Remove settings gear icon from connected network in Wi-Fi slice
- remove the gear icon from the active access point
- do not show any icon for the active access point

Fixes: 126458943
Test: robotest
Change-Id: Ibb57c6e1e1840e54266b49e0f092839a9c145187
2019-03-08 15:00:16 +08:00
Jason Chiu
6bbe6e2362 Leverage the behavior of showing the searching message in wifi slice
Fixes: 124823973
Test: robotest
Change-Id: Id89ec5ef09f05f83e019a6f4488cacf2ab4e635b
2019-02-27 12:20:11 +08:00
Jason Chiu
dcedd4e2e2 WiFi Slice Polish - Searching for WiFi state
1. Change the font color to be secondary
2. Align the left to the AP list title
3. Update the font for Wi-Fi list to be body font - Roboto regular 14dp

Fixes: 124468947
Test: robotest
Change-Id: I9f41925f7e3938bdf3f444b09eab33d6bf479f57
2019-02-25 17:35:16 +08:00
Yi-Ling Chuang
45ee7c2aac Dynamically return the uri of WifiSlice.
WifiSlice is used by both ContextualWifiSlice and WifiSlice itself.
In contextual homepage, we provide contextual_wifi slice for the
homepage. So in our slice pre-check, contextual_wifi slice will gets
pinned and bound. But when it comes to the state where wifi is on but
not connected, it actually returns wifi slice instead of contextual_wifi
slice, which will hit slice not pinned exception as wifi slice never
gets pinned.

Thus, we have to dynamically return the corresponding uri to  avoid this.

Fixes: 124627340
Test: robotests
Change-Id: I54ba255871628bb8eb814442f990a5d1149461e0
2019-02-21 16:14:29 +08:00
TreeHugger Robot
d611df7c48 Merge "Misc ui tweaks." 2019-02-13 02:15:54 +00:00
Fan Zhang
07207c0113 Misc ui tweaks.
- Update conditional card layout
  - move action button from right side to bottom.
  - Get rid of the forking between small/big screens.

- Update a few icons

Fixes: 121189136
Fixes: 124315564
Fixes: 124316920

Test: visual
Change-Id: I205d9995a2d7ed06ad9d32f3cea74f2840a28aed
2019-02-12 16:14:21 -08:00
Jason Chiu
1217bbec70 Remove sub-text from the lines of AP list in Wi-Fi Slice
- Remove sub-text from the lines of AP list
- Add colors to the AP names to indicate the connection status of each AP

Fixes: 120685004
Bug: 120786304
Test: make RunSettingsRoboTests -j
Change-Id: I7b879248528a293d14d959994bb054275f0d69a1
2019-02-12 16:10:06 +08:00
Matthew Fritze
1138218abe Create special case mobile data slice
Build the special case mobile data slice for general use,
and for the Internet Connectivity Panel. The Slice controls
the default data subscription, and links to the subscriptions
page.

Bug: 117804089
Fixse: 119411534
Test: robotests & test app.

Change-Id: I31b524a8fe3182a244d940848090e97250632f39
2019-02-08 13:13:28 -08:00
Jason Chiu
da2ca2f092 Connect to network while clicking open or saved networks on slice
Test: make RunSettingsRoboTests -j
Fixes: 121342770
Change-Id: I0ffb925628dd271d054f990b9b176eb10372e6a3
2019-01-30 16:15:41 +08:00