Commit Graph

119 Commits

Author SHA1 Message Date
Peter Zhang
f6a267bd36 Add logging when a group tile with PreferenceCategory widget is added to
the screen

Test: robotest, manual
Bug: 281517110
Change-Id: I4de1938bdeea003c70e5c554e988a97b762f7f81
2023-05-12 14:41:32 +02:00
Peter Zhang
baeca6fb53 Add the support of preference group / category to the Settings Tile API
Test: robotest, manual
Bug: 281517110
Change-Id: Ie36b0b3eb8ed80766efa050f1f0aee1f784a5949
2023-05-12 14:40:41 +02:00
Peter Zhang
3e498ad30d Render an additional icon to the tappable tiles with pending intents
Test: robotest, manual
Bug: 281517110
Change-Id: Ia5fbae63d56a6f1e6ee8fb3ee58ae912d14b6c75
2023-05-09 19:49:57 +02:00
Peter Zhang
ddb65e569b Expand SettingsLib ProviderTile to support non-switch type of Preferences
- Added new metadata allowing to set PendingIntent onto a Tile, which will be executed on click;
- Update the rendering logic to render with SwitchPreference only when Tile.hasSwitch() == true.

Test: robotest, manual
Bug: 281517110
Change-Id: I1253029be1e172792679f80be24bd58e368b9e73
2023-05-09 19:32:26 +02:00
jasonwshsu
d3b3ed5e6d Add ability to handle onActivityResult for AbstractPreferenceController in DashboardFragment
* AbstractPreferenceController now can implement OnActivityResultListener to receive callback from DashboardFragment#onActivityResult()

Bug: 270096758
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.dashboard.DashboardFragmentTest
Change-Id: Ib734287c6fe06fcdde3b2fe6ae9f4b778020b60b
2023-04-06 00:14:37 +08:00
Sunny Shao
042f3aebfb Remove additional and unused action
Fixes: 265276395
Test: compilation
Change-Id: Ib8e5e22ebb9f4742a60fcc28643dc5640b4db1e2
2023-01-13 13:43:42 +08:00
Jason Chiu
c89755525f Update all preferences when the account preference updates UI
When an account is added or removed, the account preference controller
just updates the account list, whereas there's no trigger point for the
account data sync preferences to refresh.

Add an API to update all preferences in DashboardFragment, so we can
refresh the account sync preferences whenever the account list is
updated.

Bug: 185479221
Test: robotest, manual
Change-Id: Ide3d972abae09ce0175e3bafbb1f4a5e307d20c8
2022-07-19 10:32:23 +00:00
Jason Chiu
c9615611e1 Reduce flickers of Injection
The injection dynamic data was loaded in the background and then post to
main thread to update UI. However, it usually updates after
Fragement.onResume(), which causes the flicker.

To make it more smooth, DashboardFragment to wait for the dynamic data
observers to update UI for a short period, which eliminates the flicker
in most cases.

Also skip the repeated tiles refresh called by onCategoriesChanged in
onResume after all preferences refreshed.

Test: robotest, visual
Bug: 229177114
Change-Id: I04650af9692703f1fc1e6e5ad2090f051b1eeb81
2022-05-09 12:33:54 +08:00
Jonathan Scott
b7f4f56cad Add missing settings strings.
Also re-enable and fix tests.

Test: manual
Fixes: 226183482
Fixes: 218799125
Fixes: 219375624

Change-Id: I9605f1f4e2e834baf63e015e96639567c5481b5f
2022-05-05 09:12:59 +00:00
Yi-Ling Chuang
61022c6419 Fix UiBlcoker regression
We determine if the visibility should be updated by mIsFirstLaunch, and
mIsFirstLaunch is set to false in onStop(). This breaks the updatability
if there's a change before onStop() gets called.

So we move the value assignment to the end of checkUiBlocker() because
at that time, all blocker work should be either finished or timeout.
Also remove mIsFirstLaunch since mUiBlockerFinished can cover the
determination with the new design.

Fixes: 229565193
Test: Toggle Use Location in the location page and see the Recent used
section react accordingly.

Change-Id: Id6005e5b8b29cb8a6309068d0a2177489a3fb2f4
2022-04-19 15:12:29 +08:00
Chaohui Wang
70470586a6 Fix XML preference controller with androidx LifecycleObserver
Controller can implements LifecycleObserver to observe the lifecycle.

