Commit Graph

69 Commits

Author SHA1 Message Date
Stanley Wang
b87ddba6cd Use SettingsLib's MainSwitchBar to replace SwitchBar in Settings.
To log Settings metrics, the MainSwitch extends MainSwitchBar and
replace the SwitchBar in SettingsActivity.

Bug: 175181773
Test: Run robotest and apply the widget in Settings and see the ui

Change-Id: I3add3702e9058ad9192b5172c7cf0e2ccfb55a70
2021-01-14 22:48:31 +08:00
jasonwshsu
9f54ab9afa Redesign roles of variable mUserShortcutTypesCache & mUserShortcutTypes
* mUserShortcutTypesCache -> get value from savedInstanceState only
* mUserShortcutTypes -> use local variables to replace its mission

Bug: 158540780
Test: atest ToggleFeaturePreferenceFragmentTest
Change-Id: I1473f89ed743261f616e8d19733bae829c9dbb02
2020-11-05 14:24:09 +08:00
jasonwshsu
48b546eccf Extract UserShortcutType functions from ToggleFeaturePreferenceFragment
* Simplify StringJoiner to '+' since it only have one case
* Simplify Collections usage to use removeIf() and findFirst() directly
* Change class name SharedPreferenceUtils to PreferredShortcuts

Bug: 158540780
Test: atest ToggleFeaturePreferenceFragmentTest
Test: atest PreferredShortcutsTest
Change-Id: I02f03ccba09b6d7edaa5c0c8223ab3561a5e976b
2020-10-09 00:34:04 +00:00
jasonwshsu
26f1b5f65c Add data class PreferredShortcut to replace inner class UserShortcutType
* Add basic function equals(), hashcode() into data class
* Change flatternToString() to toString()
* Change constructor to fromString(flatternToString)

Bug: 158540780
Test: atest PreferredShortcutTest
Change-Id: I0ee46dd940d22ff9f168b95fe75d9cff2f0fddfb
2020-10-08 10:53:48 +00:00
jasonwshsu
1a1ae82460 Modify flow in ToggleFeaturePreferenceFragment
* Show edit shortcut dialog should belong to the basic feature, so move
them back to ToggleFeaturePreferenceFragment
* Add test cases for UserShortcutType to prepare to further refactor

Bug: 158540780
Test: atest ToggleFeaturePreferenceFragmentTest
Change-Id: Ia84bea5581f85d199f395b2065652ce69738abbf
2020-09-26 04:30:04 +00:00
PETER LIANG
f92160da4a Merge changes from topic "color_correction_b_148785841"
* changes:
  Fix the screen will move by itself when enabled Color correction.
  Refine and migrate the functions that related to update preference into the specific lifecycle.
2020-08-19 07:51:41 +00:00
Peter_Liang
6a893a54b6 Refine and migrate the functions that related to update preference into the specific lifecycle.
Goal:
Avoid the screen to be scrolled or moved by itself after changing theme.

Bug: 148785841
Test: make RunSettingsRoboTests ROBOTEST_FILTER=ToggleFeaturePreferenceFragment
&& make RunSettingsRoboTests ROBOTEST_FILTER=ToggleScreenMagnificationPreferenceFragmentTest

Change-Id: I35a41a920194d6de01b635ce4c8461df2635ce1a
2020-08-13 15:04:12 +08:00
Edgar Wang
21f8cb3a44 Refactor Reset options Settings
Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: robotest & manual
Change-Id: I94969f6903d047b9bc41b1e8c14096c92c460b38
2020-08-04 23:33:50 +08:00
jasonwshsu
b137e7a6e5 Change to use CaseMap.toTitle in shortcut type summary to handle different locale.
Bug: 153850193
Test: manual test
Change-Id: I6b4583d0b42a0019dfae9442536f6ed752ccc409
2020-05-18 13:27:46 +08:00
Peter_Liang
b3d5df4989 Add the settings content observer for shortcut preference.
Root cause:
Didn't update the UI when settings value chagned.

Next:
Add the settings content observer.

Bug: 155837154
Test: manual test & Robo test & atest
Change-Id: I7be952a3a8824d00d3903d4a69beb8f992d638a1
2020-05-13 14:43:20 +08:00
Edgar Wang
7e70ef64d4 Revert "Add the settings content observer for shortcut preference."
This reverts commit 785af0c15a.

Bug: 155837154

Reason for revert: robolectric test fail at com.android.settings.accessibility.ToggleFeaturePreferenceFragmentTest

Change-Id: If8e5681b044171ad6941307489526cc3834f66b2
2020-05-13 03:45:39 +00:00
Peter_Liang
785af0c15a Add the settings content observer for shortcut preference.
Root cause:
Didn't update the UI when settings value chagned.

