Commit Graph

134 Commits

Author SHA1 Message Date
Jason Chiu
3b32efc316 Remove hardcoded color for dynamic items
Bug: 403063643
Test: visual
Flag: com.android.settingslib.widget.theme.flags.is_expressive_design_enabled
Change-Id: I42bbcc6a155feb1fd6576af5b1aac0d8fd07583a
2025-03-14 06:47:45 -07:00
Jason Chiu
3e064619ec Support icon color scheme for homepage injections
Bug: 402607181
Test: visual, atest SettingsRoboTests:DashboardFeatureProviderImplTest
Flag: com.android.settingslib.widget.theme.flags.is_expressive_design_enabled
Change-Id: Iac6434864c38b08e2a35cc58f910a3cf1a6dc113
2025-03-14 14:34:36 +08:00
Jason Chiu
b84b300523 [Expressive design] Update homepage injection icons
Bug: 396944193
Test: visual, robotest
Flag: com.android.settingslib.widget.theme.flags.is_expressive_design_enabled
Change-Id: I58274fb39b01f9c79abfb2e1e60925edacfa6573
2025-03-03 00:34:54 -08:00
Chris Antol
969fc9639b Support dynamic injected preference icons from raw data
Flag: com.android.settings.flags.support_raw_dynamic_icons
Bug: 351884562
Test: Registered an injected preference in another app locally, providing icon dynamically using new metadata field
Change-Id: I80a5e6804b9beab343c0068753277948a3855865
2024-07-12 22:57:37 +00:00
Edgar Wang
47400df7ae Homepage UX revamp
- unified Search and Suggestion behavior between regular phone and two
  pane
- don't adjust padding
- update new icon drawable
- support group homepage preference with round corner on phone
- Remove avator from homepage
- Adjust homepage preference order

Bug: 333989622
Bug: 334130370
Test: visual
Change-Id: I9880b52553f164745766c8b9d5c996585285e52a
2024-05-09 08:21:08 +00:00
Jason Chiu
0bd014c497 [Safer intents] Settings misc
To avoid implicit intents, make intents launch explicitly.

Test: build
Bug: 323061508
Change-Id: Ie19cbceb89842a75a180898abcce81b63c18d46c
2024-03-29 04:22:45 +00:00
Chaohui Wang
15ca95a31b Migrate to TwoStatePreference
SwitchPreference and SwitchPreferenceCompat are both TwoStatePreference.

Using TwoStatePreference in Java will helps migration in the future.

Bug: 306771414
Test: manual - check Settings pages
Change-Id: I84e1d7b09451106797c2b23d127855c6976678ca
2023-10-23 09:28:57 +00:00
Chaohui Wang
8e2ae547d6 Clean up FeatureFactory.getFeature()
Bug: 286764889
Test: m Settings
Change-Id: I7e472e6b0ca6b7a735c1b92742ddf06c545176fc
2023-08-08 08:41:48 +00: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
Jason Chiu
771a0c0473 Eliminate the injection flicker while navigating back
For the title/summary uri, do not set the placeholder when it already
has content. This can avoid clearing the text before re-rendering.

Test: robotest, visual
Fix: 256657256
Change-Id: I0518f5247fd2acf6a5eaa63f0f363275103a79af
2023-03-01 10:02:35 +00:00
Jason Chiu
fb95451369 Reserve the icon space to avoid preference padding change
If the injection icon is to be retrieved from a provider, the preset
transparent drawable is a 1x1 icon, which may cause the preference
padding change before and after the injection icon reloading.

Bug: 253471066
Test: robotest, visual
Change-Id: Ie88f69bb047a64a6a0ee30c060d8cbb8fe27b3d7
2022-11-07 10:11:20 +00:00
Arc Wang
03d8d11914 Fix can't start injected item problem
Should set highlight Preference key after
isDuplicateClick to ensure clicked Preference
key & highlight Preference are different and
then isDuplicateClick returns a correct value.

Bug: 233553587
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.dashboard
      manual
      1. Click all left pane items and see if there is any launch problem.
      2. Check if duplicate click check works.

Change-Id: Ic6394b96896fd3a0fb926707565f63beff74a27b
2022-05-24 07:13:35 +00:00
TreeHugger Robot
baa2c48575 Merge "Filter out the duplicate click event on menu page" into tm-dev 2022-05-20 18:18:58 +00:00
Jason Chiu
e04dfaa29e Filter out the duplicate click event on menu page
Whenever the highlighted item is clicked, Settings shouldn't start the
second-layer page again even if the user goes to its child page.
Ex. When the user goes to the Tethering page, clicking on the menu
entry "Network & Internet" should not switch to the page.

Exception: in the deep link case, allow the first click event on the
highlighted item to launch the second-layer page when the page is not
the same as the one on the right pane.

