What are the technical limitations for adopting tr...
# compose
c
What are the technical limitations for adopting true Compose into Remote Views, as opposed to going through Glance? Is this being worked on? I assume it must be if Compose is supposed to be the future of UI development for Android?
j
RemoteViews operate in someone else's process so the idea that you could run Compose in real time (let alone Compose UI) is extremely unlikely.
There is almost certainly no one working on getting Compose UI working for widgets or notifications because it involves a foundational change in how they render before it's even possible to send custom rendering let alone run something like Compose UI.
The technical limitation is that speaking to remote views is somewhere between 100x and 10,000x slower than speaking to the in-process rendering. There is no mechanism for real-time interaction as remote views are entirely a one-way mechanism whose return channel is also 100x to 10,000x slower than input events. The interactions which do exist are extremely coarse-grained like clicks, and you do not get in-progress touch events or even widget events like scrollings.
It's nowhere near feasible to expect this to be supported any time soon, and likely never.
r
The current architecture of remote views doesn't make this a good fit but there are potential paths to get to something more interesting involving Compose
m
Three years ago, I guessed that `SurfaceControlViewHost` was going to be a long-term direction for app widgets, if perhaps not notifications. Still waiting on that, though it seems to be used in
androidx.car
.
c
Appreciate the insight everyone! Very curious to learn more about those potential future paths. Just because it feels a bit disjointed to me if Compose is the recommended UI toolkit going forward, but we need to use something else entirely for notifications/widgets. Perhaps Glance isn't too different from Compose (I haven't used it myself yet but will for a notification soon), it just doesn't seem ideal since I assume you can't reuse existing common composables in your app or reuse your app's theme.
j
Glance is Compose. It's just not Compose UI.
c
Right. Compose UI is what I meant to say, since I assume that would enable us to reuse composables and theming between our app and our widgets / notifications
r
@Mark Murphy We've been thinking about this sincr android 1.x. but it requires the widget process to be alive. Not great.
c
FWIW I used glance quickly and it behaved pretty darn similar to compose ui. the biggest headache is all the other crap surrounding widgets that you have to setup and wire together in xml and stuff. still waiting for google to add a "File > New Widget" template or something lol.
c
Good to know. Did you have to duplicate any components or theming from your main app, or was that not really an issue?
c
Not really an issue. in theory, sure itd be nice to just carry everything over, but a widget is typically so tiny in what its providing and so we didn't really need anything crazy to borrow