Commit Graph

49 Commits

Author SHA1 Message Date
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
Fan Zhang
9445d15f9d Remove priority from intent-filters for IA items
And use ORDER metadata instead.

Bug: 77600770
Test: robotests
Change-Id: I9862c89ff5b601fbb9fb53eaa91f03d95d501284
2018-08-08 09:09:27 -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
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
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
75bafefa49 Move CategoryManager to Settings.
Bug: 77600770
Test: robo
Change-Id: Id4a0c89938d43d21147944b820a191486c589238
2018-07-23 15:09:41 -07:00
tmfang
f12e6adcdc Settings Fragment Migration (Fix test cases)
Fix all Roboletric test cases.
In this CL, some test cases are broken.
So, We ignored these test cases temporarily.

Test: make RunSettingsRoboTests -j56
Bug: 110259478
Change-Id: I1a3075438a614432a2de4f2d96d8abf9a83ce58c
2018-07-11 18:24:51 -07:00
tmfang
99cc23d0da Settings Fragment Migration (Change imports)
This commit *only* changes imports and optimize imports.
We don't do anything else.

This patch can't compile pass and run test case.
We will update other patches to fix these problem.

Change list.

1. import android.app.Fragment; ->
   import androidx.fragment.app.Fragment;
2. import android.app.DialogFragment; ->
   import androidx.fragment.app.DialogFragment;
3. import android.app.ListFragment; ->
   import androidx.fragment.app.ListFragment;
4. import android.app.LoaderManager; ->
   import androidx.loader.app.LoaderManager;
5. import android.content.AsyncTaskLoader; ->
   import androidx.loader.content.AsyncTaskLoader;
6. import android.content.Loader; ->
   import androidx.loader.content.Loader;
7. import android.app.FragmentTransaction; ->
   import androidx.fragment.app.FragmentTransaction;
8. import android.app.FragmentManager; ->
   import androidx.fragment.app.FragmentManager;
9. import android.app.LoaderManager.LoaderCallbacks; ->
    import androidx.loader.app.LoaderManager.LoaderCallbacks;

Bug: 110259478
Test: Can't test it.
Change-Id: I0a3f98fff34a3494a839c3c42aeabcec3df2c8b3
2018-07-11 18:23:51 -07:00
arangelov
b6852d7828 Add a metadata to control whether an external intent should be opened in
the personal profile when in a managed profile.

This change introduces the com.android.settings.profile metadata with possible values "primary_profile_only" and "all_profiles" (the default
value when not specified). If an application declares this metadata with a value of "primary_profile_only", in a work profile the ProfileSelectDialog is never shown and the application is opened straight in the personal profile. If an application specifies a value of "all_profiles" or does not specify anything, the ProfileSelectDialog is shown to the user.

Bug: 79868199
Test: atest packages/apps/Settings/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java#openTileIntent_profileSelectionDialog_shouldShow
Test: atest packages/apps/Settings/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java#openTileIntent_profileSelectionDialog_explicitMetadataShouldShow
Test: atest packages/apps/Settings/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java#openTileIntent_profileSelectionDialog_shouldNotShow
Change-Id: Id62ab44b58b93c479407cc1bacc7a806a09bfd1b
2018-06-25 14:40:22 +01:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
android-build-team Robot
d3ff522a0b Merge "Fix a NPE where developer options page crash sometimes." into pi-dev am: d940a680a5
am: aee1191c72

Change-Id: Iac0d2a8551d9c1ba230890dadb1bdf2b6edb12b9
2018-04-30 20:51:39 -07:00
Fan Zhang
ecadd0119d Fix a NPE where developer options page crash sometimes.
Developer options page crash for restricted users because the page
removes all preferences while DashboardFeatureProvider tries to
manipulate preferences on screen.

Added a null check to skip changin prefs in DashboardFeatureProvider
because the pref is going to be removed either way.