Fix: 215267159
Test: manual, robotest
Change-Id: I2315e0069facc4867cb157752b1a3144716b7d17
2022-05-20 15:01:31 +00:00
Jason Chiu
65d46ee179 Guard against the NPE in setPreferenceIcon()
Fix: 232902867
Test: robotest
Change-Id: I01f2a6aa8dab9c8e099588e440fc35ed1093592a
2022-05-18 17:07:26 +08: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
Yi-Ling Chuang
2cb3f925a3 Only set embedding rule for top level injection
Only the injected items on the top level pages should always be opened
on the right pane, so we should only register the split rule for that
part. This will leave flexibilities for those injected items in the
subpages.

Fixes: 216026158
Test: Go to Passwords & accounts > {account} > Google Account and see
the page opened in a full screen/new task.

Change-Id: I9f311547854ace410e93fdb4ca394df1079f723c
2022-02-11 15:34:41 +08:00
Jason Chiu
d2e506fd20 Merge "Revise homepage highlight mechanism" into sc-v2-dev am: 7bfe3e869a am: 3b9ad4de7f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16366004

Change-Id: Ib86f125d24836fb955d5dd31ec26f250460d3161
2021-12-03 09:46:31 +00:00
Jason Chiu
a305c23f5e Revise homepage highlight mechanism
- Create TopLevelHighlightMixin to handle highlight actions and simplify
  TopLevelSettings
- Fix the error highlight and the flicker after screen rotation
- Postpone creating the fragment until it's needed to accelerate the
  initialization and to fix the search highlight function breakage after
  toggling light/dark mode
- Register activity embedding rules only once for injection and
  wallpaper
- Do not highlight Tips & support since it's full screen
- Refactor ActivityEmbeddingRulesController

Bug: 207316936
Test: manual, robotest build pass
Change-Id: If322ec180b03ee123987c70779a25c6a570d9faf
2021-12-03 12:04:48 +08:00
TreeHugger Robot
71ab9aefcb Merge "Register rule for wallpaper entry" into sc-v2-dev am: 6c24e5bc33 am: d34752cce6
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16180475

Change-Id: I90e42051ccdf056da7899bf5a04125d3d945fe20
2021-11-05 01:25:37 +00:00
Tsung-Mao Fang
b3db40a02b Register rule for wallpaper entry
We should keep consistent split rule for wallpaper and other home menu
item. So, we create this cl to register the split rule for wallpaper.

Also, I do some minor refactoring in this cl for reusing existing
method and better code quality.

Test: Go to wallpaper, and click back key. App can close.
Fix: 204406425
Fix: 204364572

Change-Id: Ia7de9483b351d1121cc26c4af1cb8a89ad0a16bc
2021-11-04 18:48:59 +08:00
Arc Wang
d9d4866004 Merge "[Large screen] Fix searched Subsettings back navigation bug" into sc-v2-dev am: c1b5f7883c am: 31ec8a9128
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16145690

Change-Id: I53557ce86744f44a2e43af451c286c054bb1646d
2021-11-01 01:57:31 +00:00
Tsung-Mao Fang
e3f34ef7db Merge "Register the rule for injected apps" into sc-v2-dev am: 29063a7981 am: 04c7515603
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16138631

Change-Id: I51b34f59603d0fc78679402ca951e90743f67c6b
2021-10-29 10:02:37 +00:00
Arc Wang
54998b7bfe [Large screen] Fix searched Subsettings back navigation bug
Settings app registers SubSettings SplitPairRule with clearTop
true, it will finish Settings app if users click back button on
a SubSettings page.

This change registers SubSettings SplitPairRule with clearTop
true when users click a SubSettings item in Settings home menu.

And this change registers SubSettings SplitPairRule with clearTop
false when users click a SubSettings item in search result.

Bug: 204501750
Test: manual
      1. Settings -> Search settings -> search a SubSettings item
         (e.g., Battery)
      2. Click the searched item.
      3. Click back button.
Change-Id: I6e1862de528e971137ae7087de608bbdd79096b2
2021-10-29 17:45:40 +08:00
Tsung-Mao Fang
bb24a2f63b Register the rule for injected apps
We should align behavior between injected apps and in-app entries.

Test: Open the Google/DW page and click back key. Then, app is closed
directly.
Fix: 204406425

Change-Id: I57831c4df78b502b3998b3f7384df2900dbfe56f
2021-10-28 18:27:12 +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
1ab7ad3e40 Merge "Revert "Support highlightable Settings homepage menu for 2-pane"" into sc-v2-dev 2021-10-08 14:48:14 +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
9b1f593773 Merge "Support highlightable Settings homepage menu for 2-pane" into sc-v2-dev 2021-10-08 07:52:45 +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
TreeHugger Robot
c7dacf6bf4 Merge "Launch activities in another task if the metadata is set." into sc-v2-dev am: 14a90d0639 am: 3d86e97433
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15959659

Change-Id: I7f4ce2f62faa7e2f9f27c6664b78239b29d31934
2021-10-05 12:07:28 +00:00
Yi-Ling Chuang
3855d6e587 Launch activities in another task if the metadata is set.
Add FLAG_ACTIVITY_NEW_TASK to the intent if META_DATA_LAUNCH_NEW_TASK is
set to true to make it launch a separate task.

