Commit Graph

59 Commits

Author SHA1 Message Date
Fan Zhang
54cfb64987 Use tile.getTitle(context) to get tile title.
And switch to getId() instead of title when comparing 2 tiles. This is
more accurate and more efficient.

Bug: 77600770
Test: robotests
Change-Id: I587d90702d98956bf7b420529ac3280351ca4a10
2018-08-20 12:50:06 -07:00
Fan Zhang
06e25e75a5 New ConditionManager
- Create a new ConditionManager that loads data and filters displayable
  condtionals in memory
- Separete conditional controller logic and ui model
- Plumb new ui model into DashboardAdapater, and create a new
  ConditionAdapter to manage UI.

Bug: 112485407
Test: robotests
Change-Id: If56d141d135341e9b8c2dc80e43c3d40b1de1340
2018-08-14 11:01:49 -07:00
TreeHugger Robot
237f80b0aa Merge "Force externally injected tiles to use rounded icon." 2018-08-11 01:20:22 +00:00
TreeHugger Robot
80df6f8bab Merge "Move conditional stuff from dashboard/ to homepage package." 2018-08-11 01:13:20 +00:00
Fan Zhang
ce1b61a146 Move conditional stuff from dashboard/ to homepage package.
dashboard package is not a real place for homepage stuff. Putting
Conditionals here makes it easier to refactor it for new homepage in the
future

Bug: 110405144
Bug: 112485407
Test: robotests
Change-Id: If433aeac8766124f0f4f6e5786b93ac1372bb745
2018-08-11 00:28:31 +00:00
Fan Zhang
fde4f207ff Force externally injected tiles to use rounded icon.
Bug: 110405144
Change-Id: Ic65200fce5010ea8077254e7a67bbe4dae886ec3
Fixes: 79748104
Test: robotests
2018-08-10 15:45:50 -07:00
Fan Zhang
7d5a9eebb8 Add a config to force rounded icon for DashboardFragment.
And each page has ability to turn on/off rounded icons. This CL only
adds the flag, it doesn't actually change icon shape yet.

- Boolean config in xml
- New protected method for each DashboardFragment to load config
- Plumb the boolean into DashboardFeatureProvider for future use.
- Remove some unused APIs from DashboardFeatureProvider

Bug: 110405144
Fixes: 79748104
Test: robotests
Change-Id: Id34782e75aa7289967e4dd1f4fe2978688092702
2018-08-10 10:57:18 -07:00
TreeHugger Robot
fbc325a9aa Merge "Get Tile#intent through getter" 2018-08-08 02:08:06 +00: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
58543721f8 Treat icon color metadata as raw value instead of reference
Bug: 79841665
Test: robotests
Change-Id: I1216718e45e80a428e8a0edb7b9accf5325be769
2018-08-07 09:15:23 -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
Doris Ling
1e9a979edd Fix improper dismiss of suggestion.
- when handling dismiss of suggestion card, need to check if the
dismissed suggestion can actually be removed from the current
suggestion list before trying to refresh the list.

Change-Id: Ia07b4cb76ef6c61a7d27184c3cba9d99fcc90bb3
Fixes: 76094746
Test: RunSettingsRoboTests
2018-05-04 12:29:20 -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
Fan Zhang
7aa626b59d Support customizing icon color for externally items.
When a setting is injected to homepage, we now allow the setting
provider customize the background color for its icon.

If no custom bg color is provided, we fallback to existing behavior.

This behavior is only needed in homepage, because we don't have any
tinting logic in other pages so external setting providers can just
provide arbitrary icon.

Bug: 77188317
Test: robotests
Change-Id: I7d4b512fafc28537de46192026ce4bbe51b498c4
2018-04-13 09:38:36 -07:00
TreeHugger Robot
710207f024 Merge "Stop wrapping RoundedHomepageIcon if it's already wrapped." into pi-dev 2018-03-07 01:21:20 +00:00
Fan Zhang
4fdf0b461d Stop wrapping RoundedHomepageIcon if it's already wrapped.
On homepage, if an icon is already wrapped in RoundedHomepageIcon, we
shouldn't wrap it more. Otherwise each time we do this it will add a few
dp padding around the bitmap.