Change-Id: Ic83fd0dfb2a906605fb1d992d7b36c2163630e89
Fixes: 78655710
Test: robotests
2018-04-30 16:54:10 -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
Doris Ling
f2dce9fac2 Update icon for security settings.
- also fix the issue of dynamic tile icon is being cached and not
updated properly.

Change-Id: I9289260340c1cddc4123fda88c366d658a11ddfc
Fixes: 74255242
Test: visual
2018-04-17 14:33:15 -07: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
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
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
c00ee9588a Update DashboardFeatureProviderImplTest to sdk 26
Test: make RunSettingsRoboTests -j40
Change-Id: I38282b97b3e0325a1568d1af9bd2b38b110736c1
2017-11-27 17:00:56 -08:00
Maurice Lam
e18902ec67 Update Robolectric to 3.4.2
Bug: 66693279
Test: m RunSettingsRoboTests
      m RunSettingsRoboTests-jacoco
Change-Id: I9df619c3d68f0af2ee2ae944a15998275129f7c2
2017-09-22 18:34:00 +00:00
Doris Ling
c879239238 Add metadata handling for specifying tile order.
- if tile order is set in the metadata, it will be used as preference
order instead of the intent priority specified.

Change-Id: If1a09219ece7bb71fc476aad60dc66d7653dfd28
Fixes: 65172575
Test: make RunSettingsRoboTests
2017-09-18 16:19:05 -07:00
Fan Zhang
26a1deffe6 Support dynamic summary and icon for injected tiles
Bug: 63758074
Test: robotests
Change-Id: I2fa27812800c12606a613896ea2aa69dda393944
2017-08-01 16:19:37 -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
Fan Zhang
0a257ee1ba Add flag to control whether or not we should tint icons
Fix: 34365726
Test: robotests
Change-Id: Ic08d8590c9867fb0383da03f05237f74644a77ff
2017-04-28 09:54:33 -07:00
Fan Zhang
3c7ca105df Resolve intent before launching from DashboardFragment.
Once dashboard tile is displayed, the underlying intent can be disabled.
We will eventually hide the item from UI, but there can be a brief
moment before we are able to hide it. So to prevent user click and
launch a non-exist intent, we will try to resolve it first before
launching anything.

Change-Id: Ic8d790bf3c5d4d269eadb757f789a1641928a7b7
Fix: 36036097
Test: make RunSettingsRoboTests
2017-04-26 14:44:12 -07:00
Fan Zhang
320d60f0ad Fix some animation janks during code start.
- Create a   summary placeholder for preferences with summary.
- Create a totally empty summary for prefernces without summary.
- For all dynamic prefs that has *no* SummaryLoader, add meta to set
their summary to empty.
- Other dynamic perfs has   as initial summary.

By doing this, all dynamic pref's height is fixed and will not change as
we update summaries, thus eliminating jank during cold start in each
page.

Also removed DashboardAlias for notification preference and default apps as a side fix.

Change-Id: Iec98b7ffef4e920bf573b2244ad04124c1c5d154
Fix: 36414481
Test: make RunSettingsRoboTests
2017-03-21 13:20:18 -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
Fan Zhang
c1c708f979 Ensure DashboardFragment shares pref controlls with search
Test: make RunSettingsRoboTests
Change-Id: I48be270d9706539925d00874bae29d46406ac491
Fix: 35812240
2017-03-01 13:29:11 -08:00
Fan Zhang
ee45943177 Add logging whenever preference leads to intent.
Bug: 34774945
Test: make RunSettignsRoboTests
Change-Id: I694e5a0a2b614c695193c9c525991a1558e0a81a
2017-02-23 11:55:50 -08:00
Fan Zhang
c62e2f033d Convert DeviceInfoSettings into a dashboard fragment.
This is needed to use logging from DashboardFragemnt.
This page is now a mixture of PrefernceController and non-controller
preferences.

Also permanently removed system update preference from xml to simplify
migration

Todo: convert the rest of preference into controller.

