Commit Graph

538 Commits

Author SHA1 Message Date
Chun-Ku Lin
b65108ba1b Split the string resource id for non-generic accessibility preference.
- Keep the accessibility settings strings the same as in U.

Bug: 289425138
Test: manual
Test: atest
Change-Id: Iddbbfe627c93529d2421e153094a30628229c4bc
2023-08-08 19:17:54 +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
Angela Wang
940e02b807 Show connecting hearing devices in A11y hearing devices page
We only show connected hearing devices in the hearing devices page now.
When user pairing a device from pairing page and back to the hearing
devices page after the device is bonded, it's confusing no device shown
in the list because the device is still connecting to profiles. We
should show the connecting device to avoid confusion.

Bug: 283268686
Test: make RunSettingsRoboTests ROBOTEST_FILTER=DeviceListPreferenceFragmentTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AvailableHearingDeviceUpdaterTest
Change-Id: Id3b29c12b80c282736a3e6ca73bcf317e0652b89
2023-07-18 04:30:59 +00:00
Jean Chen
9a2e9c966b Merge "Set the shortcut size to large when user enabled Magnification" into main 2023-07-11 07:43:01 +00:00
Jean
137cc9af68 Set the shortcut size to large when user enabled Magnification
Set the settings shortcut size to large when the Magnification shortcut it enabled. Provide users with the large size as the default, which is easy to see.

Bug: 283844702
Test: manually - attach videos in the bug
Test: atest ToggleScreenMagnificationPreferenceFragmentTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=ToggleScreenMagnificationPreferenceFragmentTest
Change-Id: I8fac5780b8388b1b4f124cffbdd305235f035e72
2023-07-11 02:21:09 +00:00
Chun-Ku Lin
79ffa2a45f Merge "use L10n-friendly runtime number formatting based on locale" into main 2023-07-06 17:09:25 +00:00
Daniel Norman
8f5c6d06b5 Stop asserting on internal PackageMonitor details.
Fix: 289324081
Test: SettingsRoboTests
Change-Id: Ia4cdd3b4e994786ba2cbc3045c181eb9339f12d7
2023-06-29 19:15:25 +00:00
Chun-Ku Lin
20976c3a53 use L10n-friendly runtime number formatting based on locale
Arabic use Western or Eastern numbers depends on the regions.

Bug: 276479321
Test: atest AccessibilityButtonFooterPreferenceControllerTest
Test: manual
Change-Id: I855f4fd891893b094163b0d479bdf3e5155dffc1
2023-06-29 02:48:32 +00:00
Treehugger Robot
1d070021c0 Merge "Use FakeTimer in test to avoid flakiness." 2023-06-16 00:10:11 +00:00
Chun-Ku Lin
802978fd80 Use FakeTimer in test to avoid flakiness.
**Root cause**
ScreenFlashNotificationColorDialogFragment creates Timer which spawns
unmanageable threads for tests. Also, the test itself uses Thread.sleep
which makes it non-destermistic.

Bug: 279082331
Test: atest ScreenFlashNotificationColorDialogFragmentTest --iteration
20

Change-Id: Id49c8d402a0578f8297ca12fe49da304c7a988d8
2023-06-15 18:20:23 +00:00
Chaohui Wang
04d431cd8e Fix SettingsRoboTests am: 36dfb5ac0b am: 5ec794285e
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23696638

Change-Id: I7df4baf13f7c275c782b1181383d3a53aaa5e4cc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-15 10:38:57 +00:00
Chaohui Wang
36dfb5ac0b Fix SettingsRoboTests
Mock the getViewLifecycleOwner in test to fix.

Fix: 287387514
Test: m RunSettingsRoboTests
Change-Id: I346930e9655e4f78227276aee4c2a4e5ae6962e0
2023-06-15 16:33:05 +08:00
Chun-Ku Lin
24b045c987 Move DisplayDataSizeTest to AndroidJunitTest
**Root cause**
- When DisplayDataSizeTest was created, it was ignored already due to
b/214161063. That means the test never passed in the beginning.

- The default display's type in Robolectric is TYPE_UNKNOWN. However, in
the constructor of DisplayDensityUtils, we check all the display that is
not TYPE_INTERNAL can't be a default display. Hence the test failed.

- Even if we shadow the DisplayInfo to have TYPE_INTERNAL for default
  display, the test still failed, because whenever we tried to get the
  default display density we always get 0, and doens't have other diplay
  density values. Hence we can't test increasing the display size in
  Robolectric Test.

