Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocaleManager setApplicationLocales stopped working with api 34 and robolectric 4.11 #8580

Closed
lsuski opened this issue Oct 30, 2023 · 0 comments

Comments

@lsuski
Copy link

lsuski commented Oct 30, 2023

Description

After updating robolectric to 4.11 and target sdk to 34 simple test I have stopped working

  fun `test hasApplicationLocales`() {
        assertFalse(application.hasApplicationLocales())

        application.localeManager?.applicationLocales = LocaleList(Locale.FRANCE)

        assertTrue(application.hasApplicationLocales())
    }

@RequiresApi(33)
fun Context.hasApplicationLocales() = localeManager?.applicationLocales?.isEmpty == false

However running the same test with @Config(sdk = [33]) succeeds. It looks like ShadowLocaleManager.setApplicationLocales does not conform to Android's LocaleManager.setApplicationLocales method signature

Robolectric & Android Version

Robolectric 4.11

Android 14 (API 34)

copybara-service bot pushed a commit that referenced this issue Oct 31, 2023
Android U introduced a new 3-arg variant of
LocaleManager.setApplicationLocales. Add a shadow for this, which will fix
LocaleManager.setApplicationLocales(LocaleList) in U+.

Fixes #8580

PiperOrigin-RevId: 577900687
@hoisie hoisie closed this as completed in 370b9d7 Oct 31, 2023
hoisie added a commit that referenced this issue Oct 31, 2023
Android U introduced a new 3-arg variant of
LocaleManager.setApplicationLocales. Add a shadow for this, which will fix
LocaleManager.setApplicationLocales(LocaleList) in U+.

Fixes #8580

PiperOrigin-RevId: 578049631
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant