Commit Graph

130 Commits

Author SHA1 Message Date
Fan Zhang
1e0b51218b Disable suggestion on low memory devices
Change-Id: I9d22170845661fc8b48b116c9b09f758926c096f
Fix: 63157777
Test: make RunSettingsRoboTests
2017-07-06 16:13:28 -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
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
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
Fan Zhang
9011a67431 Add a suggestion: showing new device features
- New suggestion activity
- Removed useless api SuggestionFeatureProvider.isPresent().

- Also updated support activity search indexing icon and summary

Change-Id: Ib52cf26a985f57bf0aac918606b10f75bd024639
Fix: 62034077
Fix: 62196070
Test: make RunSettingsRoboTests
2017-06-03 14:51:09 -07:00
Doris Ling
83a6621b38 Combine settings suggestion and condition.
- Add a flag in dashboard feature provider to specify whether to use the
combined UI for suggestions and conditions.
- Move Conditions below Suggestions.
- Add dashboard entity for condition and suggestion container, and
  wrap the condition and suggestion list inside the container. The
  container itself will be a single dashboard item, and within it will
  be the list of suggestion or condition.
- Add suggestion/condition header that will show the combined info for
  the conditions and suggestion data, and have the expand button to
  control expanding both the suggestion and condition list.
- Change the individual condition card to be always expanded, and
remove the logic to collapse/expand individual condition card.
- Remove the divider between the action button and condition detail
  within each condition card.
- Add suggestion/condition footer for collapsing the whole suggestion and
  condition list.

Bug: 37645754
Test: make RunSettingsRoboTests
Change-Id: I86df75f7e4551778f79d730851c03121fd0dcbdf
2017-06-02 14:59:48 -07:00
Fan Zhang
59fd017ce5 Revert "Revert "Filter and display top 3 suggestions for exclusive type""
This reverts commit 184ae963e7.

Change-Id: Iac60fc52a5b0c153945c22b97394546a529d3bb4
2017-05-12 18:12:58 +00:00
Fan Zhang
184ae963e7 Revert "Filter and display top 3 suggestions for exclusive type"
This reverts commit 70b634adcf.

Change-Id: I6de213d4c276696c6ccc9e992ff088cf507aa7ce
2017-05-12 18:03:58 +00:00
Fan Zhang
70b634adcf Filter and display top 3 suggestions for exclusive type
Change-Id: Ief4c2f02fcf1064dac3659502bd7511b09a2a7df
Fix: 37947647
Test: make RunSettingsRoboTests
2017-05-12 08:47:39 -07:00
Maurice Lam
cbf797e65c Rebuild suggestions when suggestions are dismissed
When suggestions are swiped away, refresh the suggestion categories
so that suggestions previously suppressed because it's lower priority
or because there is an exclusive suggestion now has a chance to be
shown.

Test: cd tests/robotests && mma
Bug: 36811621
Change-Id: I1a1ae1624c2f69153d95d238b2143ac9273e117d
2017-03-31 17:13:39 -07:00
Doris Ling
0f01c849cd Only register conditions receiver when needed.
1. Update the dnd receiver to listen when dashboard summary running.
- remove the dnd receiver from Android manifest, and create it inside
the dnd condition.
- add lifecycle implementation to condition manager, so that the dnd
condition can know when to register and unregister the receiver.
- remove getReceiverClass() from dnd condition so that its receiver will
not be disabled by the default condition handling when condition is
silenced.

2. Remove all other conditions receiver from Android manifest.
- the broadcast receivers for HotspotCondition, AirplaneModeCondition,
CellularDataCondition from the manifest and create them inside the
condition classes.
- update Condition.onSilenceChanged() to register/unregister the
receivers instead of enable/disable the receiver class.

Change-Id: Iea6288382680df2b02884d1934b8db85daae404c
Fix: 35968517
Test: make RunSettingsRoboTests
2017-03-29 10:47:04 -07:00
Fan Zhang
2907f86971 Fallback to default wallpaper picker if first choice fails
- Add fallback logic in WallpaperSuggestionActivity
- Move some classes around
- Delete some unused class