Bug: 197702494
Bug: 197700978
Bug: 197702789
Test: Set this metadata to true and make sure this page is launched in another task.
Change-Id: I3b4e5745e940a3db5db6be51e17a9c505915e3c0
2021-10-04 16:36:19 +08:00
TreeHugger Robot
d604c56542 Merge "Correct how the injection mechanism starts activities" into sc-v2-dev am: 40e9a8aaaf am: 5be7a95a99
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15809057

Change-Id: Ib6b6c20b95653e23e79183e8ec30ac6a7c462d0d
2021-09-14 04:23:42 +00:00
Yi-Ling Chuang
5fc96844e5 Correct how the injection mechanism starts activities
Settings Injection used to start activities with
startActivityForResult() and its extension, where there was not result
really being handled. Hence, this CL corrects the way it starts
activities by removing the "ForResult" part.

Fixes: 197704126
Test: robotest and launch Android Auto to see it being launched in
another task.

Change-Id: I259b2555cf62f8966afdf664b337af5f216b3843
2021-09-11 16:48:37 +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
Yanting Yang
da06cec173 Improve flicker when enter Security page
The flicker preferences are injected from external apps and the text
shifting is due to it needing time to load the icon from the content
uri. To avoid flicker, put a transparent icon as default to wait for
icon update.

Fixes: 189165518
Test: robotests & visual
Change-Id: I727eeefd5455711a53d3fd9ccd5356a15b9daae4
2021-06-11 16:59:53 +08:00
Yanting Yang
be4c5f078f Remove silky flag from homepage for official release
Remove the silky condition and clean up redundant files.

Bug: 183670633
Test: robotests & visual with turning on/off silky home
Change-Id: I9259108534935ed8551748b922098dd52043afc1
2021-05-14 17:52:53 +08:00
Yanting Yang
90d323cefa Move DWB to the fifth position from the bottom on the homepage
Remove relevant configs, logics and tests.

Bug: 187885890
Test: robotests & visual
Change-Id: I309d5290f19bf0b01692dd6f14c4cdcc52066453
2021-05-13 20:51:47 +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
Yanting Yang
d1312e8e6e Add summary back to the homepage
Also update some summaries with new strings.

Bug: 183586663
Test: robotests & atest & visual

Change-Id: I692be9b34e8867501aaa8c8e40428870b99644f8
2021-05-06 00:27:37 +08:00
Jason Chiu
8531d8795f Fix the unaligned title of injected items
Remove the summary space holder for the injected items that are not
assigned a summary or a summary uri.

Test: visual, robotest
Fixes: 187006845
Bug: 182357397

Change-Id: I7b3d165f0ffd771dd0110962c9e3159c4977d6e3
2021-05-03 12:22:36 +08:00
Yanting Yang
155634c02a Update the icon size of homepage preference for injected IAs
Based on the Android S design, apply the new foreground image inset to
AdaptiveIcon to generate the new injected IAs icon.

Fixes: 177213699
Test: robotest & visual with turning on/off silky home
Change-Id: If1961a3a41cda92f5435beb47799e8250820d9fb
2021-01-15 12:32:33 +08:00
Yanting Yang
b3381de206 Override homepage tile positions for silky home
Create configs to record the packages and orders of homepage tiles and
then according to these data to override homepage tile positions.

Bug: 168166015
Test: visual with turning on/off silky home
Change-Id: I3fcb54ac531a124101084bb40064b5a7227bf311
2021-01-13 15:42:41 +08:00
Yanting Yang
9aa4a5463f Remove subtitles for the homepage IA
Remove the summary of the homepage IA if silky home enabled.

Fixes: 170933968
Test: robotest & visual with turning on/off silky home
Change-Id: I502b6590cece9b80e9923109fe0582cc4d9a1c56
2020-10-20 23:54:03 +08:00
Jason Chiu
fb36be1a2f [Injection] Refine UI behavior for icon_uri
1. Make the icon provided by the content provider override static icon.
2. Apply the background settings "bg.hint" and "bg.argb" to icon_uri.

Bug: 167568758
Test: visual, robotest
Change-Id: I44c66d8ea2686df1dfe1f9ad28645da7e21414ed
2020-10-19 15:25:58 +08:00
TreeHugger Robot
2cb6dd369c Merge "Guard against flickering of dynamic injection items" into rvc-qpr-dev am: 28b05910d8 am: d2f2f4b13e
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/12682503

Change-Id: I5fa97bb1a3feac16a64fd74696aa6713b8aeb2aa
2020-09-24 13:21:52 +00:00
Jason Chiu
a7d76af933 Guard against flickering of dynamic injection items
The summary of injected items may flicker when the data is change from
URI.

Root cause:
If an external app injects an entry to Settings with a dynamic summary,
Settings will observe the summary change via the provideed URI. However,
sometimes when Settings observes the data change and then refreshes the
UI, the data doesn't really change and settings still gets the same
summary. If it happens in a short period, the summary will seem
flickering.

Solution:
Check if the data really changes before refresh UI. Guard both title and
summary.

Fixes: 168309941
Fixes: 166785977
Test: robotest
Change-Id: I137fc317dcfd8919195c10fa8cf7d2559fe1029d
2020-09-24 17:25:48 +08:00