Commit Graph

135 Commits

Author SHA1 Message Date
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
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
Fan Zhang
78ea7da54c Misc tweaks to Indexable usage and tests.
- Make SettingsPreferenceFragment implement Indexable directly
- Add existing fragments that are SettingsPrefFragment but not Indexable
  to grandfather list.
- Fix "font size" fragment so it shows up in search properly.
- Remove duplicates for "lock screen display", "Screen saver".

Bug: 70720645
Test: robotests
Change-Id: I44ce0cac0fdf5e882b315861bb4bebc45dbe01e6
2018-07-02 16:46:23 -07:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -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
Jan Nordqvist
9eb43ddddf Fall back to Wi-Fi data display in data usage screen with no SIM.
Bug: 70950124

Test: manual
Test: make RunSettingsRoboTests
Change-Id: I06bf78e54119819be87e15baca7e5b6a241958cb
2018-04-05 07:58:23 -07:00
Fan Zhang
3befdd2c54 Merge "Fix search highlight" 2018-02-20 23:38:46 +00:00
Fan Zhang
72456a9ea6 Fix search highlight
- Fragments should not have advanced button when coming from search.

Change-Id: I10a192216b7ff702e73b791acbcc1eb1d71cb407
Fixes: 73348428
Test: robotests
2018-02-20 13:19:26 -08:00
Fan Zhang
b1d6c76b53 Migrate more settings to SubSettingLauncher
Bug: 73250851
Test: robotest
Change-Id: Ifc27b90d68bf4a907f169e19338e9b52ea5f9922
2018-02-18 21:10:03 -08:00
Fan Zhang
a10004661c Fix NPE when instantiating SettingsPreferenceFragment
Change-Id: I3997d6436f358b802dff9be307c36031f4351ab4
Fixes: 72868191
Test: robotests
2018-02-02 12:18:39 -08:00
Fan Zhang
3d516e7607 Highlight row (instead of ripple) when come from search.
- Moved HighlightableAdapter to its own class
- Replaced ripple with blue background
- Bluebackground only stays for 5 seconds. After that it's replaced by
  ?attr/selectableBackground

Misc fixes.

- Fix NPE in UserSettings
- Update char limit on a new string

Change-Id: I4687e54e71fd7b9243f520b7630563df58be23d4
Fixes: 71715698
Fixes: 72761974
Test: robotests
2018-02-01 12:35:25 -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
681a4cdd47 Add search menu to all pages
Change-Id: I0910df3d26fe583deb70d7052bde28b64e7844a7
Fixes: 68814716
Test: robotests
2017-11-30 10:43:18 -08:00
Fan Zhang
e0b0e9f902 Refactor help menu stuff into a controller
This is a clean up to action bar menu item pattern, we will use the same
pattern to build search icon on all pages in a later change.

Bug: 68814716
Test: robotests
Change-Id: Iedd3ec263e8ccb63ed75ec7a95b28c00878b1de4
2017-11-29 15:51:04 -08:00
Doris Ling
9ff1d79ef6 Expand all preferences when launch from search.
- when the fragment is created, checks the argument to see if the extra
fragment arg key is set. If so, do not hide the preferences in the
preference screen inside the advanced button.

Change-Id: I80fa20672024fe702ed2ddab448232bdc92ce05f
Fixes: 68988454
Test: make RunSettingsRoboTests
2017-11-13 13:43:17 -08:00
Fan Zhang
9ce35ad023 Revert "Expand all preferences when launch from search."
This reverts commit 6589a07d59.
Bug: 68988454
Fixes: 69242304

Change-Id: Iec29dbe302064a6209fbb0a8e7901c9a0f8744c0
2017-11-13 18:57:46 +00:00
Doris Ling
6589a07d59 Expand all preferences when launch from search.
- when the fragment is created, checks the argument to see if the extra
fragment arg key is set. If so, do not hide the preferences in the
advanced button.

Change-Id: Id662ae1cec77edad7fcd5d6daa71929a8cb1402c
Fixes: 68988454
Test: make RunSettingsRoboTests
2017-11-09 15:18:09 -08:00
Fan Zhang
896f1b363c Reduce jank around loading view when opening data usage UI
Change-Id: I3d23d8160b046de8fe125ba0697b7b3d7786453c
Fix: 28181319
Test: robotests
2017-06-26 15:15:30 -07:00
Juan Lang
4482812cb1 Use SettingsLib's versions of Custom* classes.
Test: make RunSettingsRoboTests
Change-Id: I2584e820b72bb4672c53fd1a9f63c7f1662e0809
2017-06-21 12:07:50 -07:00
Matthew Fritze
824f25320a Merge "Search results always highlight proper results" into oc-dev
am: 2a32cb6a33