Before this fix, preference controller which defined in the XML file
must implement com.android.settingslib.core.lifecycle.LifecycleObserver
(which is deprecated, and is a subclass of
androidx.lifecycle.LifecycleObserver).

After this fix, preference controller which defined in the XML file
and implemented androidx.lifecycle.LifecycleObserver will successful
observe the lifecycle.

Fix: 149338098
Test: robotest & manual
Change-Id: If9e48e44267de8e89a5e8f45d256719130936320
2022-03-29 14:43:06 +08:00
Yi-Ling Chuang
a28770e459 Add visibility control for the UiBlocker
The existing UiBlocker mechanism doesn't support additional visibility
control. With that, controllers that want to control their own
visibility won't be able to use UiBlocker.

Fixes: 223340393
Test: robotest
Change-Id: I2df2eb1ce77e2c94bb271a8b68cc8c6004df5c70
2022-03-22 11:53:33 +08:00
kholoud mohamed
de78149c16 RESTRICT AUTOMERGE Refactor device policy resource APIs to a separate class
Bug: 217388602
Bug: 218875965
Test: atest EnterpriseResourcesTests
Test: manual
Change-Id: I4775d7741c7819fd811c3fc4eda1636b1e04b398
2022-03-17 17:37:45 +00:00
Tsung-Mao Fang
6af43b1412 Remove no reference code
- Remove ControllerTask and ControllerFutureTask.
- Remove ControllerTaskTest and ControllerFutureTaskTest.

Fixes: 222661474
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.dashboard
Change-Id: I36f4e723c40aa59ecb3b087cab11f2a744540812
2022-03-04 20:28:28 +08:00
Christian Göllner
ff9065ac95 Add support for device state based auto-rotation preferences in Settings.
- Creates new preferences that are shown when device-state rotation
  is supported.
- Hides standard preferences when device-state rotation is supported.
- Controllers/Preferences for individual folded/unfolded rotation
  settings are created and added programatically based on the settable
  device states available.

Test: Manually + Unit tests
Bug: 195757480
Change-Id: I16f50fd3664756b363c7eb79e5c35eb0d3b6df17
2022-02-21 17:18:04 +01:00
Christian Göllner
a663f10c4e Revert "Add support for device state based auto-rotation prefere..."
Revert submission 16745827-device-state-auto-rotation-preferences-aops

Reason for revert: Checking if reason for test failures
Reverted Changes:
I77ed93f04:Add support for device state based auto-rotation p...
I5b2791f54:Add support for device state based auto-rotation p...
If254220ca:Add support for device state based auto-rotation p...
If254220ca:Add support for device state based auto-rotation p...

Fix: 219652963
Change-Id: Id95d5d7bb18a28403a6d3199945044e6617e0772
2022-02-16 13:31:16 +00:00
Christian Göllner
78a0e714c4 Add support for device state based auto-rotation preferences in Settings.
- Creates new preferences that are shown when device-state rotation
  is supported.
- Hides standard preferences when device-state rotation is supported.
- Controllers/Preferences for individual folded/unfolded rotation
  settings are created and added programatically based on the settable
  device states available.

Test: Manually + Unit tests
Bug: 195757480
Change-Id: If254220ca3018bc6ec1c4e3947375733f6816f92
2022-02-14 18:51:54 +01:00
Jonathan Scott
269f97d960 Allow overriding of strings referenced in XML files.
Test: manual
Bug: 188414370
Change-Id: Ice45b1808530c14c4efff16795cac7b2cb81516e
2022-02-07 21:00:05 +00:00
TreeHugger Robot
9eaf11e0c9 Merge "UI refinement of highlighted menu entry for large screen" into sc-v2-dev am: aee951dcb0 am: 517c9ead5e
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16304401

Change-Id: I21d8dab4ebc3292bf49a50e518531f3c07098a5b
2021-11-24 18:44:52 +00:00
Jason Chiu
90eef24080 UI refinement of highlighted menu entry for large screen
- Add a new highlight background drawable
- Add two homepage specific preferences for the new layout design

Fix: 207079684
Test: visual
Change-Id: I20c80da090a03129bffa845d443ee5d1ad13b97b
2021-11-22 12:36:05 +08:00
Jason Chiu
e65d3ab1cc Revert "Revert "Support highlightable Settings homepage menu for 2-pane"" am: 29a09e55ba am: 235353a131
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16038013

