Commit Graph

64 Commits

Author SHA1 Message Date
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
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
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
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
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
Alexander Dorokhine
46e85a2fad Migrate away from deprecated Truth APIs.
This is a transitional step towards truth 1.0.1, where these APIs have
been completely removed.

Bug: 168765701
Test: m checkbuild
Change-Id: I76f9c37cb699ce6ab8715ffe35d11668ccbceea1
2020-09-24 23:09:41 +00: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
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
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
Yanting Yang
4e56cb2917 Add a way to suppress injected tiles for OEMs
Create a config resource for OEMs to add suppressed tile's key, then
DashboardFragment will filter related tiles out from Settings.

OEMs can use this way to suppress security patch injected tile if they
don't use Google OTA.

Fixes: 130734771
Test: visual, robotests
Change-Id: I4cab79c8672048fa543d39b2a8f38ffe338189c8
2019-04-20 01:31:07 +08:00
jackqdyulei
a5f1b5c629 Fix crash for UiBlockerController
1. Don't create UiBlockerController if there is no related controller
2. Don't update visibility if UiBlockerController is null
3. Use findPreference() from DashboardFragment, which already has null
check.

Change-Id: Iee24c64317fb9d5a1cf2076d25728af485d390c5
Fixes: 122807414
Fixes: 122805831
Test: RunSettingsRoboTests
2019-01-15 03:58:14 +00:00
James Lemieux
f1dade40d2 Use binary resource support in robolectric
The resources available to tests are now exactly the merged resources
located in the APK under test.

Bug: 74359828
Test: make -j56 RunSettingsRoboTests
Change-Id: I050db81a92decefea23314b5ec7a62f77ff4bb2b
2018-12-12 19:53:49 -08:00
Fan Zhang
ff47b303c4 Remove call to actionWithSource.
Switch to generic action logging call.

Bug: 117860032
Test: robotests
Change-Id: Ibd7c59ac0ec8a9fa1b368b40f0453a1b42071377
2018-11-12 05:32:13 +00:00
Doris Ling
8741c04821 Add log when the advanced button is clicked.
- register the advanced button expand listener and add the metrics log
when it is clicked.

Fixes: 70930626
Test: make RunSettingsRoboTests

Change-Id: Ife4af4bd4a0a8534cf9ba63949660a810b09446a
2018-08-27 14:23:13 -07:00
Fan Zhang
3506b74659 Get Tile#intent through getter
Bug: 77600770
Test: robotests
Change-Id: I17d3556f833e6a9610fe34f382534bd90bb0499f
2018-08-07 14:50:18 -07:00
Fan Zhang
60243e6873 Remove custom tintable check.
Make a bunch keys private in tile and DashboardCategory
Bug: 77600770
Test: robotests
Change-Id: I4693e6bb71bd50cc664f578c7f8e25e67da20b67
2018-08-03 16:38:36 -07:00
Fan Zhang
1c61a58f0d Pass in context when loading icons from Tile
Bug: 111860183
Test: robotests
Change-Id: I836ad66eb420f4e0bd0bbded541f4dfe947c9b18
2018-07-26 13:09:25 -07:00
Fan Zhang
701b65eccc Use Tile.getIcon() to avoid caching issue
Bug: 77600770
Test: robotests
Change-Id: Icb21f5da9b542abc239b04b71813290ad3104ffb
2018-07-25 12:06:10 -07:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
James Lemieux
22a39c2b93 Use external/robolectric-shadows/run_robotests.mk
This allows Settings to test against the latest framework changes.

Also replaced TestConfig with traditional robolectric.properties.

Bug: 73173204
Bug: 73892008
Test: make -j56 RunSettingsRoboTests
Change-Id: I3135b4fa5f095ba79b282a76f45dd9baa2584bc7
2018-03-04 03:50:08 -08:00
Fan Zhang
f7843adabd More renaming in DashboardFragment
getPreferenceControllers() -> createPreferenceControllers() for the same
reason as in ag/3647936

