**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
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
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
**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
**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
**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
- 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
- Do not show Wi-Fi hotspots in Settings Widgets if the config is not set to show
Bug: 275268676
Test: Manual test
atest -c CreateShortcutPreferenceControllerTest
Change-Id: I5d86a78c9d48c9b63faff50d46f1254dbefd94cf
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
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
Bug: 278316711
Test: make test RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.fuelgauge
Change-Id: I8f720bcdf7c0efabc8278913ccf1c0427c857fac
Currently when "Work apps" the toggle is tapped in Settings it leads to
UM.requestQuietMode() being called twice via different routes.
Bug: 284915370
Test: atest WorkModePreferenceControllerTest
Change-Id: I5eeb7ecdb10245a32d947ae2430a865bd7a5a60a
- When the user is a guest user, the UI will remove all preferences to restrict setting changes. If the ViewModel updates the UI in this situation, it will cause Settings to crash.
- Avoid to setup ViewModel when UI is restricted
Bug: 284435378
Test: Manual test
atest -c TetherSettingsTest
Change-Id: I52d4ea717c34eacc9cc2321e3950dc89408049f8
DataSaverController currently used in 2 pages,
- Network & internet > Data Saver
- Apps > Special app access
This helps unify the logic, and instead of showing on "Special app
access", this summary shows on "Unrestricted data" is make more sense.
Bug: 280280596
Test: Manually on above pages
Test: Unit test
Change-Id: Ia151ed8179a250f8f20cc5041f9383fffebdab10