Commit Graph

48 Commits

Author SHA1 Message Date
Chun-Ku Lin
919019ca56 [Flag cleanup] edit_shortcuts_in_full_screen is always on now
- Cleaned up the code that won't be executed when the flag is on
- Remove unused resources

Bug: 300302098
Test: Manually verify the user can change the shortcut type, and the
changes are saved
Test: atest com.android.settings.accessibility
Flag: EXEMPT removing com.android.settings.accessibility.edit_shortcuts_in_full_screen

Change-Id: I1e32b724ca3da909feda55e20fb1d51dc4680c09
2024-07-25 22:49:02 +00:00
Riley Jones
8f313621aa Refactoring Accessibility settings to use ShortcutConstants.UserShortcutType
This removes AccessibilityUtil.UserShortcutType,
replacing all mention of it with ShortcutConstants.UserShortcutType

NO_IFTTT=UI order not changed
Test: atest com.android.settings.accessibility
Bug: 322014084
Flag: EXEMPT internal refactoring

Change-Id: I18695d040c4bd08a455143594e770adda2b1a8de
2024-07-01 19:42:32 +00:00
Chun-Ku Lin
dd915a5031 Clean up usages of flag remove_qs_tooltip_in_suw
This bug-fixing flag has been in Trunkfood in two months.

Test: existing presubmit (no functional change)
Bug: 294560581
Change-Id: I05282f1f7ee6b1bb4e4bf873771d80ae68204b4c
2024-04-01 20:13:01 +00:00
Fan Wu
c788a90669 Remove all LooperMode.LEGACY usages from settings/accessibility
Bug: 331124680

Test: atest
Change-Id: I21cc137358e5cb29c16aeda0b744f36d9f8bf010
2024-03-25 11:42:34 +08:00
Chun-Ku Lin
deba8599d8 Reflect QS shortcut changes in a11y pages.
Bug: 314843909

Test: manual (modify qs tiles in QS panel while the a11y page is open,
verify the a11y page reflect the qs changes)
Test: atest com.android.settings.accessibility
Test: atest com.android.settings.accessibility.shortcuts

Flag: ACONFIG android.view.accessibility.a11y_qs_shortcut

Change-Id: Ie5b46459faab902912a214ca131eb5d0b105a7ef
2024-03-12 01:32:00 +00:00
Chun-Ku Lin
8b67c17a7b Show QS shortcut option if the a11y feature provides a tile.
Bug: 314852953
Test: atest com.android.settings.accessibility
Test: atest com.android.settings.accessibility.shortcuts
Test: manual
Flag: ACONFIG android.view.accessibility.a11y_qs_shortcut STAGING
Change-Id: Id7a6b3adfd4c4f3cb2b9f7fe15269b57a3d00543
2024-03-06 20:26:28 +00:00
Chun-Ku Lin
1d1b9e451f Move the default shortcut types in a separate utility method.
Bug: 322701168
Test: atest
Flag: N/A (Strict mechanical refactors, no behavior change)
Change-Id: I1beb36e5aeeec0f303228b57baf034a000a72b75
2024-01-29 02:17:49 +00:00
Chun-Ku Lin
0f2cc34230 Don't show quick settings tooltip if the user is in the Setup Wizard,
since the user can't access the Quick Settings Panel.

Bug: 294560581
Test: manual
- Turn on feature flag: adb shell device_config put accessibility com.android.settings.accessibility.remove_qs_tooltip_in_suw true
- Modify the font scale in SUW, verify the QS tooltip doesn't show up
- Modify the font scale after SUW, verify the QS tooltip shows up
Test: atest SettingsRoboTests:com.android.settings.accessibility

Change-Id: I1d1a4f8f70ea3e1d929952d5c273de1b4cd80503
2023-11-14 23:30:49 +00:00
Daniel Norman
8946e64f28 Adds 'App info' button on accessibility service + activity pages.
This launches the existing app info page for the a11y feature's owning
package. Features without a valid component (framework features) do not
have this button. This is also not shown in Setup Wizard which does
not support the App Info page.

This helps users find more info about the app that provided an
accessibility feature.

Screenshot: https://screenshot.googleplex.com/B9FXLoomxFjLBv8.png
Flag: accessibility com.android.settings.flags.accessibility_show_app_info_button

Bug: 277378550
Test: atest ToggleFeaturePreferenceFragmentTest (robotest)
Test: Open and interact with the button, ensure it opens the app info
      page for the correct app.