Change-Id: I1bc6297cc75aa833184a00598f5930aa3ca114dc
2017-06-09 01:23:39 +00:00
Matthew Fritze
33f3e3f4f7 Search results always highlight proper results
In fragments where preferences were being injected after
the super#onResume, the incorrect preference was
being highlighted as the selected result.

This is because the index of the preference is calculated
in SettingsPreferenceFragment#onResume, but the index is
not checked again before the item is highlighted.

Instead, we calculate index right before we highlight.

Change-Id: Idaa655f682a1a6186c1996fb51d352589bbeda0f
Fixes: 62179739
Test: runtest --path packages/apps/Settings/tests/app/src/com/android/settings/SettingsPreferenceFragmentTest.java
2017-06-08 16:25:52 -07:00
jackqdyulei
2b2abac714 Update updateEmptyView
Also consider the visiblity of list container, when list container
is invisible, we should show the empty view.

Bug: 62062415
Test: RunSettingsRoboTests
Change-Id: I065e70386242c425ef3cbfb2b703a5433dbe40c1
2017-05-26 10:53:53 -07:00
Fan Zhang
b84b9cc8e7 Merge "Recursively remove preference from screen." into oc-dev am: 7731b4244e
am: 4472d8af83

Change-Id: Ie8835c9789d959ce3d75b84b05d711f976bab56e
2017-05-25 03:28:15 +00:00
Fan Zhang
e84407f5c3 Recursively remove preference from screen.
The preference framework does not remove pref recursively. So when a
preference is nested in preference hierarchy, it's not safe to simply
call screen.removePreference(). We need to first find its parent and
remove pref from its parent.

Change-Id: Ic7fefa498ed71a8877d862845ddcc2d6d6034a55
Fix: 38507066
Test: make RunSettingsRoboTests
2017-05-24 21:21:00 +00:00
Juan Lang
777ed2535a Depend on SettingsLib's version of lifecycle and FooterMixin.
The implementations have been imported into SettingsLib. Setting's copy
can now be removed, which this change also does.

Test: Manually check battery status, which uses FooterMixin, looks OK.
make RunSettingsLibRobotTests && make RunSettingsRoboTests
     && make RunSettingsGoogleRoboTests
Change-Id: I6539605fdad80d156ff5ff249e68df4a1c412067
2017-05-12 11:10:46 -07:00
Daniel Nishi
e6740f740e Fix a bug where options menu was not showing.
There were two issues that stopped the options menu from
showing properly. First, the SettingsPreferenceFragment did
not call its super class, causing the Lifecycle methods to
never be called. Second, the options menu was not being
invalidated which also stopped the Lifecycle methods from
being called.

Change-Id: I29f2fc105c7ecae7adaccb2e4643e48646398d8d
Fixes: 37255835
Test: Robotest
2017-04-14 14:25:37 -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
35692cf439 Full screen default app fragment
Fix: 34280137
Test: make RunSettingsRoboTests
Change-Id: Ib44e39589781d68c7952a2c16a44682791a422f1
2017-01-23 16:08:42 -08:00
Fan Zhang
d5b48454a3 Build a new FooterPreference UI.
- Create a new layout for footer prefs.
- Create a new FooterPreference type to use the layout
- Create a Mixin to create and add the pref to screen
- Create a new lifecycle observer type to invoke mixin at right time
- Switch SettingsPreferenceFragment to use footer mixin.
- Switch FingerprintSettings to use the new footer pref.

Bug: 33579394
Test: RunSettingsRoboTests
Change-Id: I548ac39a0d120196a7ffed09b4f98bd9a80bae90
2016-12-14 16:41:49 -08: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
Qi Ding
55cdee2738 Merge "Fix searched item isn't highlighted" am: 363c529dc6 am: 1d07de566d am: 85768b3723
am: 051c1b298d

Change-Id: Ib75d421f6b4a4ee97006a3427bb4b1111c5ece2f
2016-10-13 01:40:53 +00:00
Qi Ding
051c1b298d Merge "Fix searched item isn't highlighted" am: 363c529dc6 am: 1d07de566d
am: 85768b3723

