Repository navigation
ADFA-6361: Keep the activity snapshot when a plugin passes its own inflater - #2130
Open
Daniel-ADFA wants to merge 2 commits into
Open
Daniel-ADFA wants to merge 2 commits into
Daniel-ADFA wants to merge 2 commits into
Conversation
The file used four-space indentation, so touching it for the fix pulls the whole file under the ratchet. Committed standalone.
…flater PluginFragmentHelper.getPluginInflater() records the inflater's context as the plugin's current activity, which PluginResourceContext uses to resolve resources and the theme for plugins with a custom package ID. A plugin that passes an inflater already running in its own context (for example LayoutInflater.from(parent.context) in a RecyclerView adapter) recorded the PluginResourceContext itself, so getResources() resolved to itself and recursed until StackOverflowError (GlitchTip issue 7749649, 14 events, com.cogo.ai.assistant). getPluginInflater() now leaves the snapshot alone when the inflater's context is the plugin context or wraps it. It is the only writer of the snapshot, and plugins compile against plugin-api without bundling it, so installed plugins get the fix from the host. PluginResourceContextActivitySnapshotTest covers the plugin context and a ContextWrapper over it; plugin-manager's unit tests gain Robolectric for it.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ADFA-6361
Fixes
StackOverflowErrorinPluginResourceContext.getResources()(GlitchTip, 14 events, fromcom.cogo.ai.assistant).PluginFragmentHelper.getPluginInflater()no longer records an inflater's context as the plugin's activity when that context is the plugin context or wraps it. A plugin passingLayoutInflater.from(parent.context)from its own views madegetResources()resolve to itself and recurse.getPluginInflater()is the snapshot's only writer, and plugins compile against plugin-api without bundling it, so installed plugins get the fix from the host. No public API change (apiCheckpasses).PluginResourceContextActivitySnapshotTest: the plugin context and aContextWrapperover it. Both fail without the fix (snapshot replaced; asserting resources first overflows the stack).plugin-managertests gain Robolectric.PluginFragment.kt, whitespace only.