UiMode not working with ActivityTestRule, works fine with ActivityScenario though
sergio-sastre opened this issue · 2 comments
sergio-sastre commented
Describe the bug
When UiMode is used with the deprecated ActivityTestRule, it does not work.
This is reproducible when using android-testify, which uses ActivityTestRule under the hood
Environment
The setup in which the bug is reproducible:
- Device or Emulator: Emulator
- API level: Any
- AndroidUiTestingUtils version: 2.0.0, but also previous
- Affected Component: UiModeTestRule
- Buggy Configuration: UiMode
Expected behavior
The UiMode should change accordingly
Additional context
This can be solved for API 29+ by changing the UiMode via adb.
android-testify will likely migrate to ActivityScenario in version 2.0.0, so it might not need a fix for previous versions
sergio-sastre commented
Notes:
- From API30+, it uses adb which is pretty fast indeed
- For lower Api levels, it uses AppCompatDelegate, and it also works on lower APIs with Android-Testify :)
sergio-sastre commented
Added in 2.2.0