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

Fix theme native object collection in Android S #6873

Merged
merged 1 commit into from Nov 20, 2021
Merged

Fix theme native object collection in Android S #6873

merged 1 commit into from Nov 20, 2021

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Nov 20, 2021

Fix theme native object collection in Android S

Previously, in Android P through R, Robolectric would clean up native themes
from the registry when AssetManager.nativeThemeDestroy was called by the
ThemeImpl finalizer. However, starting in Android S,
AssetManager.nativeThemeDestroy does not exist any more.

As a workaround, hook into the AssetManager.releaseTheme method to free the
theme from the registry. Longer term we may want to have the theme destruction
logic be part of AssetManager.nativeDestroy, where all themes can potentially
be freed in one fell swoop.

This should fix #6872. Thanks to @calvarez-ov for reporting the issue and
helping debug :)

@hoisie hoisie force-pushed the piper_411169531 branch 2 times, most recently from bb8c264 to 8b5890b Compare Nov 20, 2021
Previously, in Android P through R, Robolectric would clean up native themes
from the registry when AssetManager.nativeThemeDestroy was called by the
ThemeImpl finalizer. However, starting in Android S,
AssetManager.nativeThemeDestroy does not exist any more.

As a workaround, hook into the AssetManager.releaseTheme method to free the
theme from the registry. Longer term we may want to have the theme destruction
logic be part of AssetManager.nativeDestroy, where all themes can potentially
be freed in one fell swoop.

This should fix #6872. Thanks to @calvarez-ov for reporting the issue and
helping debug :)

PiperOrigin-RevId: 411169531
@hoisie hoisie merged commit 4d30193 into master Nov 20, 2021
6 checks passed
@hoisie hoisie deleted the piper_411169531 branch Nov 20, 2021
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

Successfully merging this pull request may close these issues.

1 participant