Change-Id: Ifc8864428647a94f3ecae50d193c2156b2592ff3
Fix: 36140287
Test: make RunSettingsRoboTests
2017-03-17 16:49:58 -07:00
Fan Zhang
264c0c2bbe Fix NPE when building suggestion identifier.
And refactored the getIdent logic into feature provider.

Change-Id: Id6f66a6942cbaf6d26ae4dca62037a6cf01179a5
Fix: 36314240
Test: make RunSettingsRoboTests
2017-03-16 17:12:22 -07:00
Fan Zhang
a5b620e738 Swipe to dismiss suggestions
- Move dismiss suggestion logic into feature provider
- In DashboardData, use hashcode as suggestion's stable id. This is much
  more likely to provide a truely stable id for each suggestion card.
  Eventually I want to use hash for all tiles to provide stable id.
- Add a SuggestionDismissionController to handle swipe to dismiss
  callbacks

Change-Id: If3770f07a90c5469a0b86fc28f3eb5e4c17227cd
Fix: 35159816
Test: make RunSettingsRoboTests
2017-03-13 14:39:00 -07:00
Doris Ling
f2cf2aea37 Remove code that check for dashboard feature.
- remove DashboardFeatureProvider.isEnabled() and all relating code
and tests.

Bug: 35764802
Test: make RunSettingsRoboTests
Change-Id: If7796677abc8904b7436525836d50cdef38e37a4
2017-03-07 11:15:03 -08:00
Soroosh Mariooryad
9ca41dd89a Moving load of suggestions from onViewCreated to onCategoriesChanged.
- This is required when a suggestion is completed and it needs to be
removed from the list immediately.

Test: RunSettingsRoboTests
Fixes: b/35657186

Change-Id: I731bd1d4ef4a23a74cb4022513d0824ff5f74b2a
2017-02-27 10:30:55 -08:00
Soroosh Mariooryad
5f375a2776 Move suggestions package to dashboard.suggestions
Test: RunSettingsRoboTests

Change-Id: I4f9af27767c8e55d3b1a16e77c099da52d40aab5
2017-02-24 11:04:41 -08:00
Soroosh Mariooryad
e457e35ec0 Add ranking to SuggestionFeatureProvider interface.
Test: RunSettingsRoboTests
Fixes: b/35363662

Change-Id: Ib786e6b2733e2b151f73fb68e174a21aedb2b20a
2017-02-20 17:34:36 -08:00
Soroosh Mariooryad
25d8049bb2 Modifying setting suggestion logging to only log the shown items.
Previously if there was three suggestions in the suggestions view, all
three would be logged as shown, although by default only two of them are
shown and the third one is shown only if the view is expanded. Now, only
the actual shown items will be logged.

Test: RunSettingsRoboTests
Fixes: b/35348496

Change-Id: Ic3af7961b4713f48e63c51ac599cb55bf69975ff
2017-02-20 12:40:15 -08: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
efba6b4e14 Skip redundant SuggestionLoader run during app start.
also skip DiffUtil when drawing first frame.


Fix: 34103984
Test: make RunSettingsRoboTests
Change-Id: I4891d1bca1f17c437444761eaf3002624934014d
2017-02-15 02:06:08 +00:00
Soroosh Mariooryad
81adc530d9 Adding the dismiss logic for setting smart suggestions.
Test: make RunSettingsLibRoboTests
Fixes: 35059823
Change-Id: I48a71ff525f6dded6f0b505280f5678a554f7183
2017-02-06 15:25:35 -08:00
Soroosh Mariooryad
b1922dbc39 Adding setting suggestion ranker.
Test: RunSettingsGoogleRoboTests
This is currently behind a flag and it is no-op CL.

Change-Id: Ieed3e5a9c3c2fbb0ce1bfea77c588b04778540eb
2017-01-26 14:45:39 -08:00
TreeHugger Robot
e5a7da2b16 Merge "Fix the animation issue in DashboardSummary" 2017-01-09 22:00:35 +00:00
jackqdyulei
0bb598c4d0 Fix the animation issue in DashboardSummary
1. When condition is inserted, only scroll to top when previous
position is at the top.

2. Clean condition status after it is removed. So the next time
you insert a condition view, it will always be collapsed.