Note: the solution here is a workaround for waiting AsyncTask to finish.
If we ever change the implementation in DisplayDensityUtils to not use
AsyncTask, we'll need to update the test.

Bug: 279082331
Test: atest DisplaySizeDataTest --iterations 20

Change-Id: I3ccee5e7ba4d9399a8b715d84a9d53e106f88762
2023-06-07 00:06:48 +00:00
Treehugger Robot
7dd9e05701 Merge "Use spy to inject the return value of a boolean resource" 2023-06-05 17:29:36 +00:00
Chun-Ku Lin
7e868fa690 Use spy to inject the return value of a boolean resource
**Root cause**
The test was failing because it was not grabbing the boolean resource
from the values-mc999 folder. I'm not sure what changed in Robolectric
that causes it not able to find the resources based on the
qualifiers.

Bug: 279082331
Test: atest TopLevelAccessibilityPreferenceControllerTest
Change-Id: Ie738d1ada1a87b48f34efb7e0477c691c4d44d1e
2023-06-03 06:29:43 +00:00
TreeHugger Robot
2247bb0a0e Merge "Update the FlashNotificationsPreferenceFragmentTest to return correct metric category" 2023-06-03 05:52:27 +00:00
Chun-Ku Lin
0f0461518e Update the FlashNotificationsPreferenceFragmentTest to return correct
metric category

**Root Cause**
The test was written when the metric category is set to 0. After we
update the metric category to FLASH_NOTIFICATION_SETTINGS in the
FlashNotificationsPrefereenceFragment, we forgot to update the test.

Bug: 279082331
Test: atest FlashNotificationsPreferenceFragmentTest
Change-Id: Icd709bd9e571ca264226d0ca860e5c482eae3927
2023-06-03 04:56:22 +00:00
TreeHugger Robot
463fce7dae Merge "Pass the constant actionId directly when calling performAccessibilityAction" 2023-06-03 00:11:07 +00:00
TreeHugger Robot
e6b3ba84ca Merge "Fix ToggleFeaturePreferenceFragmentTest#setupFragment_getExpectedPreferenceScreenResId" 2023-06-02 23:47:08 +00:00
Chun-Ku Lin
de5809a4f6 Pass the constant actionId directly when calling
performAccessibilityAction

**Root cause**
When constructing an AccessibilityAction, robolectric's
ShadowAccessibilityAction uses reflection to get the private static
final variable `ACTION_TYPE_MASK` to check if the passed action is a
valid action.

However, since ag/I744b3a94fe3c3cc3b559758a95ab0b5b181155bb we renamed
the internal variable, hence robolectric is not able to find the
ACTION_TYPE_MASK variable when using reflection.

By passing the action id directly when calling
performAccessibilityAction, we don't need to use
ShadowAccessibilityAction anymore.

Bug: 279082331
Test: atest AccessibilityQuickSettingsTooltipWindowTest

Change-Id: Ie956de44c9b19a2d19470ad670866d77ca272b3b
2023-06-02 23:23:22 +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
Chun-Ku Lin
e63659e6db Fix AccessibilityButtonFragmentTest
**Root cause**
We expected the spy resources will be used when calling
context.getResources(). However, we didn't set up the connection. Hence
the test failed due to trying to use the original resources.

Bug: 279082331
Test: atest AccessibilityButtonFragmentTest
Change-Id: Ib6e51b2b2607bec7980b9288a0a8076e4a036863
2023-06-02 22:15:15 +00:00
TreeHugger Robot
cddd329f80 Merge "Fix ToggleScreenMagnificationPreferenceFragmentTest" 2023-06-02 19:39:07 +00:00
Chun-Ku Lin
0aea3ddb33 Fix AccessibilityHearingAidPreferenceControllerTest
**Root cause**
When adding a feature flag on showing different hearing aid page on
 click, the tests were not executed because they were marked as @Ignore.

In order to execute the test, we need to turn the feature flag off, so that the test run in the same scenario where the feature flag was not introduced.

Bug: 279082331
Test: atest AccessibilityHearingAidPreferenceControllerTest
Change-Id: If11ac40a7ea3926578992f7c0577e7cbb1bb3273
2023-06-02 06:47:38 +00:00
Chun-Ku Lin
c8c67d731f Fix ToggleScreenMagnificationPreferenceFragmentTest
- Prevent mocking ToggleScreenMagnificationPreferenceFragment for test
- Use Robolectric's way to launch the fragment so that the fragment
  contains necessary setup

**Root cause**
- We called onCreateView directly in the test without the necessary setup
  in onCreate, which causes the FooterPreferenceController not being
  initialized.