Bug: 73668763
Test: robotests
Change-Id: I97670a91a2a38d1c844d1b9d37f4222c5e6f45a0
2018-02-23 16:56:30 -08:00
Fan Zhang
917f101899 Instantiate pref controllers from xml if it's defined.
- If a <preference> tag also defines a controller, we will try to
  instantiate it before displaying the UI. The same logic is shared by
  BaseSearchIndexProvider so it also drives search suppression.

- If user also defines a list of controllers programatically, the
  programatically created ones takes precedence.

Bug: 73668763
Test: WIP
Change-Id: I7aecec270bcd3af261e012ef1f6995d2a523cfa1
2018-02-23 14:08:51 -08:00
Leif Hendrik Wilden
28dee1f086 Migrate to use instrumentation classes from settingslib.
Test: Compiles. Manually tested.
Change-Id: I70a6e76cc8440547746ecc008c32bd06a7de8161
2018-01-24 12:30:39 -08:00
Leif Wilden
cab0ee611d Revert "Migrate to use instrumentation classes from settingslib."
This reverts commit 1546cca529.

Reason for revert: Broke fingerprint setup flow. b/72267201

Change-Id: I8321265ae64732c526325882ddea51080decddf5
2018-01-22 20:57:36 +00:00
Leif Hendrik Wilden
1546cca529 Migrate to use instrumentation classes from settingslib.
Test: Compiles. Manually tested.
Change-Id: Ie5515bb0fe3e621fc7723a9b04ba23e4bfa9c401
2018-01-18 11:13:24 -08:00
Ben Lin
9275177002 Change underlying preferenceControllers to an ArrayMap of Lists.
Previously, DashboardFragment stores preference controllers in an
ArrayMap of <Class, AbstractPreferenceController>. Thus when there are
multiple controllers of same class (ie. multiple
PreferenceCategoryControllers), they cannot be stored simultaneously.
This changes the value to a List so we can store multiple controllers of
the same Class without extraneous sub-classing.

Bug: 70949662
Test: All existing tests still pass.
Added
DashboardFragmentTest#testPreferenceControllerSetter_shouldAddAndNotReplace
and DashboardFragmentTest#updateState_doesNotSkipControllersOfSameClass.
Change-Id: I397e8c91977ea1180d48a3af75dd4058bf1175c0
2018-01-03 17:03:59 -08:00
jeffreyhuang
cbfb099a40 Rename SDK_VERSION_O to SDK_VERSION
Test: make RunSettingsRoboTests -j40
Change-Id: I6715062d8addadda441e32809db1af55f15e3a90
2017-12-05 16:43:54 -08:00
Fan Zhang
dff6dd687e Move away from deprecated FakeFeatureFactory.setupForTest()
Test: rerun
Change-Id: I896ba414315ddb1664c0499264f4992f0554ef98
2017-12-05 10:12:10 -08:00
Doris Ling
bcb76351b3 Fix ConcurrentModificationException in SummaryLoader.
When the dashboard summary is being initialized, it will rebuild the UI
while the summary loader tries to to go through the tiles to update the
summary. Both is being done on a separate backgroud thread, and it will
run into concurrent modification issue if the thread is being swapped
while one is looping through the list.

Instead of letting clients access the list of tiles directly, add a
getter method in DashboardCategory to get a copy of the list of tiles
for all read-only operations.

Change-Id: I479669abd8d1d0a8ee9a4113d8ad2244da56f4d8
Fixes: 69677575
Test: make RunSettingsRoboTests
2017-11-28 16:43:07 -08:00
jeffreyhuang
e4a2f95cbd Move dashboard test package to sdk 26
Test: make RunSettingsRoboTests -j40
Change-Id: Icae52730bb12abcabb42d7e0a905c2b9108c3e28
2017-11-27 17:00:56 -08:00
Doris Ling
8b14a1a7a6 Change to use the expand button in support lib.
- functionality for hiding portions of the preferences in the preference
screen is added to the support lib. So, changing the settings
implementation to use the feature from the support lib instead.
- remove ProgressiveDisclosureMixin and the related code