Bug: 33839780
Bug: 34115341
Test: make -j40 RunSettingsRoboTests
Change-Id: I7f48524917c3119ec24b2f67ba506f381573a391
2017-01-09 12:30:57 -08:00
Fan Zhang
f91f7f7063 Fully enable IA.
This saves about 120ms for app start time.

Bug: 34103984
Test: RunSettingsRoboTests
Change-Id: Ib1d2b190eb3b563b99c7f9d82e11e28229fe3316
2017-01-07 13:13:10 -08:00
TreeHugger Robot
f940f86bbc Merge "Do not load old category when IA is enabled." 2017-01-06 03:01:17 +00:00
Fan Zhang
e8a77c551e Do not load old category when IA is enabled.
Bug: 34026031
Test: RunSettingsRoboTests
Change-Id: Ie4ede018c8e3e906093cba4b9d4bf9d75c0bd972
2017-01-05 17:20:59 -08:00
Fan Zhang
c54503d9e1 Update tile color from using accent to colorControlNormal.
Also remove some unused code
Bug: 33759208
Test: visual

Change-Id: I0a019bf6b514564f9e6e844de8a6b75b2ca69cc7
2017-01-05 16:47:59 -08:00
jackqdyulei
0fd7190fdd Refine animation to remove strange reshuffling animation
The issue happens mainly because two animations(move + change) running
on the same view interrupt with each other. When ItemAnimator runs the
move animation, it will change the translationX&Y in a time period.
When the change animation occurs in this period, it gets this translation
value and calculates a non-zero deta, then it would run an unnecessary
move animation, which causes the strange reshuffling.

In this cl, I skip the translation value only for the tile view when
there is pending animation.

I also add scroll operation for conditions view to make it scroll to
top after condition change.

Bug: 33839777
Bug: 33839780
Test: make -j40 RunSettingsRoboTests

Change-Id: I2152f93f756ae20cf754d6fca3525119cb4ceb1f
2016-12-29 14:18:16 -08:00
Fan Zhang
413eaa4070 Clean up search fragment loader lifecycle.
- Programatically create SearchView to make it always expand across
  entire action bar.
- Store current query text during screen rotation
- Restart loader when query text changes

Bug: 33354491
Test: RunSettingsRoboTests
Change-Id: I63838a38514569aac60c5d67ac52ac06a7acd5a3
2016-12-06 14:43:01 -08:00
TreeHugger Robot
cdec3495f8 Merge "Add InstrumentFragment for non-PreferenceFragment types." 2016-12-06 03:10:01 +00:00
Fan Zhang
2d0b344736 Add InstrumentFragment for non-PreferenceFragment types.
This allows app fragment use a less heavyweight fragment as super class
if they don't need PreferenceFragment. Using this class as base is
generally easier to set up robolectric tests too.

Bug: 33354536
Test: RunSettingsRoboTests
Change-Id: I91c4d242ea0333c76c8767c03c3f18dee6b6e104
2016-12-05 17:13:33 -08:00
Salvador Martinez
179e16445e Added logging to pinpoint source of bug
Sometimes the airplane mode banner will show up even
though airplane mode is not on. Logging has been added
to several areas around this condition in addition to
where the actual view is created. This will be used
to try and get a better handle on what the source of
the bug is.

Test: manual
Bug: 30860132
Change-Id: I7213aa7e187c5a8c0e94a5ce7a3269e6667cd61b
2016-12-05 15:32:14 -08:00
jackqdyulei
fa45aee813 Add DashboardItemAnimator to stop flash
When there is no offset change for identical holder in
animateChange, simply return and don't invoke the
resetAnimation.

Bug: 33198024
Test: make RunSettingsRoboTests
Change-Id: Ib83363873bc5f51e5bd71af5a013ee0756728d1a
2016-11-30 16:39:28 -08:00
Tamas Berghammer
265d3c2a0c Update package names to work with the proto3 compiler
Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
2016-11-08 14:06:17 +00:00
Fan Zhang
fabbfb435e Refactor SummaryLoader to set summary on subsetting pages.
- Make a SummaryConsumer interface. Things that needs latest summary
  should implement this interface (DashboardAdapter for homepage,
  DashboardFragment for subsettings). This also decouples SummaryLoader
  from relying on SettingsDrawerActivity.
- Make DashboardFeatureProvider more generic to load DashboardCategory
  by key.