- We created a spyContext that returns a mock PackageManager, however,
  in the test execution, we didn't mock the context used by the fragment
  under test. Hence, the fragment didn't use the mock PackageManager in
  test.

Bug: 284209879
Test: atest ToggleScreenMagnificationPreferenceFragmentTest --iterations
5

Change-Id: I7e71a03177526f5bb0c20a58855a7dfdffc2a22f
2023-06-02 03:04:37 +00:00
Chun-Ku Lin
b34dcecc58 Adding ShadowBluetoothAdapter for the test
Many robotests that touches BluetoothAdapter might need to use our own
ShadowBluetoothAdapter which implements a "fake" getSupportedProfiles
call, so that the test won't trying to execute the android framework's getSupportedProfiles method.

Bug: 285235777
Test: atest AccessibilitySettingsTest

Change-Id: I5b3b2f4528a2b32aff22928653c57576981c0ff9
2023-06-01 17:50:10 +00:00
Angela Wang
6451a35d3e Merge "Shouldn't show pair another ear dialog if hearing aid supports CSIP" into udc-qpr-dev am: d91da4f4ca am: 4560d2f83b
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23412076

Change-Id: I782742799c995339e9f00ba2265acd84fb2ee3a6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-01 12:24:00 +00:00
Angela Wang
d91da4f4ca Merge "Shouldn't show pair another ear dialog if hearing aid supports CSIP" into udc-qpr-dev 2023-06-01 11:04:31 +00:00
Angela Wang
1bc59caf13 Shouldn't show pair another ear dialog if hearing aid supports CSIP
Some devices may supports both ASHA and CSIP. If the device supports
CSIP, it'll automatically pair the other ear and thus no need to pop up
the pair another ear dialog which is specially for ASHA device.

Bug: 283269736
Test: make RunSettingsRoboTests ROBOTEST_FILTER=HearingAidUtilsTest
Change-Id: I9a8e3876e2905b18b1c63e74f47c6877504ebdc8
2023-06-01 09:54:35 +00:00
Angela Wang
412f5fad85 Merge "Make Hearing devices preference always visible" into udc-qpr-dev am: 7df08d69be am: 5176db8a71
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23429459

Change-Id: I6e5e91d3bbc44f3973fc021a94cde5d0accb5ce0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-01 03:36:35 +00:00
Chun-Ku Lin
a4e5f38002 Fix HearingDeviceCallRoutingPreferenceControllerTest failure due to NPE
Bug: 284209879
Test: atest HearingDeviceCallRoutingPreferenceControllerTest
Change-Id: I36e6fed02ef989c6c7fea4a53b992ac3863aca4d
2023-05-31 19:59:29 +00:00
Angela Wang
abebbfc4b3 Make Hearing devices preference always visible
Previously we hide the preference when Bluetooth is off since it's only used for showing connected hearing aids and acting as a shortcut to device detail page.

However, the preference is now a new page of multiple controls, we probably shouldn't hide the preference the Bluetooth is off. Those controls should be accessible even if the Bluetooth is off.

Bug: 284092084
Test: make RunSettingsRoboTests ROBOTEST_FILTER=HearingAidHelperTest
Change-Id: I647a187d73bd673c8ac8ab366579ba92c22ce1dc
2023-05-25 11:20:11 +00:00
Chun-Ku Lin
9849bce398 Merge "Unified service and shortcut state summary on a11y settings page." 2023-05-24 22:21:26 +00:00
Chun-Ku Lin
b8084ecfcd Unified service and shortcut state summary on a11y settings page.
Bug: 210026562
Test: manual
Test: atest

Change-Id: I4d5ff6b10d6bfd2fe6b3de1849d00a9d084bf269
2023-05-23 22:19:55 +00:00
Chun-Ku Lin
f4d7518710 Clean up test with Robolectric's way to launch a fragment with an
activity.

Robolectric has shadows for many Android framework's code. With the help
of Robolectric, We don't need
to use mock the return value of every method Activity or Fragment has.

Bug: 283885638
Test: atest AccessibilityDetailsSettingsFragmentTest

Change-Id: I77dfa755e3a1b6a240a06f74b5a6c5984534c831
2023-05-23 19:06:33 +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
Jason Hsu
4ecbb9c13c Merge "Move 'Audio Output' to Accessibility hearing device page" into udc-dev am: 181cfa3aa5 am: 3f6e93beea
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23157344

