[Bug]: Sample Agent hangs before invoking ChatApp searchContacts on Android 17
@manoj897 is already working on this.
Since Jul 27, 2026.
Assessment
This issue has not been assessed yet.
Description
Is there an existing issue for this?
- I have searched the existing issues
Is there a StackOverflow question about this issue?
- I have searched StackOverflow
What happened?
What happened?
Using the Agent and ChatApp samples built unchanged from main at commit d9cdc55, the Agent correctly selects ChatApp's searchContacts AppFunction for a natural-language request, but execution never reaches ChatApp. The Agent remains on the in-progress spinner and does not return a result.
Prompt:
Find contacts named Bob in ChatApp.
Expected: ChatApp's searchContacts function executes and returns matching contacts.
Actual: The LLM selects the correct tool and parameters, metadata lookup succeeds, then AppFunctionManager.executeAppFunction() does not complete. ChatApp's generated AppFunction service is not entered.
Reproduction
- Checkout
android/appfunctionsatd9cdc55onmain. - Build
ChatAppwith./gradlew :app:assembleDebug. - Build the Agent with
./gradlew :app:assembleStandardDebug. - Uninstall both packages, then install both APKs:
com.example.chatappandcom.example.appfunctions.agent. - Launch the Agent with shell identity instrumentation:
adb shell am instrument -w com.example.appfunctions.agent/.ShellIdentityInstrumentation - Configure a valid Gemini API key.
- Submit: Find contacts named Bob in ChatApp.
- Observe that the Agent stays in progress indefinitely.
Control test
The same installed ChatApp function succeeds immediately when invoked directly:
adb shell "cmd app_function execute-app-function \ --package com.example.chatapp \ --function 'com.example.chatapp.appfunctions.BaseChatAppFunctionService#searchContacts' \ --parameters '{"query": "Bob", "filterType": "INDIVIDUAL"}'"
This returned two Bob contacts in 0.927 seconds, confirming that the function is installed, indexed, enabled, and executable.
Localization
Temporary diagnostics were kept on a separate branch and were not part of the clean reproduction. They show:
- Gemini returned a tool call for ChatApp
searchContacts. - Function parameters were converted successfully.
searchAppFunctionsreturned one matching function in 34 ms.- The Agent entered
AppFunctionManager.executeAppFunction(). - No receiver-entry event was observed in ChatApp.
- The client call did not complete within a diagnostic 20-second timeout.
This localizes the failure after LLM tool selection and metadata discovery, but before ChatApp's AppFunction service receives the request.
Environment
- Device: Pixel 10 Pro Fold
- Android: 17 / API 37
- Repository commit:
d9cdc55
No SecurityException was observed. On API 37, the Agent constructs the request with AppInteractionAttribution.
Is there a known API 37 dispatch or attribution issue that can cause an AndroidX client invocation to wait before the target service is entered? Are additional permissions or platform configuration required beyond the supplied ShellIdentityInstrumentation flow?
Relevant logcat output
Temporary diagnostic trace (isolated branch; clean main reproduces the same spinner):
I/AppFunctionTrace: LLM_TOOL_SELECTED package=com.example.chatapp function=com.example.chatapp.appfunctions.BaseChatAppFunctionService#searchContacts
I/AppFunctionTrace: PARAMETERS_CONVERTED keys=[filterType, query]
I/AppFunctionTrace: METADATA_LOOKUP_SUCCESS count=1 elapsedMs=34
I/AppFunctionTrace: CLIENT_DISPATCH_START package=com.example.chatapp function=com.example.chatapp.appfunctions.BaseChatAppFunctionService#searchContacts
E/AppFunctionTrace: CLIENT_DISPATCH_EXCEPTION elapsedMs=20000
java.lang.IllegalStateException: AppFunction execution timed out
No ChatApp receiver-entry trace was emitted for the Agent invocation.
Direct shell control on the same clean installation:
{
"androidAppfunctionsReturnValue": [
{
"endpointType": ["INDIVIDUAL"],
"endpointValue": ["2"],
"displayName": ["Bob Johnson"]
},
{
"endpointType": ["INDIVIDUAL"],
"endpointValue": ["7"],
"displayName": ["Bob Johnson"]
}
]
}
Code of Conduct
- I agree to follow this project's Code of Conduct
- Dominant language
- Kotlin
- Stars
- 210
- Forks
- 45
- Avg merge
- 12h 24m
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from android/appfunctions
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 90/100
android/appfunctions#66 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
android/appfunctions#62 ·
-
Difficulty 4/5 1-2 days Newbie friendliness 55/100
android/appfunctions#64 ·
-
[FR]: Testing agent should handle AppFunctionUriGrant results and pass returned images to the modelOpen
Difficulty 4/5 3-5 days Newbie friendliness 45/100
android/appfunctions#63 ·
-
Clarify production invocation, Android Auto support, and Android 16 fallback in AppFunctions docsOpen
Difficulty 4/5 3-5 days Newbie friendliness 52/100
android/appfunctions#51 ·
All issues in android/appfunctions
Similar issues
-
[Request] 多闪Openrequest-adaption
Difficulty 1/5 Under an hour Newbie friendliness 75/100
BetterAndroid/android-notification-icon-project#814 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
yunfie-twitter/Palleria#474 ·
Maintainers usually reply within 1 day
-
area:backend enhancement priority:low
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Kotlin-server-squad/vizcore#271 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
[Bug] Web Player: Misalignment in lyrics toolbar with format dropdown ('Auto') and download iconOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
kushagrasinghx/BitChord#1269 ·
Maintainers usually reply within 1 day