Next:
Add the settings content observer.

Bug: 155837154
Test: manual test
Change-Id: Icee0bb50f88987ea6c8a0be59bd936628a32ca1e
2020-05-12 14:15:54 +08:00
menghanli
de1258f9cf Fix InvisibleToggle type service does not turn on or turn off correctly when edit shortcut dialog.
Root cause: service status is not updated after the shortcut status
changed.

Next: Add callback to update the service status

Bug: 155157599
Test: Manual test
Change-Id: I286a04d43066c787304c54eb7b0dfdac5728b6ac
2020-04-29 13:44:54 +08:00
Peter_Liang
72aa60ae95 Tutorial improvement for Accessibility shortcut (2/n).
Update UI widgets to meet the new design.

Bug: 148989018
Test: manual test
Change-Id: Ife42995af193db6746135d29f6fa1ad452d265a6
2020-04-23 12:18:26 +08:00
Peter_Liang
cfe3e454ac Tutorial improvement for Accessibility shortcut (1/n).
Because can't save the value into setting keys for the service before version R, and in order to let tutorial dialog can get the consistent value, using alternative that each fragment with shortcut to must implement the new abstract method.

Bug: 148989018
Test: manual test
Change-Id: Iba2a7daa70eb00f0bba37317c9355531fbb77628
2020-04-23 12:18:23 +08:00
jasonwshsu
f74c0a72b6 Show default description only if description and html description are empty
* AccessibilitySettings only get the description to pass to the
ToggleFeaturePreferenceFragment
* ToggleFeaturePreferenceFragment handle the default description logic

Bug: 154092127
Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.accessibility.AccessibilitySettingsTest"
Change-Id: I516a393aeef1472ca5d185d477a2b0b108fc5342
2020-04-21 01:34:22 +00:00
jasonwshsu
1be2666d11 Remove unused attribute 'EXTRA_SUMMARY_RES'
* Magnification already use EXTRA_HTML_DESCRIPTION to replace it.

Bug: 154092127
Test: manual test
Change-Id: I5385907eb0911894159a80444493bf233bb43e1a
2020-04-20 23:09:59 +08:00
Peter_Liang
58cc3ea7f9 Revising the function name related to user shortcut type.
Should add 's' into the name.

Bug: 148989018
Test: manual test
Change-Id: I46aadb80f4f28dc1794fc3313563c79be149e847
2020-04-15 17:43:05 +08:00
menghanli
bff36f7e8c Sets the scroll indicators for edit shortcut dialog.
- The indicators appears while content view is out of vision for vertical scrolling.

Bug: 142531156
Test: local test
Change-Id: Ifa1966b1df7628029976d27d72d2ae63d84e28c3
2020-04-10 00:32:04 +08:00
jasonwshsu
bfc3201e84 Show empty options in shortcut chooser dialog if shortPreference is unchecked.
* Fix the magnification can not auto restore shortcut options.
* The shortcut chooser dialog behavior will be:
1. If user's toggle switch is turned off, and they open the shortcut chooser dialog, none of the options are selected. In this state, if user chooses some of the shortcuts and saves, these choices will be honored.
2. If user's toggle switch is turned off, and they turn on the switch without opening the shortcut chooser dialog, their previously-saved shortcut option is brought back (e.g. if I previously used a11y button, I turn toggle switch off and then on again, I still have a11y button).
3. If user's toggle switch is turned on, and they open the shortcut chooser dialog, their previously-saved shortcut options will be shown.

Bug: 152539702
Bug: 153042341
Test: manual test
Change-Id: Ic109b3363eaf00ba77ce0ed05f4ec11517b1367e
2020-04-02 15:38:11 +08:00
menghanli
bd09e28a84 Enlarge the touch area of edit shortcut dialog
Bug: 148837311
Test: Manual test
Change-Id: I54ca93ccaa87514bf4d201b95ed855003d1c164c
2020-03-25 11:20:32 +08:00
menghanli
5d7083a103 ShortcutPreference Toggle design (2/n)
- Removes edit shortcut disable condition.
- Shows "off" if user removes all items in edit dialog.
- Restores last time what user chosen options when show edit dialog.

Bug: 148989269
Test: Manually test
Change-Id: I105abda782999d38c92e3de9811e2fd378869e73
2020-03-06 18:02:53 +08:00
menghanli
919e555a51 ShortcutPreference Toggle design.
- For target SDK < 30 app show as preference item to trigger shortcut on/off.
- For target SDK >= 30 app show two item: the left one can edit shortcut and the right one be a on/off trigger button.

The design is reference from WIFI setting which has similar comportment.

Bug: 148989269
Test: Test result in Buganizer.