Change-Id: I5313a38f4bd128272d7b4e05209aaee72c690c55
Fixes: 73295342
Test: robotest
2018-03-06 14:52:03 -08:00
Doris Ling
05811609c7 Create a new list when building suggestion data.
- using sublist of the original suggestions list may results in
ConcurrentModificationException if the originaly list is being modified.
Create a new list instead to avoid running into the issue.

Change-Id: Ia83a0432be542eeb428d177f6118d26fc2262e93
Fixes: 74194336
Test: run monkey
2018-03-06 10:55:40 -08: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
Doris Ling
7d59c441b8 Reduce max suggestion to show to 2.
- since we now either have 1 or 2 suggestions, putting most layout
configuration in the xml instead of dynamically setting it in code.
- remove the suggestion header
- vertical center align the suggestion title text for 2 cards to make
the card with single line looks better.
- tint all suggestions icons.

Change-Id: I0130f15d530264e164e5afd7c091f165a4a6adc2
Fixes: 70573674
Fixes: 73293989
Fixes: 64986736
Test: visual and make RunSettingsRoboTests
2018-03-01 14:16:07 -08:00
Zhizhi Liu
c4e8369ab0 Move IconCache to SettingsLib(II).
Remove IconCache from Settings.

Test: Setting tests passed.
Change-Id: If4d256c5baec2fae8a1cba3cc3a62d4612a2d417
2018-02-22 12:26:26 -08:00
Doris Ling
c627161ca6 Update suggestion card width.
- instead of using hard-coded width for 1 or 2 cards, they should take
up the whole screen width minus the defined padding, so that when the
device is in landscape mode, they look better.

Change-Id: Ic6485c858c7742a154a6d9b05fff180f161be323
Fixes: 72850225
Test: make RunSettingsRoboTests
2018-02-06 12:18:34 -08:00
Doris Ling
7fa083ece9 Update suggestion UI
- reduce space above and below the suggestion header
- reduce space around the suggestion cardview
- set the font family for the suggestion header and title.

Change-Id: Ief6247005f1e69fe5025af60f3c9627d357d94a4
Fixes: 72710227
Test: visual
2018-02-02 11:34:03 -08:00
Doris Ling
a5d0c3e36e Remove suggestion UI v1 codes.
- remove the check for feature flag for suggestion UI v2 and switch to
use the v2 codes.
- remove all code related to v1 of suggestion UI

Fixes: 70573674
Test: make RunSettingsRoboTests

Change-Id: I99ab318c1c0192508a9c5e9e708e86319120d55b
2018-01-31 10:59:40 -08:00
Fan Zhang
1e27d2b28e Remove Suggestion v1 code.
Change-Id: Ie6e9c8f2b1b5b609d44e287accb9fbbef9054d34
Fixes: 68719093
Test: robotests
2018-01-02 14:48:56 -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
Fan Zhang
13ce220807 Log cleanup: remove unnecessary logging for suggestions
- Remove show_suggestion logging in DashboardAdapater. Showing
  suggestion is logged inside SuggestionAdapter during onBind.
- Remove hide_suggestion logging. It's not used by anyone.
- Move SuggestionLogHelper into SuggestionFeatureProvider

Bug: 65065268
Test: robotests
Change-Id: I1e7929d739b79527d2ae01c25177676f6be6ddff
2017-10-05 18:23:57 -07:00
Fan Zhang
cd7b13bba5 Plumb SuggestionControllerMixin to DismissController.
- The SuggestionControllerMixin is needed to dismiss a suggestion.
- When swipe a suggestion, SuggestionControllerMixin is called, which
  then calls API in SuggestionService to dismiss a suggestion.