Change-Id: I2041c09077ce5fadc72117dc0c72409dd33ef60b
2023-10-20 21:31:11 +00:00
Rex Hoffman
3c961e1c0e Setup external/robolectric for SettingsRoboTests
Current failing tests: ab/I64100010182936387
Had to Ignore some of com.android.settings.accessibility tests, which will be fixed separately

Bug: 261728063
Test: atest SettingsRoboTests -- --test-arg com.android.tradefed.testtype.IsolatedHostTest:java-flags:-XX:CompressedClassSpaceSize=3g

Change-Id: I4a0cb992db924936826e0c9808accc78dddb5f30
2023-08-17 22:33:20 +00:00
Chaohui Wang
2541381259 Fix references to resources for Settings
Bug: 293810334
Test: m Settings
Change-Id: Ie140278f492ef7e1c062ec1ecae2866c521a86aa
2023-08-08 01:56:05 +00:00
Chun-Ku Lin
c7cd3783ba Fix ToggleFeaturePreferenceFragmentTest#setupFragment_getExpectedPreferenceScreenResId
**Root cause**
Robolectric doesn't like to launch a spy'ed fragment. You will get an
error like java.lang.IllegalStateException: Can't access ViewModels from detached fragment

Since the test itself doesn't require launch a fragment, I removed the
setup part and renamed the test.

Bug: 279082331
Test: atest ToggleFeaturePreferenceFragmentTest
Change-Id: Iafc431fd8c9cf7812ea99164e5e85683f3e0c121
2023-06-02 22:52:13 +00:00
Daniel Norman
203d362d2d Stops @Ignore-ing a11y robotests.
Our team is trying to determine the state of our tests in automation,
which is tough to do when some tests are skipped completely.

A11y SettingsRobotests are currently run only in postsubmit, so even
if the Ignored tests fail it should not cause presubmit issues.

Bug: 279082331
Test: Use go/abtd to ensure tests run (and some fail)
Change-Id: I767b25427e748b7e94ab05e81a2f645f8b6279cf
2023-05-19 21:32:19 +00:00
jasonwshsu
ce487188a0 Fix TalkBack shortcut keeps showing enabled when entering into that page.
Root Cause: TextUtils.isEmpty() will return true both null and empty case, and write config key into it.

Solution: Write config key only if settings key is null. That means no one (developers or users) touch the key ever, so we should respect config key here.

Bug: 255912415
Test: make RunSettingsRoboTests ROBOTEST_FILTER=ToggleFeaturePreferenceFragmentTest
Change-Id: I092975ea3de8fce78b7ae2a6241a30f6af8125a6
2022-11-10 12:21:04 +00:00
Treehugger Robot
9040efdccc Merge "Fix errorprone warnings that should be errors" am: 5744d7c560 am: 7094507528 am: 778ef161bb
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2255054

Change-Id: I1f3cbce7d5de6e63477bc2da2ad115ec53b06472
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-01 00:02:10 +00:00
Cole Faust
43ff89802c Fix errorprone warnings that should be errors
This commit is part of a large scale change to fix errorprone
errors that have been downgraded to warnings in the android
source tree, so that they can be promoted to errors again.
The full list of changes include the following, but not all
will be present in any one individual commit:

BadAnnotationImplementation
BadShiftAmount
BanJNDI
BoxedPrimitiveEquality
ComparableType
ComplexBooleanConstant
CollectionToArraySafeParameter
ConditionalExpressionNumericPromotion
DangerousLiteralNull
DoubleBraceInitialization
DurationFrom
DurationTemporalUnit
EmptyTopLevelDeclaration
EqualsNull
EqualsReference
FormatString
FromTemporalAccessor
GetClassOnAnnotation
GetClassOnClass
HashtableContains
IdentityBinaryExpression
IdentityHashMapBoxing
InstantTemporalUnit
InvalidTimeZoneID
InvalidZoneId
IsInstanceIncompatibleType
JUnitParameterMethodNotFound
LockOnBoxedPrimitive
MathRoundIntLong
MislabeledAndroidString
MisusedDayOfYear
MissingSuperCall
MisusedWeekYear
ModifyingCollectionWithItself
NoCanIgnoreReturnValueOnClasses
NonRuntimeAnnotation
NullableOnContainingClass
NullTernary
OverridesJavaxInjectableMethod
ParcelableCreator
PeriodFrom
PreconditionsInvalidPlaceholder
ProtoBuilderReturnValueIgnored
ProtoFieldNullComparison
RandomModInteger
RectIntersectReturnValueIgnored
ReturnValueIgnored
SelfAssignment
SelfComparison
SelfEquals
SizeGreaterThanOrEqualsZero
StringBuilderInitWithChar
TreeToString
TryFailThrowable
UnnecessaryCheckNotNull
UnusedCollectionModifiedInPlace
XorPower