Change-Id: I815206d9e885c01bf3e6445820176aed4a743323
2020-03-03 17:31:27 +08:00
Peter_Liang
ab05476fc1 Fine-tune the widget of "Allow rich content in Accessibility Settings" for security.
1. Remove tag checker in HtmlTextPreference.
2. Set the max height for AnimatedImagePreference.

Bug: 149516547
Test: manaul test
Change-Id: I98f49d055db9427d91a3f1ca816e94a11d29cd3d
Merged-In: I98f49d055db9427d91a3f1ca816e94a11d29cd3d
(cherry picked from commit 10bc375176)
2020-02-25 09:06:12 +00:00
Menghan Li
9d664e3c90 Merge "Use a configurable default if the setting has never been set." 2020-02-16 00:38:50 +00:00
menghanli
655551841a Use a configurable default if the setting has never been set.
AccessibilityManager#getAccessibilityShortcutTargets may not return
correct shortcut targets during boot. Needs to read settings directly.

Bug: 149293174
Bug: 147989561
Test: Manual test
Change-Id: Ia8997b08d11da78dab5cd568787e9c61b0b0eeab
2020-02-16 00:38:31 +00:00
jasonwshsu
78400244af Fix the animated image can not be displayed.
* Need to process arguments earlier.

Bug: 142528112
Test: Manual test
Change-Id: I63e116e47ccdb6409969f629b41b8c3622adb9dc
2020-02-15 15:53:45 +08:00
menghanli
5638acbc82 Use HTML text preference for rich content
Implements for Color Correction, Color Inversion, and Magnify

Bug: 148837311
Test: Manual test
Change-Id: I5e5b311b6ae8e42cca3ef9048c8b8b0de52d13bc
2020-02-12 19:12:26 +08:00
Peter_Liang
68d701db97 Update the rich content UI to meet the UX design version 2.
1. Using the footerPreference component for the interface
android:desription.
2. Remove the redundant and unused codes.
3. Remove the ripple effect for AnimatedImagePreference.

Bug: 142532186
Test: manual test
Change-Id: I547ed7611b40d8b7bee4c4350b00bd4987768950
2020-02-08 13:49:06 +08:00
menghanli
6eb3912f31 Accessibility Service & Shortcut Redesign - Primary action - toggle button design
Implements DividerSwitchPreference to replace ToggleSwitch

Bug: 142528112
Test: Manual test

Change-Id: I0d80d16bfa941f7ee333a2c5680a25a26c42809d
2020-02-07 20:49:13 +08:00
menghanli
4705d87c4a Update the shortcut design strings.
Bug: 148837311
Test: Manual test

Change-Id: Iac96b3f36e4298aea36bbde5632f701ad1e9572d
2020-02-07 14:23:22 +08:00
menghanli
c240b27862 Add back "Tapping Stop will stop x" dialog while turning off an accessibility service
Bug: 146539308
Test: make RunSettingsRoboTests2
Change-Id: Ic572f9245db016bd79a272030f97004a21f4b672
2020-02-03 19:17:34 +08:00
menghanli
8e881181a8 Fix "Cannot get activity context when service off".
1. Unify getPrefContext() usage in Accessibility Settings
2. Correct the dialog emuns order

Test: local test
Change-Id: Idc51f7b15b5813bbae7b32e1ae3c7f00c71cea50
2020-02-03 07:13:31 +00:00
menghanli
b82931520f Support accessibility shortcut secondary action (11/n)
Refactor current shortcut design to base fragment and provide
protected function to customize the legacy design,
magnification or no need shortcut app.

Bug: 142530063
Bug: 142531156
Test: make RunSettingsRoboTests2

Change-Id: I51c951ef8f819a1940ddfe33b009b40ed5ec0530
2020-02-02 10:51:44 +08:00
menghanli
87147f55f0 Support accessibility shortcut secondary action (9/n)
Reorder layout and add title for each category block.

Bug: 142530063
Bug: 142531156
Test: make RunSettingsRoboTests2
Change-Id: I0f4067aaf9c42c3ce065eebd0e75ad4153f7e9dc
2020-01-18 00:24:20 +08:00
menghanli
097472fc4a Talkback shouldn't speak action for description.
Fix for Select-To-Speak, Talkback, and Magify app.

Bug: 147793421
Bug: 147709365
Bug: 147708796
Test: Manual test
Change-Id: Id7b62c96df869cbd35f2ffbb442b0a4eb7e0393d
2020-01-17 16:10:21 +08:00
menghanli
334dc4f20b Support accessibility shortcut secondary action (7/n)
Implements sharedPreference to keep the user preferred shortcut for each
service.

