On this page
Testing the Android Embedded Photo Picker (androidx.photopicker) on real hardware is difficult for traditional single-process UI runners because the system media grid renders inside a cross-process SurfaceView via SurfaceControlViewHost.SurfacePackage. Pairing Anthropic's Claude Code with ScreenSync MCP—a Model Context Protocol (MCP) server built by EpsolDev for Android and desktop browsers—gives an AI coding agent direct pixel capture via Android's MediaProjection API and automated touch and hierarchy inspection over ADB.
Unlike classic full-screen photo picker intents that pause your hosting Activity, the Embedded Photo Picker keeps your app in the RESUMED state while streaming user-granted media URIs back over IPC. In this engineering guide, you will learn how to configure ScreenSync MCP with Claude Code, verify SdkExtensions availability checks, test bottom-sheet expansion and URI grant/revoke callbacks on a physical phone, and triage cross-process surface rendering regressions.
Key Takeaways
- Cross-Process Surface Visibility: Embedded Photo Picker thumbnails render inside a system-owned
SurfaceView, so Espresso view matchers cannot inspect individual gallery items; ScreenSync MCP combinesMediaProjectionscreenshots (no root, no ADB) with ADB-backed UI hierarchy dumps (get_ui_hierarchy). - Clear Capture vs. Control Split: ScreenSync MCP captures screen frames using Android's
MediaProjectionAPI after per-session user consent with zero root and zero ADB, whilecontrol_*gestures (control_tap,control_swipe,control_type) execute through ADB over USB or wireless debugging. - Unified 226-Tool Surface: The local Node.js 18+ hub runs on port 3000 over stdio for Claude Code and exposes 29 phone and desktop tools (12
control_*, 3os_*, and 14 capture/hub tools) plus 197web_*browser tools. - Full Lifecycle Verification: Claude Code can validate
SdkExtensions>= 15 gating,AndroidManifest.xml<queries>declarations,EmbeddedPhotoPickerSessionresize/expand state transitions, and real-timeonUriPermissionGrantedandonUriPermissionRevokedcallbacks. - Local Network Privacy: MediaProjection frames travel strictly between your Android 7.0+ handset and your desktop hub over your local network with
SCREEN_SYNC_TOKENbearer authentication, never touching EpsolDev servers (explicit screenshots requested by the agent are sent to that agent's model provider).
Why Android Embedded Photo Picker Breaks Traditional UI Tests
The Android Embedded Photo Picker renders system-owned media thumbnails inside an isolated SurfaceView via SurfaceControlViewHost.SurfacePackage rather than inside the host application's view tree. Because Espresso and standard Jetpack Compose test rules execute strictly inside the application process, automated matchers cannot inspect internal picker elements or assert real thumbnail selections without cross-process orchestration.
Modern Android media privacy relies on keeping user photos isolated from unprivileged app permissions. Instead of requesting broad READ_MEDIA_IMAGES or READ_MEDIA_VIDEO permissions, developers adopt the Photo Picker so Android grants temporary read access only to items the user taps. For an overview of how Android partitions media collections and SAF document trees, see our guide on testing Android Scoped Storage with Claude Code and MCP.
Classic PickVisualMedia vs. Embedded Photo Picker Architecture
With the classic ActivityResultContracts.PickVisualMedia contract, Android launches a separate modal system Activity. Your app moves into ON_PAUSE, loses live layout state visibility, and receives a static List<Uri> only after the user closes the modal sheet.
The Embedded Photo Picker (androidx.photopicker:photopicker-embedded and androidx.photopicker:photopicker-embedded-compose) changes that model completely:
- Out-of-Process Surface Embedding: Your app hosts a
SurfaceView(or theEmbeddedPhotoPickercomposable) and passes its host token and display ID toEmbeddedPhotoPickerProvider.openSession(...). - Asynchronous Session Binding: The system Photo Picker service (
com.android.photopicker.core.embedded.EmbeddedService.BIND) returns anEmbeddedPhotoPickerSessionand aSurfacePackage, which your app attaches viaSurfaceView.setChildSurfacePackage(). - Bidirectional IPC Lifecycle: Your app notifies the picker when the container resizes (
session.notifyResized(width, height)), expands (session.notifyPhotoPickerExpanded(true)), or visibility changes (session.notifyVisibilityChanged(true)). Meanwhile, the picker invokesEmbeddedPhotoPickerClientcallbacks—onUriPermissionGranted(uris)andonUriPermissionRevoked(uris)—in real time while yourActivitystaysRESUMED.
Why Espresso and Compose UI Test Rules Fall Short
When QA teams run standard AndroidJUnit4 instrumentation suites against an embedded picker screen, three structural failures appear immediately:
- Opaque
SurfacePackageHierarchy: Espresso'sonView()and Compose'sComposeTestRulesemantics tree stop at theSurfaceViewboundary. They can assert that the container exists on screen, but they cannot query album tabs, cloud provider badges, or media thumbnails rendered by the system compositor. - No Cloud Media Sync Coverage in Robolectric: Local JVM tests stub out
SdkExtensions.getExtensionVersion()and binder IPC, hiding manifest<queries>omissions andSurfaceViewz-order clipping bugs (setZOrderOnTopvs.setZOrderMediaOverlay). - Missing Multi-Step Sheet Physics: Embedded pickers frequently live inside collapsible bottom sheets (
ModalBottomSheetorBottomSheetScaffold). Testing the handoff between host sheet drag gestures and internal grid scrolling requires real touch injection and pixel-accurate visual verification.
| Testing Characteristic | Espresso / ComposeTestRule | UIAutomator Alone | Claude Code + ScreenSync MCP |
|---|---|---|---|
| Execution Boundary | Single app process only | Cross-app XML accessibility tree | Real hardware pixels (MediaProjection) + ADB UI tree + logcat |
Inspects SurfaceView Pixels |
No (opaque host container) | Partial (no raster clipping check) | Yes (get_latest_screenshot & control_screenshot) |
| Asserts Sheet Resize & Z-Order | No (misses surface overlap) | No (coordinates only) | Yes (compare_frames + visual inspection) |
Tracks onUriPermissionGranted Logs |
Requires manual test hooks | No system log correlation | Direct get_logcat correlation per tap |
| Validates Fallback on Older OS | Requires separate build/emulator | Requires manual script branching | Autonomous inspection + verification |
| Root Access Required | No | No | No (capture uses MediaProjection; control uses ADB) |
ScreenSync MCP Architecture for Cross-Process Android Testing
ScreenSync MCP bridges an AI coding agent such as Claude Code to a physical Android 7.0+ handset using a local Node.js 18+ hub running on HTTP port 3000 and speaking Model Context Protocol (MCP) over stdio. The Android app captures screen pixels via MediaProjection without root or ADB, while the hub dispatches taps, swipes, UI hierarchy dumps, and logcat queries over ADB.
Understanding how ScreenSync MCP separates visual perception from device control prevents common setup mistakes when debugging system-embedded surfaces like the Embedded Photo Picker. For a full architectural breakdown of capture routes, read how a Screen MCP server captures your Android screen.
Capture Without Root or ADB vs. ADB Control Tools
ScreenSync MCP splits its 29 phone and desktop tools into two distinct transport pathways:
- Screen Capture Path (
MediaProjection, No Root, No ADB): The free ScreenSync MCP Android app (com.screensync.mcp, version 2.5.7 on Google Play) requests Android's nativeMediaProjectionconsent dialog at the start of each session. Once granted, it streams frames over your local Wi-Fi subnet to the desktop hub—achieving roughly 94 ms median latency on a LAN in tests—with zero root access and zero ADB requirement. Tools on this path includeget_latest_screenshot,get_recent_screenshots, andwait_for_frame. - Device Control & Telemetry Path (ADB Required): Actions that inject input or inspect OS-level trees run through ADB from the desktop hub over USB debugging or wireless debugging. This includes
control_tap,control_tap_text,control_swipe,control_type,control_screenshot(adb exec-out screencap -p),compare_frames,get_ui_hierarchy(uiautomator dump), andget_logcat.
Alongside those 29 phone and desktop tools (12 control_*, 3 os_*, and 14 capture and hub tools), the hub (version 1.14.4) also exposes 197 web_* browser tools through its free Manifest V3 Chrome/Edge extension, bringing the total to 226 MCP tools, 17 prompts, and 3 resources. That combined surface is especially valuable if your Android app pulls cloud media linked to a web dashboard or tests OAuth cloud-picker onboarding flows in a real browser tab.
| ScreenSync MCP Tool | Underlying Mechanism | ADB Required? | Embedded Photo Picker Testing Role |
|---|---|---|---|
get_device_status |
Local hub session state | No | Confirms phone is streaming before test starts |
get_latest_screenshot |
Android MediaProjection buffer |
No | Inspects composited SurfaceView media grid pixels |
wait_for_frame |
Blocks until next MediaProjection frame |
No | Waits for asynchronous openSession grid render |
control_status |
Hub ADB bridge check | Yes | Verifies USB or wireless debugging is authorized |
get_ui_hierarchy |
adb shell uiautomator dump |
Yes | Maps host Compose sheet bounds vs. system nodes |
control_tap / control_tap_text |
ADB input injection | Yes | Selects and deselects thumbnails inside the picker |
control_swipe |
ADB swipe gesture | Yes | Expands embedded bottom sheet or scrolls photo grid |
compare_frames |
Two adb exec-out screencap diffs |
Yes | Verifies smooth resize without surface flicker |
get_logcat |
adb logcat output stream |
Yes | Captures EmbeddedPhotoPickerClient URI callbacks & binder errors |
record_screen |
adb shell screenrecord (1–15s) |
Yes | Records video proof of z-order or resize regressions |
Privacy and Network Boundaries
All MediaProjection video frames travel directly from your Android phone to the ScreenSync MCP hub on your local network using SCREEN_SYNC_TOKEN bearer authentication. Frames are never sent to EpsolDev servers (a Google Drive fallback exists as an optional setting, never required). Keep in mind that whenever Claude Code or another MCP client explicitly calls get_latest_screenshot or control_screenshot, the returned image is sent to that agent's model provider—so always test with synthetic or staging photos on your test handset rather than sensitive personal galleries. Full details are documented in the ScreenSync data policy.
Implementing an Instrumented Embedded Photo Picker Target
Before Claude Code can run automated verification against your Android app, your project must satisfy Android's SdkExtensions version requirement, declare the embedded service query in AndroidManifest.xml, and log deterministic session events for logcat correlation. Missing any of these three pieces is the most common reason an embedded picker renders a blank SurfaceView.
Gradle Dependencies and Manifest <queries> Setup
Add the Jetpack Embedded Photo Picker artifact to your app module's build.gradle.kts. If your UI uses Jetpack Compose, include the Compose wrapper; if you embed directly inside a custom View or Fragment, use the core embedded library:
dependencies {
// Jetpack Compose wrapper for Embedded Photo Picker
implementation("androidx.photopicker:photopicker-embedded-compose:1.0.0-alpha03")
// Core View-based embedded artifact (used underneath by Compose)
implementation("androidx.photopicker:photopicker-embedded:1.0.0-alpha03")
}
Next, declare the explicit service intent query inside AndroidManifest.xml. Without this <queries> block on Android 11+ package visibility rules, EmbeddedPhotoPickerProvider cannot resolve the system provider package and silently fails to bind:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<queries>
<intent>
<action android:name="com.android.photopicker.core.embedded.EmbeddedService.BIND" />
</intent>
</queries>
<application ...>
...
</application>
</manifest>
Runtime Availability Check and PickVisualMedia Fallback
The Embedded Photo Picker requires Android 14 (API level 34) with SDK Extensions version 15 or higher. Always verify availability at runtime using SdkExtensions.getExtensionVersion and fall back gracefully to ActivityResultContracts.PickVisualMedia on older devices:
import android.os.Build
import android.os.ext.SdkExtensions
object PhotoPickerCapabilities {
fun isEmbeddedPickerSupported(): Boolean {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
return false
}
return SdkExtensions.getExtensionVersion(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) >= 15
}
}
Exposing Deterministic Session Telemetry in Kotlin
When testing asynchronously bound IPC surfaces, visual confirmation alone cannot tell you whether onUriPermissionRevoked fired when a user deselected an item, or whether notifyResized matched the container bounds. Instrument your EmbeddedPhotoPickerClient callbacks with structured Log.d markers so Claude Code can correlate pixel state with get_logcat:
import android.net.Uri
import android.util.Log
import android.widget.photopicker.EmbeddedPhotoPickerClient
import android.widget.photopicker.EmbeddedPhotoPickerSession
class InstrumentedPickerClient(
private val onSessionReady: (EmbeddedPhotoPickerSession) -> Unit,
private val onSelectionChanged: (List<Uri>, Boolean) -> Unit
) : EmbeddedPhotoPickerClient {
companion object {
private const val TAG = "EmbeddedPickerQA"
}
override fun onSessionOpened(session: EmbeddedPhotoPickerSession) {
Log.d(TAG, "SESSION_OPENED surfacePackageAttached=true")
onSessionReady(session)
}
override fun onSessionError(throwable: Throwable) {
Log.e(TAG, "SESSION_ERROR message=${throwable.message}", throwable)
}
override fun onUriPermissionGranted(uris: List<Uri>) {
Log.d(TAG, "URI_GRANTED count=${uris.size} uris=${uris.joinToString()}")
onSelectionChanged(uris, true)
}
override fun onUriPermissionRevoked(uris: List<Uri>) {
Log.d(TAG, "URI_REVOKED count=${uris.size} uris=${uris.joinToString()}")
onSelectionChanged(uris, false)
}
override fun onSelectionComplete() {
Log.d(TAG, "SELECTION_COMPLETE userConfirmed=true")
}
}
In Jetpack Compose, ensure your host layout isolates the picker state cleanly and renders an unmistakable selection counter badge above or alongside the SurfaceView so both get_ui_hierarchy and get_latest_screenshot can verify the host app's state update immediately. For broader Compose testability patterns, check our walkthrough on testing Jetpack Compose apps with Claude Code and MCP.
Step-by-Step Setup: Connecting Claude Code to ScreenSync MCP
Setting up Claude Code with ScreenSync MCP takes under five minutes: install the Android app on a physical device running Android 7.0 or later, unpack and launch the free Node.js 18+ hub on port 3000, pair over your local network, and register the stdio server in Claude Code.
Step 1: Launch the Desktop Hub (Node.js 18+)
Download and unpack the free ScreenSync MCP desktop hub (version 1.14.4) from the ScreenSync MCP setup guide. Verify Node.js 18+ is available, then launch the hub using the OS-appropriate script:
# macOS / Linux
cd /path/to/hub
./start-hub.sh
REM Windows
cd C:\path\to\hub
start-hub.bat
The hub binds HTTP on port 3000, prints your SCREEN_SYNC_TOKEN, and displays a pairing QR code in the terminal.
Step 2: Pair Your Android Handset and Authorize ADB
- Install ScreenSync MCP (
com.screensync.mcp, version 2.5.7) from Google Play onto your Android 14+ test phone (with SDK Extensions >= 15 for Embedded Photo Picker testing, plus an older Android 10–13 phone if verifying fallback behavior). - Connect the phone to the same Wi-Fi network as your workstation and either scan the hub's QR code or connect via mDNS auto-discovery.
- Grant the Android
MediaProjectioncapture prompt inside the app soget_latest_screenshotandwait_for_framework without root or ADB. - Enable USB debugging or wireless debugging on the phone and confirm ADB visibility from your workstation (
adb devices), which unlocksget_ui_hierarchy,get_logcat, and allcontrol_*input tools.
Step 3: Register ScreenSync MCP in Claude Code and Other Clients
Register the hub in Claude Code using the exact stdio command pointing to the unpacked screensync-hub.js file:
claude mcp add screensync node "/path/to/hub/screensync-hub.js"
If you prefer Claude Desktop, add mcpServers.screensync inside claude_desktop_config.json (accessible via Settings > Developer):
{
"mcpServers": {
"screensync": {
"command": "node",
"args": ["/path/to/hub/screensync-hub.js"],
"env": {
"SCREEN_SYNC_TOKEN": "your-local-hub-token"
}
}
}
}
ScreenSync MCP also works with Cursor and VS Code agent mode—check each editor's MCP documentation to configure a local stdio server pointing to screensync-hub.js. Note that ChatGPT's web app requires a remote HTTPS MCP server and is not supported.
Autonomous Verification Workflows for Embedded Photo Picker
Once paired, Claude Code can execute end-to-end Embedded Photo Picker test cases directly from your repository terminal. Because Claude Code sees both your Kotlin source code and the live Android handset, it verifies visual rendering, cross-process touch response, and logcat telemetry in one loop.
Workflow 1: Asynchronous Session Binding and Z-Order Verification
A classic Embedded Photo Picker regression occurs when SurfaceView z-ordering clashes with Compose overlays or ModalBottomSheet backdrops, causing thumbnails to either turn completely black or bleed over the host app's top app bar.
Run this verification prompt in Claude Code:
claude "Build and install our debug APK on the connected Android phone. Open the media composer screen, verify EmbeddedPhotoPickerSession binds without errors in logcat, and confirm the picker SurfaceView does not overlap the top toolbar or selection counter."
Behind the scenes, Claude Code executes a deterministic sequence:
- Runs
./gradlew installDebugin the terminal and launches the target activity. - Calls
get_device_statusandcontrol_statusto confirm bothMediaProjectionstreaming and ADB control are active. - Calls
wait_for_frameso it does not inspect the screen mid-transition while the out-of-process service binds. - Calls
get_ui_hierarchyto read exact pixel bounds for the host top toolbar, selection badge, and theandroid.view.SurfaceViewcontainer. Look at our deep dive on why your AI agent needs the Android UI hierarchy for more on pairing structural node bounds with pixels. - Calls
get_latest_screenshotto visually inspect the rendered grid inside theSurfaceViewbounds, verifying that thumbnails appear crisply inside the sheet without clipping or bleeding over the host toolbar. - Calls
get_logcatand confirmsEmbeddedPickerQA: SESSION_OPENED surfacePackageAttached=trueappears with zeroSESSION_ERRORorSurfaceControlViewHostexceptions.
Workflow 2: Testing Multi-Select Grant, Revoke, and Sheet Expansion
Because the Embedded Photo Picker stays live inside your layout, users frequently tap multiple photos, expand the picker sheet to full screen, deselect an item, and confirm that the host app's attachment tray updates synchronously.
Live Tool Sequence Executed by Claude Code
First, Claude Code inspects the half-expanded picker state and taps two grid items inside the SurfaceView bounds using control_tap:
{
"name": "control_tap",
"arguments": {
"x": 220,
"y": 1450
}
}
Next, Claude Code simulates a vertical drag upward to expand the bottom sheet and checks how notifyPhotoPickerExpanded(true) and notifyResized(width, height) behave during motion:
{
"name": "control_swipe",
"arguments": {
"startX": 540,
"startY": 1220,
"endX": 540,
"endY": 380,
"durationMs": 320
}
}
Immediately after the swipe, Claude Code invokes compare_frames (two ADB screenshots separated by delayMs) to detect surface tearing or black-frame flashes while the child SurfacePackage resizes, and calls get_ui_hierarchy to verify the host selection counter reads "2 selected".
Finally, Claude Code taps the first selected thumbnail a second time to revoke its URI grant, then queries get_logcat to verify that URI_REVOKED count=1 fired cleanly and the host app removed that URI from its staging queue without crashing on a revoked ContentResolver descriptor.
Workflow 3: Verifying Pre-Selected URIs and PickVisualMedia Fallback
Embedded Photo Picker sessions support pre-selected URIs and strict SdkExtensions >= 15 gating. To ensure backward compatibility across your device matrix:
- Test Pre-Selected State Restoration: Rotate the device or trigger an app background/foreground cycle (
os_*/ ADB lifecycle commands) while 2 photos are selected, then callget_latest_screenshotandget_logcatto verify the embedded grid still highlights the previously selected items and does not duplicateURI_GRANTEDcallbacks. - Test Fallback on Pre-Extension-15 Hardware: Run the identical Claude Code test prompt against an Android 12 or Android 13 test handset. Verify via
get_ui_hierarchythatPhotoPickerCapabilities.isEmbeddedPickerSupported()returnsfalseand the app falls back cleanly to the classic modalPickVisualMediasheet without requesting broadREAD_MEDIA_IMAGESruntime permissions. For detailed runtime permission testing patterns, see testing Android runtime permissions with Claude Code and MCP.
Debugging Common Embedded Photo Picker Failures with MCP
When an embedded picker fails in production, standard crash reporters rarely explain whether the culprit was a missing manifest <queries> entry, an unforwarded resize event, or a SurfaceView lifecycle race. Claude Code uses get_logcat, record_screen, and get_latest_screenshot together to isolate the exact root cause.
Failure 1: Blank SurfaceView Due to Missing <queries> or Wrong SdkExtensions
- Symptom: The bottom sheet opens,
get_ui_hierarchyshows aSurfaceViewoccupying the bottom half of the screen, andget_latest_screenshotshows a solid background color with zero thumbnails. - MCP Triage: Claude Code calls
get_logcatand spotsSecurityExceptionorUnable to resolve intent com.android.photopicker.core.embedded.EmbeddedService.BIND, or seesSdkExtensions.getExtensionVersion(34)returning12instead of>= 15. - Fix: Add the
<queries>intent declaration inAndroidManifest.xmland guard UI composition behindSdkExtensions.getExtensionVersion(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) >= 15.
Failure 2: Cut-Off Thumbnails or Unclickable Bottom Row After Sheet Expansion
- Symptom: After swiping the bottom sheet from half-height to full-height with
control_swipe, the bottom rows of thumbnails appear clipped or ignore taps. - MCP Triage: Claude Code captures
get_latest_screenshotalongsideget_ui_hierarchy. It observes that the host Compose container grew to2100pxheight while the embedded surface remained clipped at1050px. - Fix: Ensure
onGloballyPositionedorView.OnLayoutChangeListenerforwards updated pixel dimensions tosession.notifyResized(newWidth, newHeight)and callssession.notifyPhotoPickerExpanded(isExpanded)whenever the sheet state settles.
Failure 3: SurfaceView Punch-Through Over Compose Dialogs or Toolbars
- Symptom: Opening a confirmation dialog or scrolling a header above the embedded picker causes the photo grid to paint on top of the app's modal overlay.
- MCP Triage: Claude Code calls
record_screen(1 to 15 seconds via ADB) while opening the modal, then inspects frames withget_latest_screenshot. BecauseSurfaceViewpunches a hole through the window unless z-ordering is managed properly, dialogs render underneath the childSurfacePackage. - Fix: Avoid placing
SurfaceViewwithsetZOrderOnTop(true)beneath floating Compose overlays, or callsession.notifyVisibilityChanged(false)when obscuring modals open.
Failure 4: Premature ContentResolver Read After onUriPermissionRevoked
- Symptom: Deselecting an image inside the embedded picker triggers a delayed
SecurityException: Permission Denial: reading com.android.providers.media.photopicker.PhotoPickerProviderwhen the user taps "Upload". - MCP Triage: Claude Code taps a thumbnail twice (
control_tap), inspectsget_logcat, and matches theURI_REVOKEDtimestamp against the background upload coroutine attempting to open anInputStream. - Fix: Remove revoked URIs immediately inside
onUriPermissionRevoked(uris)before dispatching uploads, or copy confirmed attachments into app-private cache only afteronSelectionComplete()or final submit confirmation.
Integrating Cloud Media & Hybrid Browser Flows via ScreenSync MCP
Modern Android photo pickers do not just browse local DCIM folders—they also surface cloud media providers such as Google Photos and link into web-based asset portals. ScreenSync MCP's 226-tool architecture (29 mobile/desktop tools + 197 web_* browser tools) lets Claude Code verify both halves of a cross-surface workflow in a single session.
For instance, if your app integrates a web-based enterprise DAM or verifies that a photo uploaded through Android's Embedded Photo Picker appears cleanly in your web admin dashboard:
- Claude Code drives the Android Embedded Photo Picker via
get_latest_screenshot,get_ui_hierarchy, andcontrol_tapto attach and upload a test image. - Without switching tools or leaving the terminal, Claude Code invokes ScreenSync MCP's
web_*browser extension tools inside your real Chrome or Edge tab (protected by a human approval prompt for risky actions) to inspect the uploaded asset in your staging web portal.
If you are building hybrid media workflows that combine camera capture with gallery picking, you can also pair these checks with our guide on testing Android Camera and CameraX with Claude Code and MCP or compare local MCP tooling against traditional runners on our Android MCP servers comparison page.
Pre-Release QA Checklist for Embedded Photo Picker
Run this checklist with Claude Code before shipping any Android release that adopts androidx.photopicker:photopicker-embedded or photopicker-embedded-compose:
- Manifest & Extension Guard: Verify
<queries>includescom.android.photopicker.core.embedded.EmbeddedService.BINDandSdkExtensions.getExtensionVersion(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) >= 15gates all embedded instantiations. - Fallback Path Verified: Confirm Android 13 and older devices route cleanly to
PickVisualMediawithout declaringREAD_MEDIA_IMAGESunless explicitly required by another feature. - Resize & Expand Sync: Swipe through collapsed, half-expanded, and full-screen sheet states with
control_swipeand assert viacompare_framesthatnotifyResizedandnotifyPhotoPickerExpandedkeep thumbnails aligned and tappable. - Grant & Revoke Parity: Tap and untap multiple thumbnails and verify via
get_logcatthatonUriPermissionGrantedandonUriPermissionRevokedkeep the app's attachment list in exact sync. - Session Lifecycle Cleanup: Background the app, rotate orientation, and close the sheet; confirm
EmbeddedPhotoPickerSession.close()runs cleanly without leakedSurfaceControlViewHostbinders inlogcat.
To get started on real hardware today, install the free ScreenSync MCP Android app on Google Play, start the Node.js 18+ hub, and register screensync-hub.js in Claude Code. For deeper background on agent screen perception, explore what a screen MCP server is.
Next steps
Questions, answered
Why can Espresso not tap thumbnails inside Android Embedded Photo Picker?
Android's Embedded Photo Picker renders system media inside a cross-process SurfaceView using SurfaceControlViewHost.SurfacePackage. Because Espresso and ComposeTestRule run strictly inside your application process, view matchers only see the outer SurfaceView container and cannot query or tap thumbnails rendered by the system photo picker provider.
Does ScreenSync MCP need root or ADB to capture the Embedded Photo Picker?
ScreenSync MCP captures the rendered Embedded Photo Picker pixels through Android's MediaProjection API after per-session user consent, requiring zero root access and zero ADB. However, ADB over USB or wireless debugging is required to run control_tap, control_swipe, get_ui_hierarchy, and get_logcat during automated tests.
Which Android versions and SDK extensions support the Embedded Photo Picker?
The Embedded Photo Picker requires Android 14 (API level 34) or higher paired with Android SDK Extensions version 15 or above. Your Kotlin app must check SdkExtensions.getExtensionVersion(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) >= 15 at runtime and fall back cleanly to ActivityResultContracts.PickVisualMedia on older devices.
Why does the Embedded Photo Picker show a blank SurfaceView on Android 14+?
A blank SurfaceView usually indicates a missing <queries> intent declaration for com.android.photopicker.core.embedded.EmbeddedService.BIND inside AndroidManifest.xml or an insufficient SDK Extensions version. Using Claude Code with ScreenSync MCP's get_logcat tool reveals binder resolution failures immediately alongside the live captured frame.
How does Claude Code verify URI grants and revocations during photo selection?
During test execution, Claude Code taps thumbnails inside the SurfaceView bounds using control_tap, monitors host UI selection counters with get_ui_hierarchy, and queries system logs via get_logcat. Structured log markers inside onUriPermissionGranted and onUriPermissionRevoked confirm that your app synchronizes selected URIs without crashing.
How do you prevent SurfaceView z-order overlap above Compose toolbars or dialogs?
Because SurfaceView punches through the window hierarchy, floating Compose dialogs or top bars can render behind the embedded picker if z-ordering is misconfigured. Forward container size changes via notifyResized, call notifyVisibilityChanged(false) when obscuring modals appear, and verify frame layers with ScreenSync MCP's record_screen and compare_frames.
Can ScreenSync MCP test cloud media flows across both Android and Chrome?
Yes. The ScreenSync MCP desktop hub runs on Node.js 18+ and exposes 226 tools total: 29 phone and desktop tools plus 197 web_* browser tools through its Chrome and Edge extension. Claude Code can select photos on Android and immediately verify uploads in your staging web dashboard.
Are screenshots of test photos uploaded to EpsolDev servers during MCP testing?
No. MediaProjection frames travel strictly between your Android handset and your local desktop hub over your own network using SCREEN_SYNC_TOKEN authentication, never touching EpsolDev servers. Any screenshot an AI agent explicitly requests via get_latest_screenshot or control_screenshot is sent to that agent's model provider.