Change-Id: I4c526a0854fbe64efb834bf993c1e461b7993cad
2021-10-12 11:12:26 +00:00
Jason Chiu
29a09e55ba Revert "Revert "Support highlightable Settings homepage menu for 2-pane""
This reverts commit 096c090b80.

Reason for revert: crash is fixed in this change

Bug: 202510128
Test: manual, build
Change-Id: Ifff8d58cfdcf43e123b11dee308665b2617cb4b3
2021-10-12 09:32:07 +00:00
Greg Kaiser
d659a5271b Merge "Revert "Support highlightable Settings homepage menu for 2-pane"" into sc-v2-dev am: 1ab7ad3e40 am: 3f638ebad8
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16017469

Change-Id: I8a3deba2be06113f781f399221a8463f5454ceee
2021-10-08 15:12:13 +00:00
Greg Kaiser
096c090b80 Revert "Support highlightable Settings homepage menu for 2-pane"
This reverts commit 9037ceabd3.

Reason for revert: Presumed cause of b/202510128

Change-Id: I0daaab95d9bc57229c0c8c916cbe3ada7aafb6fa
2021-10-08 14:29:06 +00:00
Jason Chiu
630cbdc519 Merge "Support highlightable Settings homepage menu for 2-pane" into sc-v2-dev am: 9b1f593773 am: de33f1224b
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15785736

Change-Id: Ic375f9e19b1f6dbc6f70cedaa770c133fb96f652
2021-10-08 08:12:37 +00:00
Jason Chiu
9037ceabd3 Support highlightable Settings homepage menu for 2-pane
1. Add a preference group adapter to perform highlighting
2. Add a class for mapping highlighable menu keys and preference keys
3. Add an API to determine if the screen is in split mode

Bug: 199017944
Test: manual, build
Change-Id: I8e3fe5fb96480a31ee0f3b3afb6ad78999d3d2bc
2021-10-08 12:52:52 +08:00
Wilson Wu
9edf79741d Update settings PrimarySwitchPreference reference
To make InputMethodPreference support 2 target
reference, CL[1] move the PrimarySwitchPreference
into SettingsLib.

Change all PrimarySwitchPreference reference to
Settingslib one and remove the original one.

[1]: Idea3935d95b8d22b00ca89313e9eb3e979e4aa74

Bug: 197705032
Test: Presubmit
Change-Id: I95d111522344bb7cbdd380382e48fe60a5ebc9a2
2021-09-02 13:10:19 +08:00
Jason Chiu
c713c3e8ea Support category changed mechanism in homepage
- Homepage cannot referesh UI whenever an injected component is changed
- Extract categories related codes to a mixin

Test: manual, robotest
Fixes: 179792445
Change-Id: I1c13c541ce07b9c36fe984a035623985b5603560
2021-06-18 16:00:29 +08:00
Sunny Shao
9fa4bb8ffa Fix the toggle button flicker problem when display
- Root cause: the side effect of the parallel controller loading.
- Solution: disable the parallel approach and remove the entry point
  of parallel approach in DashboardFragment.

Fixes: 187838753
Test: Robo test for AppInfoDashboardFragment, ConfigureNotificationSettings,
      ConnectedDeviceDashboardFragment, DevelopmentSettingsDashboardFragment,
      NetworkDashboardFragment, DashboardFragment
Change-Id: If3b09c4fd6f33042e0ed38704f08e855ab8f5377
2021-06-16 11:41:10 +08:00
Jason Chiu
7d9dceadb7 Redesign homepage IA icon
- remove the outer circle of the icons
- tint the icons including injected ones

Test: robotest, visual
Bug: 182870640
Change-Id: If72c37152f4f0d68e25149b11d497eef1c7ece91
2021-05-12 08:37:37 +00:00
Tsung-Mao Fang
da9d5a1f92 Revert "Use androidx LifecycleObserver for wiring up controller ..."
Revert submission 13804074-controller-lifecycle

Reason for revert: ag/182373167, see a crash related to this new cl.
Reverted Changes:
I39ac69f24:Use androidx LifecycleObserver for wiring up contr...
I086620e31:Add javadoc about lifecycles for xml defined Contr...
Fix: 182373167

