Commit Graph

124 Commits

Author SHA1 Message Date
Fan Zhang
35ed23e8bf Remove unneeded getDisplayableCards() in DashboardAdapter
It will be called when window gets focus, no need to call it here.

Change-Id: I1c4b3b745edb2519e778f8354684d90e2eb55004
Fixes: 113175600
Test: manual
2018-08-28 10:26:19 -07:00
Fan Zhang
a4b14bd9f1 Remove condition manager v1 code.
Change-Id: I866c1f7c493c6080ccf766ecfc8e6b00dafeecd9
Fixes: 112485407
Test: robotests
2018-08-21 13:21:14 -07:00
Fan Zhang
64951163b8 Use getSummary() to get tile summary text.
Bug: 77600770
Test: robotests
Change-Id: Iecef09853bb49bc259502494912ed81d52e2d7ce
2018-08-20 14:13:14 -07:00
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
tmfang
800f713021 Convert ProfileSelectDialog to androidx verison
Change-Id: Ib3baf04860aee07e5f28d7b537a99a3543d2a978
Fixes: 112155563
Test: robo, manual test
2018-08-08 10:33:11 +08: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
9a1928ea36 Move profile selector dialog to Settings
Bug: 77600770
Test: robotest
Change-Id: I601dabfd925a1990b7bd9115ef579bff9039a7c0
2018-08-02 13:35:08 -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
tmfang
27c84de325 Settings Fragment Migration (Build pass app)
This patch focused on fixing compile errors and some runtime errors.

Test: We can't test it now. But we will have an integration test later.
Bug: 110259478
Change-Id: I16c471ddcd0fa1460c665b7f74d86fcace5ee67b
2018-07-11 18:24:51 -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
Fan Zhang
0c8f8a8b46 Use custom drawable for Battery saver condition icon.
- Updated condition interface to use Drawable instead of Icon for icons.
- Converted all conditions to return drawable instead of Icon.
- Created a BatterySaverDrawable to draw a static battery saver icon.

Change-Id: Ie964f3439009c7658603a8ff352a05e964a0a795
Fixes: 76168403
Test: robotests
2018-03-26 17:50:27 -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
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
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
Zhizhi Liu
caeb1720da Migrate some suggestions related classes SettingsLib(II)
Remove classes from Settings.

Test: mm Settings/tests/robotests

Change-Id: I0f046d6a750bc53251deb44887e8665e6d545515
2018-01-25 14:00:12 -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
Fan Zhang
1e27d2b28e Remove Suggestion v1 code.
Change-Id: Ie6e9c8f2b1b5b609d44e287accb9fbbef9054d34
Fixes: 68719093
Test: robotests
2018-01-02 14:48:56 -08:00
Fan Zhang
cbc97bc7dd Hack to wait for both suggestion/category to load
- This is unfortunately necessary to avoid a jank when category
  load completes before suggestion load, in which case user has to
  manually scroll up to see the suggestions.
- We could technically just add scrollTo(0), but that causes the list
  scroll on its own within 0.5 second of settings start, and that's bad.

Change-Id: I8dc869a69a5bf11bbf7644b281cc1778dd1a90e8
Fixes: 69068691
Test: visual
Test: robotests
2017-12-04 15:06:56 -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
Fan Zhang
8052ac0b36 Call SuggestionService.launch when click suggestion.
Bug: 68267490
Test: robotests
Change-Id: I8614f256fc1a87395b5c9d41e3621164a2ded5e1
2017-10-26 15:23:49 -07:00
Fan Zhang
e84911dcf9 Add content description to suggesiton footer
Change-Id: I90402301f9a294326619d8e353e14c1db9962b86
Fixes: 67633955
Test: manual
2017-10-10 12:59:08 -07: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
e7337b3ec7 Bind icon and remote views for Suggestion
Bug: 65065268
Test: robotests
Change-Id: I181a9e092c56f4e45addfc1cde166fb7dac7becd
2017-10-03 11:18:12 -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
Fan Zhang
3ed509cb35 Some code cleanup
- Formatting
- Remove unused code

Test: robotests
Change-Id: If259c7c3893df96744f3c0ad62a378ef6ce01de7
2017-09-07 10:48:45 -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
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
87eb423564 Merge "Update spacing in suggestion/condition header and footer." into oc-dr1-dev am: ef8e2db876
am: fb64a7f74c

Change-Id: Ib3d86ef233acea8b2f090941a8bc11480ed78ef0
2017-07-15 01:17:18 +00:00