See https://errorprone.info/bugpatterns for more
information on the checks.

Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I29f691a22617b1fc834680ff1cf4ab4244203f06
2022-10-23 12:41:39 -07:00
Wei Wang
fcd3c608bf Ignore all failing tests in Settings for now in order to unblock ATP V2
migration

Test: m RunSettingsRoboTests passed on desktop
Change-Id: I2450aaa083aabdf224e070f588441bb01206972b
Bug: 252671269
2022-10-13 17:29:36 +08:00
jasonwshsu
8145631ab8 Migrate to DashboardFragment in ToggleFeaturePreferenceFragment
Root Cause: ToggleFeaturePrefreferenceFragment becomes heavy when more and more features come in.

Solution: Mirgrate to DashboardFragment, a plugin-style preference controllers, can help us separate the preference and its logic into its own controller.

* This is the first step for the whole migration. Change to extend DashboardFragment and fill up the missing override functions.
* Reorder fields and functions to the recommended general approach.

Bug: 171272809
Test: make RunSettingsRoboTests
ROBOTEST_FILTER=com.android.settings.accessibility

Change-Id: I852091700a4b3b3c7bbdbc82f0b5dc47c087d61c
2022-07-13 00:40:55 +08:00
PETER LIANG
d4cd689c8f Merge "Fix that holding volume buttons to activate Extra dim feature doesn't do anything." into tm-dev 2022-03-25 14:06:00 +00:00
Peter_Liang
f94762176f Fix that holding volume buttons to activate Extra dim feature doesn't do anything.
Root cause:
Original framework design which has 3 seconds restriction to prevent users from easily triggering the accessibility volume shortcut when first time using it.

Solution:
The system would bypass the 3 seconds restriction if users manually set any feature as the volume key shortcut.

Bug: 202602908
Test: make RunSettingsRoboTests ROBOTEST_FILTER=ToggleFeaturePreferenceFragmentTest
Change-Id: I324321577263904b6ff8b66e411766d16a6430dc
2022-03-17 15:49:45 +08:00
menghanli
466ee402bf Fix no response after Talkback users double-tap on Learn more in Accessibility pages
Root cause: The ag/16569955 to fix unknown items issue when using Switch Access by grouping of related content. The design change impacts AccessibilityFooterPreference#setLinkEnabled that call TextView#setMovementMethod to change components can be focusable to break the grouping relation.

Solution: Reset summary view to nonFocusable after applied TextView#setMovementMethod.

Bug: 221342261
Bug: 221339524
Bug: 223526982
Bug: 215792117
Bug: 215792876
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AccessibilityFooterPreferenceControllerTest AccessibilityFooterPreferenceTest ToggleFeaturePreferenceFragmentTest
Change-Id: I4a051ea036ded264ee7bf615375177db796f74c7
2022-03-16 06:13:20 +08:00
menghanli
99a9171108 Customized accessibility framework features quick setting tooltips content
- Lowercase for one-handed mode, color correction, color inversion, extra dim in quick settings tooltips if these words are not first words.

Bug: 220655084
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AccessibilityShortcutPreferenceFragmentTest ToggleFeaturePreferenceFragmentTest LaunchAccessibilityActivityPreferenceFragmentTest ToggleAccessibilityServicePreferenceFragmentTest
Change-Id: I309ca48cecb80942112c9d5adde5857c062706c8
2022-03-10 06:40:54 +08:00
menghanli
426e781f19 Accessibility framework & Settings to support the Android accessibility intro & footer
- Implements a TopIntroPreference into the Accessibility Settings base fragment.
- Creates a protected API or variable to provide content to support if needed.

Bug: 218407398
Test: make RunSettingsRoboTests ROBOTEST_FILTER=ToggleFeaturePreferenceFragmentTest
Change-Id: Id0f7700bb8f62960951913db8bd034fce1b15a90
2022-02-13 07:25:47 +08:00
menghanli
ba9f097b03 Integrate Accessibility quick setting tooltips widget into ToggleFeaturePreferenceFragment
- Show tooltips when main switch is on
- Reshow tooltips when rotate device
- Add abstract functions for child components to show tooltips

Bug: 210356011
Test: make RunSettingsRoboTests ROBOTEST_FILTER=ToggleFeaturePreferenceFragmentTest
Change-Id: I543d8af7d24a9fc82659625961850f975a7a0787
2022-01-26 07:54:57 +08:00
Daniel Hsieh
55bc49860b Refactor SettingsContentObserver and add it to follow typing feature.
Refactor SettingsContentObserver and rename it to
AccessibilitySettingsContentObserver. Besides, we register it to observe
follow typing feature preference value.