Change-Id: I7e6d2e9e6fd363a3afdd3dbab24e7c3b36e9ed29
2021-03-16 10:21:23 +00:00
Ahaan Ugale
042c5b40b7 Use androidx LifecycleObserver for wiring up controller lifecycles.
DashboardFragment automatically wires up Controllers that implement the
deprecated settingslib LifecycleObserver. Now it can also work for those
that implement the androidx version. The settingslib LifecycleObserver
extends the androidx one, so existing behaviour is preserved.

Bug: 169455298
Test: manual - lifecycles work automatically for such Controllers
Test: manual - no duplicate lifecycle events for existing Controllers
Change-Id: I39ac69f24bf8577867ba3b7e56f96c5f38722a2f
2021-03-09 17:11:08 +00:00
Tsung-Mao Fang
8b1b0dc0c3 Use new homepage preference for injected IAs
We use homepage preference when it's a injected IAs on homepage

Test: See the screenshot for Google icons
Fix: 177213699
Change-Id: Ibd08ff305cdd6b556b5ceee486df01678c9212a6
2021-01-15 03:46:58 +08:00
Jason Chiu
20df25e6b9 Reduce the flickering of injected items when package is changed
Root cause:
Settings listens to four package-related broadcasts in order to refresh
injected items because UI data may change. However, when the system is
updating apps on the first boot, it triggers a burst of broadcasts. For
each broadcast Settings will reload and then redraw all injected items,
which leads to the flickering.

Solution:
1. When Settings recieves a broadcast, check if there are already two
reloading tasks to avoid redundant updates.
2. In the reloading task, check if any injected item is changed, added,
or removed to notify categories changed.
3. Only refresh the UI when any of the changed items belongs to the
current page.

Bug: 166785977
Bug: 168309941
Test: manual, robotest
Change-Id: I77745b60f84510554bff1870a5bb7a8013eab528
2020-10-02 17:13:16 +08:00
govenliu
b70ddb9df7 [Wi-Fi] WiFi Settings inclusive language fix plan phase 1
Replace WiFi related terms which contain Master wording.
Goal: Create a fixit for Android Platform to reduce the use of non-inclusive language for all code.

Bug: 161425297
Test: make RunSettingsRoboTests -j or
make RunSettingsRoboTests ROBOTEST_FILTER=DashboardFragmentTest
make RunSettingsRoboTests ROBOTEST_FILTER=WirelessDebuggingPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=AutomaticStorageManagementSwitchPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=AllInOneTetherPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=TopLevelNetworkEntryPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=PrimarySwitchPreferenceTest
make RunSettingsRoboTests ROBOTEST_FILTER=WifiPrimarySwitchPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherPreferenceControllerTest

Change-Id: I9395c50e092e124016609f88f7c8151554a0d874
2020-07-21 20:56:22 +08:00
Bonian Chen
048d9fe19e [Settings] Code Refactor
Code refactor to provide the capability of method override

Bug: 141833767
Test: manual
Change-Id: I79647a7ff79f1f722bcfdf8190590df61bb3510a
2020-04-23 04:11:55 +00:00
Jason Chiu
b12e3b96c9 Support click metrics logs in several pages
- Assign metrics category to perferences at an earlier stage in
  DashboardFragment for better usability.

Bug: 137559984
Test: robotest
Change-Id: Icd4185efa0e655be20c4b673a1380fa42140923f
2020-04-07 16:44:53 +08:00
Jason Chiu
819abf7f87 Refine metrics log in infrastructure
- Add interfaces to set/get metrics category in BasePreferenceController
  for descendants having a chance to get it.
- Set metrics category in DashboardFragment
- Automatically log metrics in onPreferenceChange of
  TogglePreferenceController
- Add support for TwoStateButtonPreference in TogglePreferenceController
  to make the preference generic

Bug: 137559984
Test: robotest
Change-Id: Ia7e0d24a3db1991b18e0286d9894570fa71247a3
2020-04-07 14:08:39 +08:00
Bonian Chen
1b9bda3b05 [Settings] Avoid rendering hidden preferences
Under dashboards with expand button, preferences are renderred even
not been expanded.
Avoid from rendering un-expanded preference can improve the performance
of dashboard display.

