Skip to content

Move objects to PlatformContext - #3217

Open
Apolo (ApoloApps) wants to merge 23 commits into
JetBrains:jb-mainfrom
ApoloApps:movePlatformObjects
Open

Move objects to PlatformContext#3217
Apolo (ApoloApps) wants to merge 23 commits into
JetBrains:jb-mainfrom
ApoloApps:movePlatformObjects

Conversation

@ApoloApps

@ApoloApps Apolo (ApoloApps) commented Jul 12, 2026

Copy link
Copy Markdown

… Autofill and AutofillManager to PlatformContext.

Remove PlatformScreenReader in favour of PlatformAutofillManager, it seems like a good place to put it and we avoid double allocation (in iOS) or allocation at all (in all other)
@ApoloApps
Apolo (ApoloApps) marked this pull request as ready for review July 13, 2026 11:26
@ApoloApps Apolo (ApoloApps) changed the title Move objects to PlatformContext and merge ScreenReader with A11y manager Move objects to PlatformContext Jul 15, 2026

@ASalavei Andrei Salavei (ASalavei) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS part LGTM

@ApoloApps

Copy link
Copy Markdown
Author

tests should not fail now (i made a similar error in another PR, import androidx.compose.ui.unit.toDpSize is needed!)

@ApoloApps

Copy link
Copy Markdown
Author

All changes are reconciled with 1.13 merging to jb-main (compatible with the minimalistCompositionLocals)

…rs. Please note that it does not come with an implementation and using it at runtime will throw an exception (same behavior as before, nothing really changed)
Comment on lines +240 to +249
@Suppress("DEPRECATION")
val clipboardManager : ClipboardManager

@Suppress("DEPRECATION")
val autofillTree : AutofillTree
get() = AutofillTree()

@Suppress("DEPRECATION")
val autofill: androidx.compose.ui.autofill.Autofill?
get() = null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd avoid exposing deprecated types here, especially with @Suppress.

What's the reason for it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these were creating objects in Rootnodeowner even though they are not used anymore and are deprecated. This way we centralize the creation of these once for all other nodes (since PlatformContext is reused) and avoid initializing eagerly and each time for each node. I would keep it as is without the deprecation suppression. This way, its usages have the deprecation notice and once it is gone, we can clean it all up easily.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once it is gone

Deprecations from common/Google are there forever (or unless 2.x that is ~the same), so it's not a temporary shape. And since PlatformContext is "semi-public" I'd try to find a way how to avoid exposing it here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it being an interface prevents easily hiding internally the values. I have been trying to add some other internals like shareddrawscope (since it is an internal class, and cant be exposed in PlatCtx) but it requires PlatformContext to have another shape. It is not trivial

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.

4 participants