Bug: 142530063
Bug: 142531156
Test: make RunSettingsRoboTests ROBOTEST_FILTER=ToggleFeaturePreferenceFragmentTest
Test: make RunSettingsRoboTests2
Change-Id: I2a7c54ddc32764f6d88f2efed87982d469acc183
2020-01-13 12:34:04 +08:00
Peter_Liang
64f1374c64 Support the rich content for accessibility service (1/n)
Goal: 1. let third party developer can use html text that include from their local image file and
         animated image instead of only plain text to rich their content.
      2. Avoid malicious links made by third party developer

Action: 1. Add html, static text, and animated image preferences.
        2. Add android:AnimatedImageDrawable, and android:htmlDescription attributes.
        3. Fine-tune interface and integration
        4. Add custom tag filter

Bug: 136292241
Test: Maunal & make RunSettingsRoboTests
Change-Id: I82cd5319efb7faa1ff7e8354a279828fce5135b8
2019-11-27 20:42:39 +08:00
Kevin Chang
a6308c09a8 Change string of switchbar and installed service category title
Bug: 122897712
Test: Visual
Change-Id: I0f56b4b7375e651a74189dd17e6b3bd8b99ccfca
2019-10-14 11:05:59 +08:00
Sunny Shao
8eef6edfc1 Use FooterPreference in xml explicitly
Removed the FooterPreferenceMixin from the ToggleFeaturePreferenceFragment page.

Fixes: 139400387
Test: manual test
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.accessibility
Change-Id: I8a61ddf2be500e3dc3b1a9503a7a671a5538c537
2019-08-14 16:53:47 +08:00
Yanting Yang
1303790f40 Fix text format issue in the Accessibility magnification
- Use getText() to apply html format to text view.
- Remove extra bullets from string.

Fixes: 138174003
Test: visual, robotests
Change-Id: Ia736087224d7a65ebe41ca2ac3fca7064a03f950
2019-07-23 17:37:31 +08:00
Fan Zhang
23f8d59d02 Sort imports
Having consistent import order will reduce chance of merge
conflict between internal and external master

Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
2018-08-28 22:13:15 +00:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Doris Ling
d63e19aa1d Fix footer text not translated in Magnification settings. am: b0877b390d
am: 84506b36c5

Change-Id: Iab1c7df7fb56b76f3dcacc13608d23bbdcfeda51
2018-04-23 19:00:53 -07:00
Doris Ling
b0877b390d Fix footer text not translated in Magnification settings.
- pass in the summary res id instead of the actual text when building
the launch bundle for the magnification settings.
- remove the title argument as we are passing the title res already,
which takes precedence.

Change-Id: I4ba624e1d9722aa980ea94c306df9a015a159555
Fixes: 78126057
Test: run i18nscreenshots
2018-04-23 17:07:32 -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
87d120a7e1 Override switch bar string for wifi/battery saver screen
Bug: 69462439
Test: visual
Change-Id: I18d03ee1664f111222d7b9bb7ee893e4ce0e1343
2018-01-11 15:17:14 -08:00
Doris Ling
4a01283309 Remove the feature flag for using new title.
- remove all code that check for the feature flag, and use the new logic
by default.

Change-Id: I7fbe60da84c1c0f35e7241402a71d2bc4cd300e6
Fixes: 64564191
Test: make RunSettingsRoboTests
2017-11-13 17:58:13 -08:00
Doris Ling
024668a2c5 Remove duplicate preferences in Accessibility settings.
- addPreferencesFromResource() call has been added to
InstrumentedPreferenceFragment, and hence sub-class should not call it
again.

Change-Id: Ia016d9d407ac3f838c962d1ced585647382a051a
Fixes: 68820835
Test: make RunSettingsRoboTests
2017-11-02 18:12:27 -07:00
Doris Ling
ed4685fafb Update activity titles for fragments without preference screen.
1. Move getPreferenceScreenResId() from individual subclass to
InstrumentedPreferenceFragment.

2. Removed InstrumentedPreferenceFragment.getTitle() and let the
preference fragments that do not have preference screen set the activity
title directly instead.

3. Removed OptionsMenuFragment as all it does is call
setHasOptionMenu().
- changed subclasses of OptionsMenuFragment to extend from
InstrumentedPreferenceFragment directly.
- none of the exisitng subclasses actually implements the option menu
related methods to provide any option menu. So, the setHasOptionMenu()
call is not added to the subclasses.

4. Update Languages preference title.
- launch the fragment from the preference controller instead of from the
default handling, as we need the title res id at launch time to get it
work properly when retrieving the title from back stack.

Bug: 64564191
Test: blaze-bin/screenshots/android/i18nscreenshots/i18nscreenshots
Change-Id: Ibecdcab32cbaed8bf604ec5ebe0a926b4e489a7d
2017-10-26 12:01:06 -07:00