Update to the 1.4/1.6 releases of android.wear.{protolayout,tiles}#1359
Update to the 1.4/1.6 releases of android.wear.{protolayout,tiles}#1359ithinkihaveacat wants to merge 8 commits intoandroid:mainfrom
Conversation
ithinkihaveacat
commented
Feb 25, 2026
- See https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.6.0-beta01
- See https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.4.0-beta01
Also updates: - Compose to 1.10.3 - Android Gradle Plugin to 8.13.2
- Refactor MessagingTileService to inherit from Material3TileService - Move resource loading and tile construction into tileResponse - Refactor tileLayout to be an extension on MaterialScope - Remove dependency on Horologist's SuspendingTileService for this component
- Use MaterialScope.image with ProtoLayoutScope for automatic resource registration - Simplify tileResponse to leverage the new automated system in Material3TileService - Fix Ali's avatar URL extension (.png -> .jpg) to resolve 404 error - Ensure contacts without avatars correctly fallback to themed initials
Summary of ChangesHello @ithinkihaveacat, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request primarily focuses on upgrading the Android Wear OS Protobuf Layout and Tiles libraries to their latest beta versions (1.4 and 1.6 respectively). This update necessitates significant refactoring across the codebase, particularly in how tile services are implemented and how image resources are managed and provided. The changes aim to align the sample code with the latest best practices and API changes introduced in these new library versions, ensuring compatibility and leveraging new features for more efficient resource handling and simplified tile creation. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the android.wear.protolayout and android.wear.tiles dependencies to new major versions and refactors the codebase to adopt the new APIs. The changes are extensive, moving from manual resource management and BaseTileService to the more integrated TileService and materialScopeWithResources. Overall, the migration is well-executed across most of the tile implementations.
However, I've identified a few critical issues. There's a bug in Calendar.kt where an image resource is hardcoded due to an incomplete migration of its data model. Additionally, messaging/Layout.kt contains a couple of errors: a call to a non-existent method setImageResource and incorrect syntax for Kotlin's associate function, both of which will prevent the code from compiling. Please address these points to ensure the migration is complete and correct.
| setWidth(expand()) | ||
| setModifiers(LayoutModifier.clip(shapes.full).toProtoLayoutModifiers()) | ||
| setResourceId(contact.imageResourceId()) | ||
| setImageResource(imageResource, contact.imageResourceId()) |
There was a problem hiding this comment.
The method setImageResource does not exist on LayoutElementBuilders.Image.Builder. This will cause a compilation error. It seems you intended to set the image resource for the avatar.
With the new protolayout API, you should use setResourceId. The ImageResource objects created in Service.kt need to be part of the tile's resource bundle. Since you are using Material3TileService, resource collection is mostly automatic when using composables like imageResource() inside the layout. However, you are creating ImageResource objects outside the layout lambda.
To fix this, you should ensure the ImageResource objects are correctly registered with an ID, and then use setResourceId(contact.imageResourceId()) here.
| data.imageId?.let { | ||
| { | ||
| backgroundImage( | ||
| protoLayoutResourceId = id, | ||
| resource = imageResource( | ||
| androidImageResource(R.drawable.photo_38) | ||
| ), | ||
| contentScaleMode = CONTENT_SCALE_MODE_CROP | ||
| ) | ||
| } |
There was a problem hiding this comment.
The imageId from the Event data is being ignored here. The let block checks if data.imageId is not null, but then a hardcoded drawable R.drawable.photo_38 is used for the background image. This means the tile will always show the same background image regardless of the imageId provided in the Event data.
This seems to be due to an incomplete migration for this file. To fix this, you should update the Event data class to use an Int? for imageId instead of String?, and update its call sites. This is the pattern used in other files in this PR, like Media.kt.
After updating the data class, this block should be changed to use the imageId from the data, for example:
data.imageId?.let { imageResId ->
{
backgroundImage(
resource = imageResource(
androidImageResource(imageResId)
),
contentScaleMode = CONTENT_SCALE_MODE_CROP
)
}
}| addIdToImageMapping(it.imageResourceId(), it.avatarSource.resourceId) | ||
| } | ||
| return TilePreviewData { | ||
| val imageResources = contacts.associate<Contact, String, ResourceBuilders.ImageResource> { |
There was a problem hiding this comment.
The explicit type arguments for associate are unnecessary and syntactically incorrect. The compiler can infer the types from the lambda expression. Please remove the explicit type arguments.
| val imageResources = contacts.associate<Contact, String, ResourceBuilders.ImageResource> { | |
| val imageResources = contacts.associate { |
- Update Gradle to 9.3.1 - Update Android Gradle Plugin to 9.1.0 - Update Kotlin to 2.2.10 - Add recommended build features and compatibility flags to gradle.properties