Bug: 65065268
Test: robotests
Change-Id: I6a0c5823d60b995ab4a36b1c91777f5cd31a500d
2017-09-26 14:09:22 -07:00
Fan Zhang
82cb5a5cc8 Load suggestions through SettingsIntelligence.
- Add flag to switch between old/new implementation
- Add SuggestionLoader to load using Loader (instead of AsyncTask)
- Update DashboardAdapater/SuggestionAdapter to take List<Suggestion>
- Marked old getter/setters as @Deprecated and added comment
- Update tests to cover suggestionV2 adapter changes.

TODO:
- Handler for dismissing suggestion not set up yet.
- Suggestion data structure is incomplete (missing icon, remote view, etc)
- Need to extend Suggestion data strcture to support icon and
  remote view binding

Bug: 65065268
Test: robotests
Change-Id: I2378ef4c9edee972d5de93c3868068e2cde23f56
2017-09-19 11:56:54 -07:00
Soroosh Mariooryad
5ba0f51bcd Log smart settings suggestion enabled/disabled state for A/B experiments
Test: RunSettingsRoboTests
Bug: 64121058

Change-Id: Iadfa575b9a21caecb515b9975d388ee0d0480c11
2017-09-14 10:43:56 -07:00
Doris Ling
97da51876b Fix null pointer exception when logging suggestions.
In monkey test, the suggestions list can become null. So, add check
for valid suggestions list before trying to iterate through the
suggestions.

Fixes: 64757618
Test: make RunSettingsRoboTests
Change-Id: Ib670808a4f222187b9cd53d7d939e71b5ce8dbae
2017-08-16 15:26:03 -07:00
Fan Zhang
e3535d9998 Delete DynamicindexableContentMonitor & all refs to it
Convert input device search into a search query loader

And remove old logic from DynamicIndexableContentMonitor

Change-Id: If652b1ea7c8add9185bbd025055e14925d3a8eec
Bug: 64310452
Bug: 63831980
Test: robotests
2017-08-09 17:27:02 -07:00
Doris Ling
9f90680456 Fix crash when dismissing suggestions.
When the suggestions are in default mode and the number of suggestions
are more than the default count, we set the sublist of the suggestions
list as the suggestion adapter data. In this case, operation on the list
should be done in the sublist instead of the original list to maintain
the list consistency check.

Hence, when dismissing the suggestion, change to remove the suggestion
from the suggestion adapter instead of from the dashboard adapter, so
that any following interaction with the suggestions will not trigger the
concurrent modification exception.

Bug: 64279080
Test: make RunSettingsRoboTests
Change-Id: I970b6af8a1c72bc0c3ee89fef890ae6a669c71d2
2017-08-03 15:12:36 -07:00
Doris Ling
4940539479 Limit the suggestions to be shown to 5.
- when creating the dashboard data, pass the sublist of suggestions to
cap the total number of suggestions to be shown to 5.
- if user swipe away the suggestion, it will only remove the suggestion
from the suggestion adapater, and will not trigger rebuilding the whole
UI.

Bug: 64072051
Change-Id: I1efabeb2a805c670007c631d3ccb0fdfbde7b55a
Fix: 63309218
Test: make RunSettingsRoboTests
2017-07-27 10:45:30 -07:00
Doris Ling
11f4619816 Fix crash on expanding settings conditions.
Check for non-empty suggestions instead of non-null suggestions when
trying to determine whether to show conditions or suggestions list.

Change-Id: Icdb8ad485af436f5d84ce0a746081fc59bd613db
Fix: 63674269
Test: make RunSettingsRoboTests
2017-07-13 16:16:12 -07:00
Doris Ling
78e08f0f0a Update spacing and background color for condition/suggestion.
- changed suggestion/condition and searchbox background color to
  #F2F2F2