Bug: 31781480
Test: RunSettingsRoboTests
Change-Id: I9c65456fb433a74c352498251e0ccf65da0be1f0
2016-10-07 14:52:06 -07:00
TreeHugger Robot
96fa06ebf7 Merge "Use DashboardFeatureProvider to load homepage tiles." 2016-09-29 21:19:34 +00:00
Fan Zhang
a96a2d8d60 Use DashboardFeatureProvider to load homepage tiles.
Adding support to homepage category.

Test: SettingsRoboTests for regression. Will write tests for new feature
soon once we are set on the data structure.
Bug: 31781480

Change-Id: I25fa367fecb643f17e23f0182df7585bf1fcdd02
2016-09-29 12:31:10 -07:00
Salvador Martinez
d969a5f53d Settings timeout for suggestions
If loading suggestions takes too long (750ms)
settings will display just the categories
so the user does not get confused.

Test: Forthcoming
Bug: 31203004
Change-Id: Ic9866a5ccdcef965908db8c4592435a5d252f7b0
2016-09-29 18:39:47 +00:00
Fan Zhang
aa71afe597 Use MetricsFeatureProvider for logging in Settings.
Bug: 31664539
Test: make RunSettingsRoboTests for regression
Test: adb logcat -b events | egrep "(sysui_|notification_)" for
      verifying log

Change-Id: Id944be7c4ff9911aebee481c2df485542f1318f0
2016-09-23 08:37:37 -07:00
Fan Zhang
c93d18e29c Use MetricsFeatureProvider for condition/suggestion/search.
Bug: 31664539
Test: make RunSettingsRoboTests

This allows different metric clients to listen to these events.

Change-Id: Ib19c8099b16ff78d9aa4901278e0ff33eeefd4a8
2016-09-22 13:22:26 -07:00
Doris Ling
f0bb63f307 Fix NullPointerException in DashboardSummary. am: 797dd7440d am: 454dc3739a
am: 45a821105f

Change-Id: I39623232f80a9de2d2199af11585eaa61bce2e08
2016-08-26 23:03:39 +00:00
Doris Ling
45a821105f Fix NullPointerException in DashboardSummary. am: 797dd7440d
am: 454dc3739a

Change-Id: Id334c7b3f36d8fcfbb4e919007d0bf5789b605fb
2016-08-26 22:26:40 +00:00
Doris Ling
797dd7440d Fix NullPointerException in DashboardSummary.
In onSaveInstanceState(), move saving the suggestions logging lists to
the top so that it will be saved to the bundle even when layout manager
is null.

Test: run monkey
Change-Id: I248563a255158feadeb85898a920af96a1565fa9
Fixes:31111795
2016-08-26 11:13:21 -07:00
Salvador Martinez
a54c3690a4 Added guard to logging in AsyncTask am: 030eeeee6d
am: 60bd509d4e

Change-Id: Ib1d37a0c9c68c01be0d59bff5d78cd37c083689f
2016-08-25 20:02:35 +00:00
Salvador Martinez
030eeeee6d Added guard to logging in AsyncTask
An async task was trying to get the context
in an InstrumentedFragment. This could return
null if the context disappears before the new
thread gets to that line. Logging will now
be aborted if context is null to avoid this.

Test: Manual/Monkey Stability Test
Bug: 31058928
Change-Id: Iae97d389e58a76b0f213a2749415501894ebf649
(cherry picked from commit 566b66e27c)
2016-08-25 17:45:24 +00:00
TreeHugger Robot
e96d65deea Merge "Added guard to logging in AsyncTask" 2016-08-25 00:36:32 +00:00
Salvador Martinez
566b66e27c Added guard to logging in AsyncTask
An async task was trying to get the context
in an InstrumentedFragment. This could return
null if the context disappears before the new
thread gets to that line. Logging will now
be aborted if context is null to avoid this.

Bug: 31058928
Change-Id: Iae97d389e58a76b0f213a2749415501894ebf649
2016-08-24 15:11:21 -07:00
Andrew Sapperstein
f36eac3889 resolve merge conflicts of 6890d53 to master
Change-Id: I61c1ed150fe311c4e07df524b5c0577f35d3bd60
2016-08-24 10:50:28 -04:00