Commit Graph

28 Commits

Author SHA1 Message Date
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
Fan Zhang
8b30f5310e Remove DashboardTilePreference.
It's not needed for now.

Bug: 32554506
Test: RunSettingsRoboTests
Change-Id: I325a07896e88db97c9d3a461c8cb4c42a6c44737
2016-10-31 14:40:15 -07:00
Fan Zhang
c71f6eec3f Add test for LocalClassLoaderContextThemeWrapper.
Bug: 32426306
Test: make RunSettingsRoboTests
Change-Id: I0b46f8ca69c50c86626bae717bac334b1bb7addf
2016-10-31 13:03:49 -07:00
Fan Zhang
301fe80fa7 Add location to security settings.
Bug: 32437756
Test: RunSettingsRoboTests
Change-Id: I999669963801684eb2399f5e642159970727b3c4
2016-10-26 11:23:20 -07:00
TreeHugger Robot
a2c7f4277b Merge "Modified settings tests to use custom test runner" 2016-10-26 03:12:08 +00:00
Salvador Martinez
f86905ed50 Modified settings tests to use custom test runner
The custom test runner lets us use resources from
multiple projects which resolves many ResourceNotFound
errors that would come up when people who made changes
wrote tests.

Test: make RunSettingsRoboTests
Bug: 32180625
Change-Id: I71f30eecc1164b117351a74b3ea0533625feae5b
2016-10-25 17:20:20 -07:00
Fan Zhang
242da31179 Fix logging spam in DashboardFragment.
When updating preferences managed through PreferenceController, the
fragment should skip prefs that are not available.

Bug: 32255863
Test: RunSettingsRoboTests
Change-Id: I2f9b6ddf8c78d40068dc18f07e60672dcba4474a
2016-10-25 17:14:47 -07:00
Fan Zhang
f83ce92aaf Update Notification preferences UI in new IA.
- Refactored ConfigureNotificationSettings to be more modular
- And tests

Bug: 31799948
Test: RunSettingsRoboTests
Change-Id: I2ecd8930a6aa501c1e625cab6ed25a46f3437e85
2016-10-24 13:33:14 -07:00
Doris Ling
d7aae18f8b Add user and account dashboard category for new IA.
Add the initial version for the User & accounts category and set the
tile's intent if it contains metadata but fragment is null.

Test: RunSettingsRoboTests
Bug: 31801423
Change-Id: Ic63bf8aeaf47f68a184af73c9a8a72b89b597a17
2016-10-21 16:07:39 -07:00
Fan Zhang
a1a84e6530 Make dashboard tile refresh more effcient.
Instead of removing and re-adding all dashboard tiles, figure out a diff
and rebind/add/remove as necessary.

Bug: 32255863
Test: RunSettingsRoboTests
Change-Id: I9d87ba30ab746257d0ea71282951348ebc4e8965
2016-10-20 09:52:01 -07:00
Fan Zhang
db1112a221 Add progressive disclsoure
- Add a ProgressiveDisclosureMixin that contains all logic for collapse
  preference list when it's too long
- Refactored PreferenceController's updateState to take a preference
  instead of PreferenceScreen, because with progressive disclosure the
  preference can either be in screen or the mixin. DashboardFragment is
  responsible finding the preference before passing it to controller.

Bug: 32255863
Test: RunSettingsRoboTests

Change-Id: I6713abd61c954ce12732902e5b3ca4d4c0b1563e
2016-10-18 16:57:11 -07:00
Fan Zhang
66b573ad5a Add display settings dashboard to new IA.
- Added a activity-alias pointing to displaySettings as top level
  setting item.
- Refactored all preference logic in DisplaySettings into
  PreferenceControllers. During fragment onAttach it installs all
  controllers, and during onResume it updates preference state. Each
  controller listens to its own preference change event.

Bug: 31800242
Test: RunSettingsRoboTests
Change-Id: Ibc9bf200c5acce7c4ae9292340822afee27a3a28
2016-10-10 18:26:29 -07: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
Fan Zhang
36924659f5 Refactor DashboardFragment.
Merged refreshAllPreferences into DashboardFragment. This hopefully
makes it more modular to manage preference display logic in each
dashboardFragment, and makes it more efficient to monitor category
changes.

Now subclasses needs to implement 2 methods:
- displayResourceTiles(): for 'static' preferences from xml
- getDashboardTiles(): returns a list of dashboard tiles and superclass
  will wire it up to preference screen.

If getDashboardTiles() return null (aka no dashboardCategory available),
the fragment will not attempt to monitor category change. The edge case
is that if a package starts to provide a tile for this category, we will
not be notified. I have not seen this case coming up. If we indeed need
to handle this case, the category listener needs to have a way to
monitor specific category rather than globally.

Bug: 31781480
Test: make RunSettingsRoboTests -j40
Change-Id: Ia9f9541b95816214df0d0bb27e3e41078c36c5ca
2016-10-07 11:55:43 -07:00
Fan Zhang
e6c60c24a8 Add test for new DashboardFragment and PreferenceController
Also added a FakeFeatureFactory to make it easier to mock different
FeatureProviders.

Bug: 31781480
Test: make RunSettingsRoboTests
Change-Id: Ie45db601e0bec951d7ef983ec2e3ca747ec1c3af
2016-10-06 10:33:01 -07:00