Fixes: 63985174
Test: make RunSettingsRoboTests
Change-Id: Ib1d39b2db93d78a56c7adf90abcae5226f9564c2
2017-10-27 13:16:38 -07:00
Fan Zhang
1ca6b25321 Don't attempt to tint icon if icon is not available
Change-Id: I0aa2a17d51d966dce182381c7bba8913ad997738
Fixes: 65460834
Test: robotests
2017-09-08 00:10:55 +00:00
Doris Ling
7087fd92a1 Check the tintable metadata before tinting tile icon.
When determining whether to tint the tile icon, first check whether the
tintable metadata set for the tile. If no metadata set, will then follow
the default logic that tint the tile icon if it is not coming from the
Settings package.

Change-Id: Idf0863e0c6ab063aeaa6d013fa620508ced31fdb
Fix: 62473193
Test: make RunSettingsRoboTests
2017-07-18 10:39:47 -07:00
Tony Mantler
1d583e125f Make PreferenceController a mixin
Bug: 62912136
Test: Existing tests in BaseSearchIndexProviderTest
Change-Id: Ieda359806c09a019840b2005446c7ec8b61fdb00
2017-06-26 10:58:36 -07:00
Andrew Sapperstein
9f1e911759 Refactor test runner to use static list of resource paths
Previously everything lived in an inner class method of
SettingsRobolectricTestRunner. That method has now been turned into
a static method so that it can be called by other runners.

Bug: 62460102
Test: robotests
Change-Id: I6612b1f26404587301c534c8ba60e39d59d6c840
2017-06-09 09:21:26 -07:00
Maurice Lam
046400c2c4 Migrate settings robolectric tests to mockito 2
- Migrated ArgumentMatcher subclasses to lambdas
- Replaced any() with nullable() where tests were failing

Test: cd tests/robotests && mma
Bug: 38456058
Change-Id: Ice8c39b435c45b87f82dbbd9860e68f235314cf8
2017-05-24 15:14:31 -07:00
Fan Zhang
f0215712ba Disable collapse when fragment is opened from search
Change-Id: I9564dff4ec53256a0fe992055049cf65ce68e37b
Fix: 36076953
Test: make RunSettingsRoboTests
2017-03-15 15:21:34 -07:00
Fan Zhang
c6ca314c0b Log source with visibility change
- Add a method in VisibilityLoggerMixin to log visible event using
  LogMaker, which allows logging additional FIELD_CONTEXT field.
- In Utils.startFragment, add current page's metricsCategory as an extra
  to next page.
- In next page's onResume(), extract the previous page's metricsCategory
  and send it to VisibilityLoggerMixin.visible()
- Update all caller with additional paramters

Change-Id: I8e1f2597fa465b7d3aa16fa1d21c052a3219694a
Fix: 35359289
Test: RunSettingsRoboTests
2017-02-15 17:17:19 -08:00
Fan Zhang
7e6df837ee Remove getCategoryKey() from DashboardFragment children.
Use the centralized registry to look up category key instead.

Bug: 32936784
Test: make RunSettingsRoboTests -j40
Change-Id: I0b8c72d70f93e4b5c58871ac90de41f69ad15653
2017-01-24 14:51:15 -08:00
Doris Ling
fd83b2eb52 Fix null pointer in dashboard fragment test.
- use context instead of activity to retrieve resource details.
- revert the change previously made in getActivity() calls.
- add null checking in package name and tile intent.

Fix: 34396855
Test: make RunSettingsRoboTests

Change-Id: Ic853939fee3c381b663c0320354da51d3b2a0e11
2017-01-18 17:31:11 -08:00
Fan Zhang
9dc9c6174c Insert dynamic dashboard tiles into optional placeholders
Insteads of inserting tile onto screen using absolute priority values,
now each page can have a placeholder preference, and at run time we will
add dynamic dashboard tiles to placeholder's place.

Bug: 32827787
Test: RunSettingsRoboTests
Change-Id: I1fe9e11dce4eb6fb4a9b56af05a2b8e5cdae00d2
2016-11-14 17:09:18 -08:00
TreeHugger Robot
bbae3e89aa Merge "Remove DashboardTilePreference." 2016-10-31 23:25:17 +00:00