Skip to content

Feat/ChatApp-Work-Adjustments - #98

Draft
tumlinson-rgb wants to merge 10 commits into
android:mainfrom
tumlinson-rgb:feat/all-chat-app-updates-and-fixes
Draft

tumlinson-rgb wants to merge 10 commits into
android:mainfrom
tumlinson-rgb:feat/all-chat-app-updates-and-fixes

Conversation

@tumlinson-rgb

@tumlinson-rgb tumlinson-rgb commented Nov 20, 2026 •

Copy link
Copy Markdown

What I have done and why
--WIP--

@google-cla

google-cla Bot commented Nov 20, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@tumlinson-rgb tumlinson-rgb changed the title Feat/all chat app updates and fixes Feat/ChatApp-Work-Adjustments Nov 20, 2026

@utkarsh2827 utkarsh2827 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Quick architecture and AppFunctions review comments below. (Also [Optional]: ChatApp/wear/src/main/res/xml/app_metadata.xml still has the stale 'send' name and blank-query searchContacts guidance that was fixed in app/src/main/res/xml/app_metadata.xml — consider syncing it as well.)

lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
manager.handleAppFunction(
adapter.adapt { _ ->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

adapter.adapt { _ -> true } is a silent no-op that ignores messageText and always returns true, and it registers appendDraftMessage whenever MainActivity is RESUMED (even on RecipientsScreen, AppFunctionsScreen, or CallScreen where there is no chat input bar). Consider scoping registration to ChatScreen (or routing through ChatViewModel / a shared draft state holder following unidirectional data flow) so it actually updates the active chat draft, and avoid advertising/succeeding when no chat is open.

@OptIn(ExperimentalAppFunctionsApi::class)
@AndroidEntryPoint
class MainActivity : ComponentActivity() {
private val appFunctionManager by lazy { AppFunctionManager.getInstance(this) }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Optional] AppFunctionManager.getInstance(this) is instantiated directly in MainActivity rather than injected via Hilt. Providing it through a Hilt module would improve consistency and testability.

<property
android:name="android.app.appfunctions.app_metadata"
android:resource="@xml/app_metadata" />
<property

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This declares chat_activity_app_functions.xml (advertising appendDraftMessage) on Wear, but ChatApp/wear/src/main/kotlin/com/example/chatapp/wear/MainActivity.kt never calls handleAppFunction. Remove this <property> until Wear handles AppendDraftMessageSignature, or implement the handler in Wear's MainActivity.

Operational Patterns:
- Always call 'searchContacts' first to resolve contact or group names to an 'endpointValue' before calling 'send' or 'makeCall'.
- Passing a blank query string to 'searchContacts' retrieves the most recently contacted entities.
- Always call 'searchContacts' first to resolve contact or group names to an 'endpointValue' before calling 'sendMessage', 'fetchSendMessageDetails', 'reviewSendMessage', or 'makeCall'.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lines 20 and 23 reference 'reviewSendMessage', which does not exist in BaseChatAppFunctionService (removed in dbc46027), which can mislead the LLM into calling a non-existent tool. Please remove 'reviewSendMessage' here.

}
}

companion object {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This companion object duplicates FUNCTION_ID_* constants already generated on ChatAppFunctionService (none of these are referenced), and FUNCTION_ID_REVIEW_SEND_MESSAGE (line 386) points to a removed function. Consider removing the unused companion object (or at least FUNCTION_ID_REVIEW_SEND_MESSAGE).

endpointValue = it.id,
endpointDisplayName = it.name,
): List<ContactSearchResult> =
withContext(Dispatchers.IO) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Optional] Hardcoding withContext(Dispatchers.IO) in each service method puts threading policy in the entry point and makes unit testing harder. Per the Guide to app architecture, consider making the repositories in data/ main-safe with an injected CoroutineDispatcher (or injecting the dispatcher via Hilt).

)
fun interface AppendDraftMessageSignature {
/** Appends or prefills text content into the currently active chat input bar. */
suspend fun appendDraftMessage(messageText: String): Boolean

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isDescribedByKDoc = true is set, so this KDoc forms the tool metadata sent to the LLM, but @param messageText and @return are missing. Please add @param messageText (clarifying blank-text behavior and append vs. replace semantics) and @return KDoc tags.

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.

2 participants