Bug: 34774945
Test: make RunSettingsRoboTests
Change-Id: Ie5130ea7377db2ccf2236cdf48e5cc26d1347d7a
2017-02-23 09:42:57 -08:00
Fan Zhang
cb287cfcd2 Add source metrics when launching top level setting items.
Change-Id: Idca6e136747fb40ba962307abd2620cdd241c3b1
Fix: 35359289
Test: make RunSettingsRoboTests
2017-02-16 10:25:49 -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
42aaa53e75 Add logging for settings
- Log when navigating from Settings to injected tiles.
- Log when user creates a new widget shortcut

Fix: 33209678
Fix: 30137094
Test: RunSettingsRoboTests
Change-Id: I1e0f4e00709c392cde2550fafe53890836387c99
2017-02-13 16:57:28 -08:00
Fan Zhang
628b3cb76e Deprecate SettingsDrawerActivity.openTile.
Use DashboardFeatureProvider to open tile instead. This makes logic more
centralized in one place, and makes logging easier in the future.

Bug: 30137094
Test: RunSettingsRoboTests
Change-Id: I8a028bb7cac8f70f6c237f253be8668cc3ef257e
2017-02-13 14:41:27 -08:00
Fan Zhang
d69b443e35 Fix a memory leak caused by dashboard freature provider.
In constructor, use app context instead of fragment context

Change-Id: I24fbc457037c1d6854ecf0cb270110d73effb662
Fix: 35292764
Test: RunSettingsRoboTests
2017-02-11 16:57:31 -08:00
Matthew Fritze
9955db6360 SearchFeatureProvider's context field is removed
SearchFeatureProvider was holding on to a context and
outlived the SettingsActivity, thus leaking the activity.
The context was passed into most methods, and thus it
makes more sense to pass it in to every method.

Bug: 33677967
Test: Run MakeSettingsRoboTests
Change-Id: Ia82f30e7e0b83587b4baeef28e81da6b8e4303fe
2016-12-20 11:39:10 -08:00
Doris Ling
3d9224fd82 Add new method getExtraIntentAction() in DashboardFeatureProvider.
Add a new method to get the extra intent-filter action to be used
to query the dynamic dashboard tiles.

Bug: 32739952
Test: make RunSettingsRoboTests
Change-Id: I96d9d8bd32ebe34b7c0df00c3fb4d8900b476c94
2016-12-19 14:23:09 -08:00
Doris Ling
a155197d65 Add handling for tiles with intent-action metadata.
If intent action is provided in the metadata for the dynamic tiles, it
will be added to the launching intent when user selects the tile.

Fixes: 31801423
Test: make RunSettingsRoboTests
Change-Id: Ic3e583a578660f4d9c40feff1418e5e354ab8f60
2016-12-05 16:50:47 -08:00
Shahriyar Amini
6259129d69 Use preference key specified in injected settings.
Bug: 31002801
Test: make RunSettingsRoboTests

Reads in optional metadata field for specifying the key used for an
injected preference.

Change-Id: Ief2ff10c508d42f91906b531cf34906c1c42fdd4
2016-11-28 14:49:46 -08:00
Fan Zhang
16f5af6e84 Move ad-hoc dynamic tile injection into FeatureProvider.
Ideally a page should use DashboardFragment and it doesn't need to
handle adding dynamic tiles manually. This method is only designed for
page that are not fully migrated to DashboardFragment yet.

Bug: 32623105
Test: RunSettingsRoboTests
Change-Id: I0cafcddf9a43b164daea500bade869fada5b3f4e
2016-11-16 16:26:38 -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
Fan Zhang
5482637f8b Refactor bindPreferenceToTile to properly handle multi-user
Change-Id: I751eb645663b3546c212925e2ba4a0a94714013b
Fixes: 32470791
Test: RunSettingsRoboTests
2016-11-01 12:06:38 -07:00
Fan Zhang
601fbec8e8 Show select user dialog if setting tile supports multi-user
Bug: 32470791
Test: RunSettingsRoboTests
Change-Id: I07a14c32a1b898467b03df09430038ac4a1a2aed
2016-10-31 16:55:12 -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