-
Notifications
You must be signed in to change notification settings - Fork 257
Adds watch face support using Watch Face Push #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @garanj, 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 introduces comprehensive watch face support to the Androidify application, enabling users to create and transfer personalized watch faces featuring their generated bots directly to Wear OS devices. The implementation integrates with the Watch Face Push API, necessitating a companion Wear OS app to manage the creation, signing, validation, and transfer of watch face APKs. This new functionality enhances user customization options and streamlines the process of applying unique designs to smartwatches.
Highlights
- Watch Face Customization: The Androidify app now supports creating and transferring customized watch faces to Wear OS devices, allowing users to personalize their smartwatches with their unique bot creations.
- Watch Face Push API Integration: The integration leverages the Watch Face Push API, enabling dynamic installation of watch faces directly to the device without requiring separate Play Store publication for each custom design.
- Wear OS Companion App: A dedicated Wear OS companion app is now required, as the Watch Face Push API operates directly on the watch. This ensures seamless communication and functionality between the phone and the smartwatch.
- Compatibility and Feature Flagging: The feature includes compatibility checks, requiring a minimum SDK version 28, a connected Wear OS watch, and an enabled remote configuration flag (
watchface_feature_enabled) to ensure proper operation. - Technical Architecture and Data Transfer: The architecture for watch face creation involves using Watch Face Format templates, the
Packlibrary for APK packaging, and robust signing and validation processes before transfer. Data transfer is handled efficiently via Wear OS Data Layer APIs, including NodeClient, CapabilityClient, MessageClient, and ChannelClient. - Modular Codebase: New modules (
:watchface,:wear,:wear:watchface,:wear:common) have been introduced to modularize the codebase, separating concerns related to watch face generation, Wear OS app logic, and common data structures. - Centralized Versioning: A unified versioning strategy has been implemented using
Versions.ktto provide a single source of truth forversionCodeandversionName, ensuring consistent versioning across both the main Androidify application and its new Wear OS counterpart.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
buildSrc/src/main/kotlin/com/android/developers/androidify/Versions.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds comprehensive support for creating and transferring custom watch faces to a Wear OS device using Watch Face Push. The changes are well-structured, introducing new modules for watch face creation, data transfer, and the Wear OS app itself. The implementation correctly uses feature flags for the new functionality and centralizes versioning, which is great for maintainability. I have a few suggestions to enhance code safety and maintainability.
...ure/results/src/main/java/com/android/developers/androidify/customize/WatchFaceModalSheet.kt
Outdated
Show resolved
Hide resolved
|
This looks so lovely Garan 👏🏻 Great great job! ❤️ |
|
Nit: When picking a watch face, can you remove the left and right padding and change it to contentPadding instead so that when you scroll its not visible on each side - it scrolls away? |
Done - that looks much better thanks! |
# Conflicts: # feature/results/src/main/java/com/android/developers/androidify/customize/CustomizeExportScreen.kt # feature/results/src/main/java/com/android/developers/androidify/customize/CustomizeExportViewModel.kt # feature/results/src/test/kotlin/com/android/developers/androidify/customize/CustomizeViewModelTest.kt
# Conflicts: # app/build.gradle.kts # feature/results/src/main/java/com/android/developers/androidify/customize/CustomizeExportScreen.kt # feature/results/src/main/java/com/android/developers/androidify/customize/CustomizeExportViewModel.kt # feature/results/src/test/kotlin/com/android/developers/androidify/customize/CustomizeViewModelTest.kt



Adds watch face support using Watch Face Push
This PR adds watch face support using Watch Face Push (WFP). This allows the user to create a customized watch face using their generated bot and transfer it to their watch.
Operation
Owing to the way in which Watch Face Push works, this solution requires a Wear OS app: The Watch Face Push API exists only on the watch, and is the only mechanism for adding dynamically-created watch faces to the watch. Outside of WFP, all watch faces must be published through Play.
Compatibility
The watch face feature requires:
watchface_feature_enabledremote config flag set to trueIf these conditions are met, then on the Customize screen, an additional icon is shown bottom-right, for watch faces. If they are not met, then Androidify simply does not show the feature.
Watch face installation
On the watch face customization modal screen, the details of the connected device is shown. If Androidify is not installed on the watch, then the button launches the Play Store to install it (if it were there, which it isn't right now).
Once installed, the user has the ability to select the watch face they want, and then send to the watch:
The app on the watch automatically starts and received the watch face, which is then installed:
What happens next depends on a few factors:
Note: This logic is all WAI as part of Watch Face Push - apps can only call the API to set the active watch face once.
Architecture
Watch Face Creation
For Watch Face Creation, template Watch Face Format watch faces are included in the
assetsof the app. These templates all reference abotdrawable, which is the image from Androidify. The template resources and the bot image are packaged together into an APK using the Pack library.Signing and validation
The built APK must be both signed and then validated using the Watch Face Push validation library. This takes place before transmission.
Transfer
The Wear OS Data Layer APIs are used for transferring the APK for installation using Watch Face Push. Notably:
NodeClientis used to detect connected watches.CapabilityClientis used to detect presence or absence of Androidify app on the connected devices.MessageClientis used to initiate transfer requests - only one active transfer can take place at a time.MessageClientis used to request go-ahead to send the APK.ChannelClientis used to transfer APKs.The implementation only supports having one connected device. If more than one device is connected to the phone, only one is shown in the Androidify app, prioritizing any that already have the Wear OS Androidify app installed.
Installation
A
WearableListenerService-based class is used on the watch to receive and install the watch face using Watch Face Push. This launches any required supporting Activity, to guide the user.Implementation
:watchfacemodule:transfer:WearDeviceRepository- this provides information on:WearAssetTransmitter- this performs the actual transmission of the watch face APK, including:WatchFaceInstallationRepository:WatchFaceCreatorWearDeviceRepositoryWearAssetTransmittercreator:WatchFaceCreatorfor creating and signing watch face APKsassetsas exported from Watch Face Designer:wearmoduleAndroidifyDataListenerServicewhich receives requests to initiate watch face transfer over the data layer.:wear:watchfacemoduleVersioning
The PR also proposes a single source for
versionCodein Androidify: The Wear OS implementation requires a separate app, with the same package name. This needs to have a separate version code, and ideally a separate version code "space". The single source forversionCodeinVersions.ktensures that both apps increment their version code but do not clash.