The reasons behind refactor:
1. We change callback signature due to the consistency for register it
by preference key, not by Uri.
2. We refactor the default preference key to a seperate method. Since
the default value is related to accessibility, we rename it with
accessibility prefix.
3. We can register different callback for difference collections of
preference keys.

Default preference keys: They existed in the previous constructor.
1. Settings.Secure.ACCESSIBILITY_ENABLED
2. Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES

Bug: 194668976
Test: make RunSettingsRoboTests ROBOTEST_FILTER=
           AccessibilitySettingsTest
           AccessibilitySettingsContentObserverTest
           AccessibilityShortcutPreferenceFragmentTest
           MagnificationFollowTypingPreferenceControllerTest
           ToggleFeaturePreferenceFragmentTest
           ToggleScreenMagnificationPreferenceFragmentTest
Change-Id: Iafd27e044ebe2536ae7ae55c1c80af54f7f0f822
2022-01-20 08:38:27 +00:00
menghanli
e771cbb1aa Add AccessibilityShortcutPreferenceFragment to share non-accesibility tools to add shortcut
Bug: 190022774
Test: make RunSettingsRoboTests -j52 ROBOTEST_FILTER=AccessibilityShortcutPreferenceFragmentTest
Change-Id: I1cae8fbed059ba7c309126e2dff46adfb48cffd8
2021-06-08 22:58:05 +08:00
menghanli
78c093b0b3 Move DialogEumn into AccessibilityDialogUtils
Bug: 190022774
Test: Manual testing
Change-Id: I391089b675b415c26bbacd028caf1d1ab617e707
2021-06-07 13:38:50 +08:00
menghanli
1a83638592 Fix the link text "Learn more" in the accessibility pages with help links could not convey the link's purpose clearly
Root cause: A long content textview shows the accessibility service info and learn more link. User cannot double click to open help link. They need to swipe up and right to pops up dialog to move to next page. But, the dialog show the "Learn more", it is not clear for user to idendify what the link page.

Solution: Add another textview to show the "Learn more" and provides more clear content description for this link. Also, user just need to double click to activate it.

Bug: 188603037
Test: make RunSettingsRoboTests -j52 ROBOTEST_FILTER=AccessibilityFooterPreferenceTest
Change-Id: Ia9a56f11bbd235ae3a698fcb2e1a2fcff64ef940
2021-05-25 15:51:45 +08:00
menghanli
11a0700847 Fix style in "Vision Settings" is inconsistent
Root cause: "Accessibility button" page apply BC style but other pages in SUW didn't. It causes page style inconsistency.
Solution: Don't show annotation link to make user open "Accessibility
button" page during SuW.

Bug: 187658718
Test: Manual testing
Change-Id: I6cc3da9a72b68829efd5537ae93fc329ef716fb4
2021-05-12 07:16:05 +00:00
menghanli
cdcc3ae52c [Material Next] Update accessibility tool footer style
1. Implement API extends Material Next FooterBarPreference and support Accessibility API for icons
2. Apply solutions to accessibility tools and framework tools in
accessibility settings page.
3. Apply DashboardFragment for Caption preference for xml parser

Bug: 185973304
Test: make RunSettingsRoboTests -j52
Change-Id: I6b80bc80190d6666e3fbcd462442a9f2c0e60bba
2021-04-30 07:19:29 +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
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
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
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
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
James Lemieux
f1dade40d2 Use binary resource support in robolectric
The resources available to tests are now exactly the merged resources
located in the APK under test.

Bug: 74359828
Test: make -j56 RunSettingsRoboTests
Change-Id: I050db81a92decefea23314b5ec7a62f77ff4bb2b
2018-12-12 19:53:49 -08:00
tmfang
c28c836dcb Remove FragmentUtilsTest class
We directly use FragmentController to start fragment.

Change-Id: Iff78f321165d666f96d84f001ff054257a1aaede
Fixes: 111195449
Test: robotest
2018-09-27 18:51:20 +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
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
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
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
jeffreyhuang
cbfb099a40 Rename SDK_VERSION_O to SDK_VERSION
Test: make RunSettingsRoboTests -j40
Change-Id: I6715062d8addadda441e32809db1af55f15e3a90
2017-12-05 16:43:54 -08:00
jeffreyhuang
cafc84d2d0 Move accessibility package to sdk 26
Test: make RunSettingsRoboTests -j40
Change-Id: I6fa70ec4da82e29934a21cd5780175aa510b5d62
2017-11-22 11:21:29 -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