sergio-sastre / AndroidUiTestingUtils

A set of TestRules, ActivityScenarios and utils to facilitate UI and screenshot testing under given configurations: FontSizes, Locales...
MIT License
290 stars 14 forks source link

LocaleTestRule not working for the first test only if < API 27 #3

Closed sergio-sastre closed 2 years ago

sergio-sastre commented 2 years ago

Describe the bug LocaleTestRule not working for the first test only if < API 27

Environment The setup in which the bug is reproducible:

Expected behavior It displays the following error:

Caused by: java.lang.SecurityException: Permission Denial: updateConfiguration() from pid=28072, uid=10065 requires android.permission.CHANGE_CONFIGURATION

although the permission is added in debug/manifest

Remarks:

  1. Does not happen on API 27+.
  2. Only the first test is buggy. The locale change becomes effective afterwards on every test.
sergio-sastre commented 2 years ago

This will be fixed once the AppCompatDelegate reaches the 1.6.0 release version, including AppCompatDelegate.setApplicationLocales()

https://developer.android.com/jetpack/androidx/releases/appcompat#1.6.0-alpha04

sergio-sastre commented 2 years ago

solved in 1.1.2