Bug: 141833767
Test: manual
Change-Id: I00c6f827a0b7b7cec6a6fd8c809b94ca1dce88bb
2020-02-11 20:52:31 +08:00
Jason Chiu
1281e595e4 [Settings] Add preference click metric log
- Move the log point of onPreferenceTreeClick from DashboardFragment to
  it's super class InstrumentedPreferenceFragment for better coverage.
- Write the preference click metric log in PreferenceController handling
  case in DashboardFragment which will skip super class's log point.

Bug: 137559984
Test: robotest
Change-Id: I67178f613c74f755e20fc9dc41319974cb02e83c
2019-12-16 10:57:09 +08:00
Raff Tsai
f71db73025 Implement work-profile infra in BasePreferenceController
- Add settings:forWork in xml
- Set mIsForWork based on xml attribute
- Delete WorkProfilePreferenceController and move its function to
BasePreferenceController

Fixes: 123376083
Test: Add work profile, go to Settings->System->Language&input,
UI should show work profile related items
Change-Id: Id2dcbb0e158c117cdfd363466a275f4e133c345e
2019-12-10 09:32:37 +08:00
Sunny Shao
e5e82400ac Add page creation latency for updatePreferenceStates
- The updatePreferenceStates is called in the onResume. Here creates a new enum to
  record the elapsed time.

Bug: 137558156
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.dashboard
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.core
Change-Id: I02bdbeecd61fbc0082eea19ea64cbfe7541a6970
2019-11-28 17:00:31 +08:00
Sunny Shao
3351c78b74 Add FutureTask approach in DashboardFragment
- Use the multiple tasks to enhance the controllers loading.

Bug: 137558156
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.dashboard
Change-Id: I629ff5dc81347cddf9762a87015b9b86b6a46e50
2019-11-26 11:27:03 +08:00
Jason Chiu
10e675d6b5 [Settings] Support master switch of inline toggle of Settings Injection v2
Allow developers to inject MasterSwitchPreference, a switch
preference with two tap targets, to Settings page.

Developers should declare keyhint and switch_uri for the activity
in AndroidManifest,and then implement a SwitchesProvider.

Bug: 132808482
Test: robotest
Change-Id: I64cdf18268be0cfcd38aab2c059144536dd79b32
2019-11-22 04:04:04 +00:00
Jason Chiu
bac5987c8e [Settings] Support pure switch of inline toggle of Settings Injection v2
Bug: 132808482
Test: robotest
Change-Id: Ib24614fb46fe990925edad721e3b7d5d032854fc
2019-11-19 18:24:13 +08:00
Jason Chiu
1a1f9314b6 Refactor Settings for injection v2 inline toggle
Bug: 132808482
Test: robotest
Change-Id: I0b74e05bc26b97259a15859c669060ce3da7972a
2019-10-04 18:32:11 +08:00
Raff Tsai
6db277ebb7 Remove summary provider
- use SummaryProvider to provide the summary of UserSettings
- use WifiDisplayPreferenceController to replace the summary loader
in WifiDisplaySettings
- use ConfigureNotificationPreferernceController to replace the
sumary load in ConfigureNotificationSettings

Fixes: 141653158
Test: robolectric
Change-Id: Id5f5ed645707caa0b25ecae5252174cbf017651c
2019-10-03 15:04:36 +08:00
TreeHugger Robot
d48189c564 Merge "Use SettingsLib Indexable" 2019-09-26 06:51:17 +00:00
Raff Tsai
966fa01423 Use SettingsLib Indexable
- Use SettingsLib Indexable
- Directly use resource id in getPreferenceScreenResId

Bug: 135053028
Test: roboletric
Change-Id: I05f493b55e8b6e2091301e9231ba5615215618e6
2019-09-25 18:24:56 +08:00
hughchen
d49de61f96 Do not block UI when this page didn't have slice
This CL before, if controller have UIBlocker interface
will going to blocker condition to make whole page
invisible for a certain time until slice is fully loaded.

This CL add the check condition that if the controller
have UIBlocker inferface but didn't have slice uri will
not go to blocker condition.

Bug: 141292712
Test: make -j42 RunSettingsRoboTests ROBOTEST_FILTER=DashboardFragmentTest
Change-Id: I79daae131654f8fd823a9c8f1be46ad6c7921908
2019-09-24 10:30:49 +08:00