Change-Id: Ic1ce1c748c2ee749b4a73256a8d850df1232bb6d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-12 15:06:05 +00:00
Jason Hsu
181cfa3aa5 Merge "Move 'Audio Output' to Accessibility hearing device page" into udc-dev 2023-05-12 14:20:23 +00:00
jasonwshsu
212470d0a6 Move 'Audio Output' to Accessibility hearing device page
* Extract the common part into HearingAidHelper.
* Remove abstract getHearingDevice(). Change to get the hearing device when needed.
* Move several classes from Bluetooth into Accessibility

Bug: 281783079
Test: make RunSettingsRoboTests ROBOTEST_FILTER="(HearingDeviceAudioRoutingBasePreferenceControllerTest|AccessibilityHearingAidPreferenceControllerTest|HearingAidHelperTest|HearingAidAudioRoutingPreferenceControllerTest|HearingDeviceCallRoutingPreferenceControllerTest)"
Change-Id: I79049107409b7086c6dcc8d48a6323e171ed1535
2023-05-12 13:46:53 +08:00
Angela Wang
cd1a68db34 Merge "Disabled state UI of Flash Notifications preview button" into udc-dev am: 22d3116188 am: ae04daac19
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23081916

Change-Id: Ic2362f572bd3be5a857788e62d9e6afb97e06b0d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-11 03:00:38 +00:00
Angela Wang
22d3116188 Merge "Disabled state UI of Flash Notifications preview button" into udc-dev 2023-05-11 01:41:47 +00:00
Angela Wang
53a8cc0326 Disabled state UI of Flash Notifications preview button
When both the camera flash and screen flash toggles are turned off, tapping on the preview button will have no effect and may confuse users. To avoid this, the appearance of the preview button should be updated to clearly indicated that its current state is disabled. This wil help users better understand the situation and prevent confusion.

Bug: 276494146
Test: checks the UI manually
Test: make RunSettingsRoboTests ROBOTEST_FILTER=FlashNotificationsPreviewPreferenceTest
Change-Id: I55b11188fde6e551921a9b0f7c89daa20a8b766b
2023-05-09 16:48:35 +00:00
Vincent Wang
7f21ad81f7 Merge "Test Fix SettingRobolectricTest Fail" into udc-dev am: 5801e98d7f am: 81740a7c0c
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23074022

Change-Id: I08589651a8ba8924419b17cba205c0cc3408f6c0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-09 11:14:14 +00:00
Vincent Wang
818f77cd1f Test Fix SettingRobolectricTest Fail
Bug: b/275023433
Test: NA
Change-Id: If2dcb8f6c196327129ccc9375b190e394c994efa
2023-05-09 06:26:39 +00:00
Edgar Wang
8870b51b59 Merge "Fix test case failed in SystemControlsFragmentTest" into udc-dev am: 55d7c97022 am: 164ddcf0b7
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/22931168

Change-Id: I6c818afa043cbe9a8487ee06e0f6f3706e229f65
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-02 03:16:50 +00:00
Edgar Wang
089e76c429 Fix test case failed in SystemControlsFragmentTest
Fixes: 280071271
Test: local robotest
Change-Id: I96867e9718b4a30289fdcd3fcd9dc70ed8c227b0
2023-04-29 00:42:45 +08:00
Jason Hsu
dd9803ccf7 Merge "Fix pair another dialog doesn't show up after pairing in all bluetooth device page." into udc-dev am: 80016ad92a am: d3453f681c
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/22477523

Change-Id: If2daf9293d431799df85b1a1fd299fd16cd1a790
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-18 09:25:41 +00:00
Jason Hsu
80016ad92a Merge "Fix pair another dialog doesn't show up after pairing in all bluetooth device page." into udc-dev 2023-04-18 08:47:37 +00:00
jasonwshsu
c8a53a9391 Fix pair another dialog doesn't show up after pairing in all bluetooth device page.
Solution: Finish the page immediately to back to previous page when already BONDED the device in
all bluetooth device page.

Bug: 270096758
Test: make RunSettingsRoboTests ROBOTEST_FILTER=ViewAllBluetoothDevicesPreferenceControllerTest
Change-Id: I13a88c3fbe0c6851f9446a9f574a1c18f934cd2e
2023-04-14 18:25:28 +08:00
Treehugger Robot
3c5baf76f1 Merge "Fixes SelectLongPressTimeoutPreferenceControllerTest summary check." into udc-dev am: 5c8d1332c7 am: 872336e5a5
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/22630556

Change-Id: I554a5639de10e868f8a6353f32e32af2c9d4bb81
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-13 23:53:20 +00:00