Change-Id: I7bb1c3b3a5dbb1ee4e6d8934a7be542076d1e863
2016-10-13 01:34:08 +00:00
Qi Ding
c4772636db Fix searched item isn't highlighted
The searched item isn't highlighted.
To fix this issue, the highlight process should be posted
as Runnable object.

Bug: 31983855
Test: manual - search a item in Settings app

Change-Id: I0dcc5bb52b2faa0a23991459885d8dfcaed0f226
2016-10-06 09:22:00 +00:00
Fan Zhang
4fe7c0859f Fix a NPE when rotating dialog created by DialogCreatable.
Bug: 30088727
Test: make RunSettingsRoboTests
Change-Id: I775899809dfe920daa294f70d646b141da7c0706
2016-10-03 13:50:59 -07:00
Tony Mantler
0b825f5db0 Catch all data set changes
Test: Toggle wifi in settings
b/31649262

Change-Id: I303206f3b977707528e98dfe227b49835edc78f2
2016-09-27 14:48:50 -07: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
d65184faef Log visibility change for DialogCreatable in Settings.
Bug: 30681529
Test: adb logcat -b events | egrep "(sysui_|notification_)"
Test: make RunSettingsRoboTests
Change-Id: I51754d258ba1ddfae24323681f21cd02de4dbb4e
2016-09-21 16:30:32 -07:00
Fan Zhang
6507613ebc Log visibility change for all fragments.
Bug: 30681771
Test: SettingsUnitTests

Refactor visibility logging from InstrumentedFragment into a mixin. And
apply mixin in remaining fragments.

Change-Id: Ibbb59904336254a3e4bb9e8c7d0b36e5a6bc2622
2016-08-18 14:04:13 -07:00
Fan Zhang
bf4be77f7e Merge InstrumentedFragment & InstrumentedPerferenceFragment
Bug: 30642749

The 2 classes are almost identical so I'd like to just merge them if
there is no specific reason for keeping both.

Change-Id: I46af41388e25abf79066ff25bfb793cdef2e06ea
2016-08-10 12:59:24 -07:00
Jason Monk
6263c2f6d4 Merge \\"Fix crash from dismissing after pause\\" into nyc-mr1-dev am: 8cb8dd05a2
am: 44c13b223f

Change-Id: I155ca86eb959fe9b5553be59842e15639c19d4a2
2016-07-19 14:35:53 +00:00
Jason Monk
8cb8dd05a2 Merge "Fix crash from dismissing after pause" into nyc-mr1-dev 2016-07-19 14:28:50 +00:00
Jason Monk
4c5f408e26 Merge \\"Make sure to clear out preference cache when done\\" into nyc-mr1-dev am: 9b0931e986
am: d1a54dc62a

Change-Id: I07e1c9725cd6880d7b974e318959cb746ab014b4
2016-07-15 17:55:57 +00:00
Jason Monk
8a7d0744be Fix crash from dismissing after pause
Change-Id: Ic9f655bff5aec5678d975389bc1f391b8d608099
Fixes: 29977187
2016-07-15 13:18:48 -04:00
Jason Monk
db7868ef25 Make sure to clear out preference cache when done
Change-Id: I05b420dcab67622782b3c1a3971c1a5a0b74ad56
Fixes: 29314480
2016-07-01 09:23:27 -04:00
Jason Monk
2f40b22d41 Merge \\\"Fix crash in finish from onCreate.\\\" into nyc-dev am: 1a1f6b0b1b am: 0fa8dc1b55
am: 4d86173586

Change-Id: I342042c107ea6cf8dcdcefd9d31b53232a8440ff
2016-06-10 15:17:20 +00:00
Jason Monk
656bc6004f Fix crash in finish from onCreate.
Change-Id: Ia4937fecdc93e30a468b8fefd2f8776186c8e151
Fixes: 29245324
2016-06-10 09:49:12 -04:00
Jason Monk
4a8b16323b resolve merge conflicts of 167f6cc to nyc-mr1-dev-plus-aosp
am: 84f544a2ae

Change-Id: I73d7ff76eae3871659063eb58d4efc849f261ac8
2016-06-08 19:34:31 +00:00
Jason Monk
b7e4380cd2 Remove PreferenceActivity
Its broken and isn't worth maintaining, instead port the few things
using it over to SettingsPreferenceActivity with wrapping blank
Activities like the rest of Settings.

Change-Id: Ic82f0dcb63ed9b4078f7da6a79c0c52f0130e8d1
Fixes: 28779941
2016-06-08 09:48:58 -04:00