- changed condition card background color to #F8F8F8
- removed Suggestion header
- reduced space above condition header/footer by 9dp

Bug: 63393599
Test: make RunSettingsRoboTests
Change-Id: I268934e3a573b542480c0b21dbab68b7217295b5
2017-07-11 15:22:53 -07:00
Fan Zhang
b487fae5d8 Code cleanup: DashboardAdapter.category is no longer a list
We only ever display a single DashboardCategory in homepaeg, so the
category doesn't need to be a list in DashboardData/Adapter

Change-Id: I57db02bb45cbc511f0fce1bf33043b51ef9db15c
Fix: 33861822
Test: updated robotests
2017-06-30 15:30:51 -07:00
TreeHugger Robot
a1bf76a69d Merge "Also tint the settings icon in DashboardAdapter.setCategory()." 2017-06-30 20:07:40 +00:00
Doris Ling
067122a8e4 Also tint the settings icon in DashboardAdapter.setCategory().
When suggestion loader takes longer time to complete, we will first show
the dashboard with just the categories, and refresh the UI when the
suggestion is ready. However, we only tint the icon when we update both
the categories and suggestions, and hence in some case, some tile
results with icon not being tinted.

Change-Id: I023d50655349731b03c7d7aff153d2cbbd8c63e0
Fix: 37456962
Test: make RunSettingsRoboTests
2017-06-28 16:12:38 -07:00
Doris Ling
631893f582 Change to use new suggestion/condition UI.
Change to always use the new UI that combines the suggestion and conditions,
and remove all codes relating to the old UI.

Bug: 37645754
Bug: 62621808
Test: make RunSettingsRoboTests
Change-Id: I3421a9e5182f6606843392d6fae8b9f07c5f2e46
2017-06-28 11:22:44 -07:00
Doris Ling
8233ab5fe5 Fix crash when initializing Settings suggestions.
The dashboard spacer has been removed, but the remaining indexing is not
modified correspondingly, which results in mismatched dashboard types.
Set the dashboard header position back to 0.

Change-Id: I732c4ada556d5d4325e357b8325f66ded5cbe952
Fix: 63052534
Test: make RunSettingsRoboTests
2017-06-27 14:26:03 -07:00
Andrew Sapperstein
40be7df5df Dashboard search bar polish
Various tweaks to match redlines:
- background is now grey all the time
- the search icon is aligned with the other icons
- the title text is primary colored instead of accent colored
- the background of search bar doesn't scroll anymore

Deletes a bunch of logic to add an initial view that would be
colored based on the first view. It never quite worked right.
Now it's consistent and never moves.

Bug: 37477506
Fixes: 62267378
Fixes: 62379978
Fixes: 62361213
Test: robotests
Change-Id: Iddfd45a64a0a8d0365397a207889d7225d1ebb70
Merged-In: I82c584e8f8ecc6fc298c5cdbce08516c6a069a39
2017-06-26 10:28:49 -07:00
Maurice Lam
992fa86d52 Tint suggestion icons
If the suggestion is marked as isIconTintable, tint the icon with
colorControlNormal.

Test: cd tests/robotests && mma
Bug: 62258845
Change-Id: I2a76181d9b8b4d9fbf496a8fc605cb762bba87c0
2017-06-22 11:40:34 -07:00
Doris Ling
fa58cfca6e Refresh the dashboard UI when swiping away the only suggestion.
In the new suggestion UI, the suggestions are listed inside the
suggestion container instead of individual dashboard items. When there
is only a single suggestion shown, and that is being swiped away, the
actual list for the suggestions will handle the swipe and remove that
list item from the list. However, the top level container will remain
until next time the dashboard list is being refreshed. Explicitly set
the suggestions to null to force refreshing of the dashboard UI.

Change-Id: I37f8c8f5a813a5c56f4f2f46103fdbb66ce97fcd
Fix: 62639824
Test: make RunSettingsRoboTests
2017-06-21 15:37:31 -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