Status Update
Comments
ma...@gmail.com <ma...@gmail.com> #2
compose version - 1.7.0-beta02
tv foundation - 1.0.0-alpha10
rv...@google.com <rv...@google.com> #3
the older rows getting recomposed while the new lazy row is not. each new item that added to the list causes to each row (expect the new one) to recompose, while some of them getting skipped some components are not.
The main property of Lazy layouts is that it will only compose the items that are in the view. If they are not in the view, they won't be composed. Once you scroll to those items, then they will get composed/re-composed. If you want to compose all the items for whatever reason, consider using Row
or Column
instead (remember this will impact performance a lot if you have a lot of items within the row/columns).
Also and very important unhealthy behavior that you can see in this video you can also see that using 'androidx.tv.material3.Card' library for Card, each focus movement causing recomposition to the card the focus has left and a composition for the incoming card. also by disabling the
cardScale
the behavior stays the same (can be seen in "recomposition on focus tv").
This is expected behaviour. Card scale is not the only property listening to the focus events. There are other properties as well, that are listening to focus events like shape
, colors
, border
. Why do you think this is "unhealthy" behaviour?
rv...@google.com <rv...@google.com> #4
On a side note, TvLazyRow
, TvLazyColumn
, TvLazyHorizontalGrid
and TvLazyVerticalGrid
have been deprecated from androidx.tv.foundation
. Kindly refer to
ma...@gmail.com <ma...@gmail.com> #5
What I'm trying to point out is that the recomposition/composition triggered by focus events is excessive and negatively impacts the app's performance. By recomposition, I mean the composition, layout, and drawing processes. I expect focus events to trigger only the layout and drawing processes, or just the drawing process, as long as the composable is not set to listen to these events.
> The main property of Lazy layouts is that it will only compose the items that are in the view. If they are not in the view, they won't be composed. Once you scroll to those items, then they will get composed/re-composed. If you want to compose all the items for whatever reason, consider using Row or Column instead (remember this will impact performance a lot if you have a lot of items within the row/columns).
I think there was a misunderstanding. You described the expected behavior, but that is not what the layout inspector is showing in the attached video `composition error TV`
In the attached video, I append one list for each time interval. I expect that only the newly created list will be detected as a composition by the layout inspector. However, the actual behavior shows that each time I append a list, the most recent list is not undergoing composition, while all the previously appended lists are undergoing recomposition.
ma...@gmail.com <ma...@gmail.com> #6
rv...@google.com <rv...@google.com> #7
I expect focus events to trigger only the layout and drawing processes, or just the drawing process, as long as the composable is not set to listen to these events.
The key advantage of most TV components is their declarative style application, based on focus or click events. This eliminates the need for developers to manually listen to and update styles. Internally, we handle this by listening to these events and dynamically swapping styles, which requires the composition phase.
Currently, we have no plans to investigate removing the recomposition step for interactive components and their descendants on focus/press events. The potential performance benefits remain unclear, especially since interactive components are typically located near the leaf nodes of the component tree.
During development, you may notice performance issues with the debug app on actual TV devices. We highly recommend creating and applying
I think there was a misunderstanding. You described the expected behavior, but that is not what the layout inspector is showing in the attached video
composition error TV
In the attached video, I append one list for each time interval. I expect that only the newly created list will be detected as a composition by the layout inspector. However, the actual behavior shows that each time I append a list, the most recent list is not undergoing composition, while all the previously appended lists are undergoing recomposition.
I understand, thank you for clarifying. Since lazy layouts are no longer part of the TV library, I recommend filing this issue under the
jj...@gmail.com <jj...@gmail.com> #8
There are still a lot of improvements to do in the compose framework to be able to use it on low-end tv market devices. The customer don't have Nvidia Shield or emulator. The global performances improve those last months, but it's way too slow, 2 years to get the 1.0.0 version. Is it possible to get more man power on this performance topic or quality developer ?
Sorry
Description
Version used: kotlin version 2 - automatic jetpack compose compiler
description -
video: "composition error TV" - in this video you can see simple use case of lazy columns that has lazy rows inside it.
each interval of time the list gets updated and as a result the composition acting weird -
the older rows getting recomposed while the new lazy row is not. each new item that added to the list causes to each row (expect the new one) to recompose, while some of them getting skipped some components are not.
this behavior in real devices (tv) with low CPU resources makes the app laggy (which is already laggy using lazy rows and lazy columns).
Also and very important unhealthy behavior that you can see in this video you can also see that using 'androidx.tv.material3.Card' library for Card, each focus movement causing recomposition to the card the focus has left and a composition for the incoming card. also by disabling the `cardScale` the behavior stays the same (can be seen in "recomposition on focus tv").
video: "composition error mobile" - much simpler layout, here we can see the difference using compose function (option 1 in the video) while using Box/Card has no effect of the composition but when writing the component without external compose function the composition acting different.
for reproduce it in the project in main activity use
val bugType = BugType.CompositionBug - for TV app
val bugType = BugType.MobileCompositionBug
Devices/Android versions reproduced on: all TV devices
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue. - attached
- A screenrecord or screenshots showing the issue (if UI related). - attached
please contact for further information.