ScreenSync MCP guide

Testing Android Desktop Windowing with Claude Code and MCP

Test Android desktop windowing, freeform resizing, connected displays, and multi-instance flows on real devices with Claude Code and ScreenSync MCP.

Minimalist 3D architectural render of an Android tablet showing floating translucent desktop windows linked by glowing purple fiber lines to an Android phone and developer laptop in deep navy lighting

Android 16 and Android 17 turn freeform desktop windowing from an optional tablet experiment into a core platform requirement. When users resize an app into a narrow vertical column beside another window, connect a phone over DisplayPort Alt Mode to an external monitor, or launch two instances side by side, rigid portrait assumptions break immediately—clipping toolbars behind desktop header bars, stretching CameraX viewfinders, and wiping form state during window configuration changes.

Connecting Claude Code to physical Android hardware through the Model Context Protocol (MCP) lets engineering teams test real desktop windowing behavior without writing brittle coordinate-hardcoded scripts. Using ScreenSync MCP, an Android and browser MCP server built by EpsolDev, Claude Code launches activities in freeform mode, drags window edges, inspects live UI hierarchy trees, monitors dumpsys window bounds, and captures sub-100 ms visual frames across every resize step.

Key Takeaways

  • Android 17 Removes Opt-Outs: Apps targeting API level 37 lose the temporary Android 16 escape hatches for android:screenOrientation, setRequestedOrientation(), and android:resizeableActivity="false" on displays with smallest width >= 600dp (excluding games).
  • Decoupled Capture vs. Control: ScreenSync MCP streams live frames over your LAN via Android's native MediaProjection API (~94 ms median mirror latency) with no root and no ADB, while interactive control (control_tap, control_swipe, control_type) and am start --windowingMode 5 run over ADB via USB or wireless debugging.
  • 226-Tool Verification Surface: The ScreenSync MCP desktop hub (Node.js 18+ on port 3000 over stdio) exposes 29 phone and desktop tools (12 control_*, 3 os_*, 14 capture/hub tools including get_latest_screenshot, get_ui_hierarchy, get_logcat, and record_screen) plus *197 `web_` browser tools**.
  • Touch-First vs. Desktop-First Modes: Testing must cover both tablet touch-first freeform windows and desktop-first connected-display sessions with physical mouse hover, right-click context menus, and Tab/arrow keyboard focus traversal.
  • Local-First Privacy Model: Screen frames travel strictly from the Android app (com.screensync.mcp) to your local hub on your network—never to EpsolDev servers—while screenshots explicitly pulled by an agent go to that agent's model provider.

Why Android 16 and 17 Desktop Windowing Breaks Fixed Mobile Layouts

Android 16 and Android 17 desktop windowing breaks fixed mobile layouts because the platform ignores locked portrait orientations and non-resizable manifest flags on displays at or above 600dp smallest width. Applications targeting API level 37 must reflow dynamically across arbitrary freeform bounds, desktop caption bars, and connected external monitors without restarting or clipping controls.

For over a decade, Android developers could shield complex screens from unexpected aspect ratios by declaring android:screenOrientation="portrait" or android:resizeableActivity="false" in AndroidManifest.xml. Android 16 began overriding those restrictions on large screens while still offering a temporary opt-out property for apps migrating their layouts. Android 17 (API level 37) removes that opt-out completely for non-game applications running on displays where smallestScreenWidthDp >= 600.

In desktop windowing environments—including Pixel Tablet desktop sessions, OEM desktop environments, and Android 16+ connected displays driven over USB-C DisplayPort Alt Mode—the operating system switches dynamically between two per-display behavioral modes:

  1. Touch-first mode: Used on standalone tablets and large foldables where touch input dominates. Apps typically open full screen or in split-screen until the user drags a window handle into freeform desktop mode.
  2. Desktop-first mode: Activated when an external monitor, hardware keyboard, mouse, or trackpad is attached. Windows open directly as freeform resizable panes with a persistent taskbar, window header caption bars, minimize/maximize/close controls, and desktop multi-instance switching.

When an app unprepared for continuous resizing enters desktop-first mode, four production regressions appear immediately:

  • Caption bar occlusion: Desktop windows render a top window header bar containing the app icon, title, and window controls. Layouts that assume only a mobile status bar exists—or ignore WindowInsets.Type.captionBar()—hide top search bars or back buttons behind the drag handle.
  • DisplayMetrics vs. WindowMetrics skew: Code that computes camera preview ratios, video player bounds, or custom canvas grids from resources.displayMetrics or Display.getRealSize() sizes UI against the entire 4K external monitor rather than the app's smaller freeform window bounds.
  • Activity recreation state loss: Dragging a window corner continuously fires screenSize, smallestScreenSize, and screenLayout configuration updates. Without rememberSaveable, ViewModel state preservation, or explicit configChanges handling, every drag tick destroys and recreates the Activity.
  • Singleton multi-instance collisions: Desktop users expect to open two side-by-side windows of an email client, document editor, or catalog browser. Shared static caches, single-file DataStore locks, or launchMode="singleTask" configurations cause one window to overwrite or hijack the other.
Platform Capability Standard Phone (< 600dp) Android 16 Large Screen / Connected Display Android 17 (API 37) Desktop Windowing QA Verification Focus
Orientation & Resizability Opt-Out Manifest screenOrientation honored Temporary developer opt-out available Opt-out removed for non-game apps (sw >= 600dp) Verify continuous resize from narrow phone width to wide desktop pane
Display Behavioral Mode Touch-first only Touch-first on tablet; developer preview for connected displays Per-display Touch-first or Desktop-first adaptation Test both finger drag handles and mouse/trackpad hover + keyboard navigation
Top Chrome & System Insets Status bar + cutout insets Desktop header bar introduces captionBar insets Persistent window header bar across freeform panes Audit WindowInsets.safeDrawing / captionBarPadding() against top actions
Viewport Sizing Source Full screen approximates app window Freeform window bounds diverge from monitor size Mandatory WindowMetrics decoupled from physical display Replace DisplayMetrics with WindowMetricsCalculator
Multi-Instance Execution Single active foreground task Side-by-side tasks on tablets and desktop mode Native multi-instance via taskbar and Alt + Tab Verify independent Task back stacks and isolated state holders

If your team already tests hinged devices, compare posture-driven reflows in our guide on testing Android foldables and adaptive layouts with Claude Code with continuous arbitrary freeform bounds on external monitors.

Configuring ScreenSync MCP and Claude Code for Desktop Windowing QA

Setting up ScreenSync MCP with Claude Code requires installing the free Android app (com.screensync.mcp) on Android 7.0+ hardware, launching the Node.js 18+ desktop hub on port 3000, and registering the stdio server in Claude Code. Screen capture runs over MediaProjection without root, while ADB powers freeform launch and input control.

Before automating desktop windowing checks, confirm that your workstation, Android device (tablet, foldable, or DisplayPort-capable phone/emulator), and local network meet these exact specifications:

  • Android Device: Physical Android phone or tablet (or large-screen desktop emulator) running Android 7.0 or later with the free ScreenSync MCP Android app on Google Play (com.screensync.mcp, version 2.5.7).
  • Desktop Hub: Download and extract the free ScreenSync MCP desktop hub (version 1.14.4) on Windows, macOS, or Linux with Node.js 18+ installed. Start the hub via start-hub.bat (Windows) or start-hub.sh (macOS/Linux), which runs HTTP on port 3000 and exposes the Model Context Protocol over stdio. Complete pairing instructions live in the ScreenSync MCP setup guide.
  • ADB Connection: Enable Developer Options and turn on USB Debugging or Wireless Debugging so adb devices lists the target hardware. ScreenSync MCP enforces a strict operational boundary: screen capture uses Android's native MediaProjection API after user consent each session (no root and no ADB required), whereas control tools (control_tap, control_type, control_swipe) and shell diagnostics (am start --windowingMode 5, dumpsys window) run through ADB from the hub.

Register the ScreenSync MCP server in Claude Code from your terminal:

claude mcp add screensync node "/path/to/hub/screensync-hub.js"

When pairing with Claude Desktop, Cursor, or VS Code agent mode, configure claude_desktop_config.json (found under Settings > Developer in Claude Desktop) using your hub's generated SCREEN_SYNC_TOKEN:

{
  "mcpServers": {
    "screensync": {
      "command": "node",
      "args": ["/path/to/hub/screensync-hub.js"],
      "env": {
        "SCREEN_SYNC_TOKEN": "your-local-hub-token"
      }
    }
  }
}

Scan the hub's QR code inside the Android app or let mDNS auto-discover the hub on your local Wi-Fi subnet. Screen frames stream directly from your device to your local hub—never passing through EpsolDev servers—at roughly 94 ms median live mirror latency in LAN tests, while any screenshot Claude Code explicitly fetches via get_latest_screenshot is sent to your configured AI model provider. Note that ChatGPT's web app requires remote HTTPS MCP endpoints and is not supported; use local stdio-capable clients such as Claude Code, Claude Desktop, Cursor, or VS Code agent mode. For architectural comparisons against other Android MCP servers, decoupling MediaProjection capture from ADB control prevents screencap serialization stalls during rapid window resizes.

Enabling Freeform Mode, Connected Displays, and Multi-Instance Windows via ADB

Enabling Android desktop windowing and multi-instance testing over ADB uses global freeform settings (enable_freeform_support), am start --windowingMode 5, and dumpsys window inspection. Claude Code issues these shell commands over the hub's ADB channel to spawn floating resizable windows and verify task bounds without manual device menu navigation.

On Pixel Tablet builds, Android 16/17 desktop emulators, or phones running freeform-capable ROMs, Claude Code first verifies or enables freeform windowing support via ADB before launching target activities:

# 1. Enable freeform windowing and force activity resizability during QA
adb shell settings put global enable_freeform_support 1
adb shell settings put secure force_resizable_activities 1

# 2. Verify connected displays (built-in panel + external DisplayPort monitor)
adb shell dumpsys display | grep -E "DisplayDeviceInfo|mCurrentLayerStack"

# 3. Launch the target activity directly in freeform desktop windowing mode (mode 5)
adb shell am start --windowingMode 5 -n com.example.app/.MainActivity

# 4. Inspect active task bounds, windowingMode, and caption insets
adb shell dumpsys window windows | grep -E "Window #|mBounds|windowingMode|mRequestedWidth"

Android's Activity Manager maps --windowingMode integers directly to window containers:

  • 1: Full-screen mode
  • 2: Pinned (Picture-in-Picture)
  • 3: Split-screen primary
  • 4: Split-screen secondary
  • 5: Freeform / Desktop windowing mode

To allow users and automated QA suites to open multiple independent windows of your app side by side in desktop mode, declare multi-instance support in AndroidManifest.xml using PROPERTY_SUPPORTS_MULTI_INSTANCE_SYSTEM_UI (and ensure launchMode is not restricted to singleInstance or singleInstancePerTask where multi-window duplication is intended):

<application
    android:name=".App"
    android:resizeableActivity="true">

    <property
        android:name="android.window.PROPERTY_SUPPORTS_MULTI_INSTANCE_SYSTEM_UI"
        android:value="true" />

    <activity
        android:name=".MainActivity"
        android:exported="true"
        android:launchMode="standard">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

Once multi-instance support is configured, Claude Code can launch two distinct freeform windows side by side via ADB using --windowingMode 5 alongside new-task intent flags or distinct instance extras, then verify that both tasks appear with separate bounds in dumpsys activity activities.

ADB Command Target Subsystem Desktop Windowing Purpose Expected Diagnostic Output
adb shell settings put global enable_freeform_support 1 Global WindowManager Unlocks freeform desktop windows on test builds enable_freeform_support reads 1 (reboot if OS requires)
adb shell settings put secure force_resizable_activities 1 ActivityTaskManager Forces legacy activities to resize in QA experiments Activities accept arbitrary freeform bounds
adb shell am start --windowingMode 5 -n <pkg>/<act> Activity Manager (am) Launches an activity directly inside a floating desktop window dumpsys window reports windowingMode=5
adb shell am start --windowingMode 5 -f 0x18000000 -n <pkg>/<act> Activity Manager (am) Spawns an adjacent/new task instance (NEW_TASK \| MULTIPLE_TASK) Two distinct Task IDs appear in dumpsys activity
adb shell dumpsys window windows WindowManagerService Reads exact mBounds [left,top][right,bottom] and insets Confirms window dimensions match requested resize
adb shell dumpsys display DisplayManagerService Lists internal and external DisplayPort Alt Mode displays Shows secondary display ID, density, and resolution

Auditing WindowMetrics, Header Bar Insets, and Camera Viewports in Jetpack Compose

Auditing Jetpack Compose apps for desktop windowing requires replacing full-display assumptions with WindowMetricsCalculator, applying WindowInsets.captionBar padding alongside edge-to-edge bars, and binding CameraX previews to actual window dimensions. Combining Compose UI unit tests with live device inspection eliminates clipped toolbars and stretched viewfinders.

The most common failure when an app moves from a phone screen to a desktop window is chrome collision: the app renders its TopAppBar under the OS-drawn desktop window header bar, or reads LocalConfiguration.current / DisplayMetrics incorrectly when calculating pane widths and camera aspect ratios.

In Jetpack Compose, use currentWindowAdaptiveInfo() from Material 3 Adaptive (androidx.compose.material3.adaptive) together with WindowMetricsCalculator and WindowInsets.safeDrawing (which merges status bars, navigation bars, display cutouts, and the desktop captionBar inset):

package com.example.desktopqa.ui

import android.app.Activity
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.captionBar
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import androidx.window.core.layout.WindowSizeClass
import androidx.window.layout.WindowMetricsCalculator

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DesktopReadyWorkspaceScreen(
    activity: Activity,
    modifier: Modifier = Modifier
) {
    val adaptiveInfo = currentWindowAdaptiveInfo()
    val windowSizeClass = adaptiveInfo.windowSizeClass
    val isExpanded = windowSizeClass.isWidthAtLeastBreakpoint(
        WindowSizeClass.WIDTH_DP_EXPANDED_LOWER_BOUND
    )

    // Compute actual freeform window bounds rather than physical monitor size
    val currentBounds = WindowMetricsCalculator.getOrCreate()
        .computeCurrentWindowMetrics(activity)
        .bounds

    Scaffold(
        modifier = modifier
            .fillMaxSize()
            .windowInsetsPadding(WindowInsets.safeDrawing),
        contentWindowInsets = WindowInsets.captionBar,
        topBar = {
            TopAppBar(
                title = {
                    Text(
                        text = "Workspace (${currentBounds.width()}x${currentBounds.height()})",
                        modifier = Modifier.testTag("desktop_topbar_title")
                    )
                }
            )
        }
    ) { innerPadding ->
        if (isExpanded) {
            Row(
                modifier = Modifier
                    .fillMaxSize()
                    .padding(innerPadding)
            ) {
                Box(
                    modifier = Modifier
                        .width(320.dp)
                        .fillMaxHeight()
                        .testTag("desktop_side_rail")
                ) {
                    Text("Navigation & Filters")
                }
                Box(
                    modifier = Modifier
                        .weight(1f)
                        .fillMaxHeight()
                        .testTag("desktop_detail_canvas")
                ) {
                    Text("Primary Detail Canvas")
                }
            }
        } else {
            Box(
                modifier = Modifier
                    .fillMaxSize()
                    .padding(innerPadding)
                    .testTag("compact_single_pane")
            ) {
                Text("Compact Window Layout")
            }
        }
    }
}

Notice two critical safeguards in this implementation:

  1. Caption Bar Inset Compliance: WindowInsets.safeDrawing and WindowInsets.captionBar ensure that even when an app draws edge to edge, the desktop window's close/maximize header bar never covers TopAppBar actions. If you are hardening system bar insets across mobile and tablet form factors, pair this check with our guide on testing Android edge-to-edge layouts with Claude Code and MCP.
  2. Window-Relative Camera & Media Viewports: When embedding a PreviewView or SurfaceView inside a resizable desktop window, size the container using the active window's WindowMetrics and aspect ratio rather than Display.getRealMetrics(). Otherwise, resizing a desktop window into a narrow column stretches or crops the camera stream—a defect you can verify directly on real hardware by pairing this workflow with testing Android Camera and CameraX with Claude Code and MCP.

Before running live hardware loops, Claude Code can also generate and run a Compose UI instrumentation check that asserts Modifier.testTag() layout transitions when container constraints shrink from expanded (1000.dp) to compact (380.dp):

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.ui.Modifier
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.unit.dp
import org.junit.Rule
import org.junit.Test

class DesktopWindowConstraintTest {
    @get:Rule
    val composeTestRule = createComposeRule()

    @Test
    fun topBarRemainsVisibleUnderConstrainedDesktopBounds() {
        composeTestRule.setContent {
            Box(modifier = Modifier.size(width = 420.dp, height = 680.dp)) {
                // Render root composable under test inside bounded container
                CompactOrExpandedContainer()
            }
        }

        composeTestRule.onNodeWithTag("desktop_topbar_title").assertIsDisplayed()
        composeTestRule.onNodeWithTag("compact_single_pane").assertIsDisplayed()
    }
}

For broader Compose semantic tree strategies (Modifier.testTag(), stability debugging, and state preservation), review our walkthrough on testing Jetpack Compose apps with Claude Code and MCP.

Driving Live Resize, Keyboard Traversal, and Mouse Hover Tests with Claude Code

Claude Code drives live desktop windowing QA on real Android hardware by combining ScreenSync MCP's get_ui_hierarchy node bounds with control_swipe window-handle drags, ADB key events, and get_latest_screenshot visual audits. This dual structural-and-visual loop catches clipped controls, broken Tab focus rings, and missing mouse hover states across every breakpoint.

In desktop-first environments, users interact with apps differently than on phones: they drag window edges continuously, press Tab or arrow keys to move across form fields, hover with a mouse cursor before clicking, and trigger context menus with secondary clicks.

Step-by-Step Agentic Resize & Input Loop

You can prompt Claude Code directly from your project root:

"Launch com.example.desktopqa/.MainActivity in freeform mode (--windowingMode 5), capture get_ui_hierarchy and get_latest_screenshot, drag the right window edge inward via control_swipe until the window narrows below 600dp, verify the side rail collapses cleanly without overlapping the desktop caption bar, and check get_logcat for activity restarts or Choreographer frame drops."

Under the hood, Claude Code orchestrates a closed verification loop using ScreenSync MCP's real tool surface:

  1. Spawn Freeform Window: Claude Code runs adb shell am start --windowingMode 5 -n com.example.desktopqa/.MainActivity and confirms windowingMode=5 via dumpsys window windows.
  2. Capture Initial Desktop State: Claude Code calls get_ui_hierarchy to locate desktop_side_rail, desktop_detail_canvas, and the window resize handle bounds, then calls get_latest_screenshot (streamed via MediaProjection at ~94 ms median latency) to inspect visual spacing below the window header bar.
  3. Drag Window Corner via control_swipe: Using the window border coordinates from dumpsys window / get_ui_hierarchy, Claude Code invokes control_swipe to shrink the freeform window from expanded width (>= 840dp) down to compact width (< 600dp).
  4. Prevent Coordinate Drift: Because window resizing shifts every button coordinate on screen, Claude Code never replays stale tap coordinates—it re-queries get_ui_hierarchy after each resize step to confirm compact_single_pane appeared and desktop_topbar_title stays outside the caption bar bounds. Using Android UI hierarchy trees for AI agents eliminates blind coordinate guessing across dynamic window sizes.
  5. Verify Keyboard Traversal & Hover Ergonomics: In Compose, ensure interactive desktop elements declare Modifier.hoverable(...) and predictable focusProperties / onPreviewKeyEvent shortcuts:
import androidx.compose.foundation.background
import androidx.compose.foundation.focusable
import androidx.compose.foundation.hoverable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsHoveredAsState
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.key.Key
import androidx.compose.ui.input.key.KeyEventType
import androidx.compose.ui.input.key.isCtrlPressed
import androidx.compose.ui.input.key.key
import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.ui.input.key.type
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp

@Composable
fun DesktopActionChip(
    label: String,
    onTrigger: () -> Unit,
    modifier: Modifier = Modifier
) {
    val interactionSource = remember { MutableInteractionSource() }
    val isHovered by interactionSource.collectIsHoveredAsState()

    val containerColor = if (isHovered) {
        Color(0xFF6541D6).copy(alpha = 0.22f)
    } else {
        MaterialTheme.colorScheme.surfaceVariant
    }

    Text(
        text = label,
        modifier = modifier
            .hoverable(interactionSource = interactionSource)
            .focusable(interactionSource = interactionSource)
            .onPreviewKeyEvent { keyEvent ->
                if (keyEvent.type == KeyEventType.KeyDown &&
                    keyEvent.isCtrlPressed &&
                    keyEvent.key == Key.Enter
                ) {
                    onTrigger()
                    true
                } else {
                    false
                }
            }
            .background(containerColor, RoundedCornerShape(8.dp))
            .padding(horizontal = 14.dp, vertical = 8.dp)
            .semantics { role = Role.Button }
    )
}

Claude Code validates focus order on the connected device by injecting adb shell input keyevent KEYCODE_TAB between get_ui_hierarchy reads (checking focused="true" on each expected node) and captures flickering resize transitions with record_screen. If your app implements ListDetailSceneStrategy for adaptive desktop panes, combine this loop with testing Android Navigation 3 with Claude Code and MCP to verify back-stack state across pane transitions.

QA Verification Phase ScreenSync MCP Tool / Channel Execution Layer Desktop Windowing Defect Caught
Window Launch & Bounds adb shell am start --windowingMode 5 ADB shell App ignores freeform bounds or forces full-screen lock
Live Window Resize control_swipe ADB input Frozen layout or slow measure pass during continuous drag
Structural Reflow Audit get_ui_hierarchy ADB accessibility tree Navigation rail fails to collapse below 600dp; lost focus node
Visual Chrome Check get_latest_screenshot MediaProjection (no root, no ADB) TopAppBar clipped under desktop window header caption bar
Resize Jitter Recording record_screen MediaProjection / hub capture Visual flicker, black frames, or CameraX aspect ratio stretch
Lifecycle & Crash Audit get_logcat ADB logcat Unexpected DESTROYED -> CREATED restart or Choreographer drops
Form & Text Retention control_tap, control_type ADB input Text input cleared when dragging across 600dp / 840dp breakpoints
Web Companion Sync web_* (197 browser tools) Chrome/Edge MV3 extension OAuth Custom Tab or desktop web dashboard breaks session handoff

Validating Multi-Instance State Isolation and Desktop Browser Continuity

Validating multi-instance state isolation in desktop windowing ensures two side-by-side windows of the same Android app do not corrupt shared DataStore files, overwrite active Room rows, or hijack each other's navigation state. ScreenSync MCP's 226-tool suite also spans Chrome and Edge tabs when desktop Android flows hand off to web dashboards.

When two instances of an application run side by side in freeform mode, state bugs that never surface on a single phone screen appear immediately:

  • Singleton ViewModel / Repository Contamination: Storing active selection IDs in an application-scoped singleton instead of a SavedStateHandle or per-Activity ViewModelStore causes scrolling or editing in Window A to mutate Window B unexpectedly.
  • Activity Result & Intent Routing Collisions: Opening a document or deep link from one window routes into the other instance if Intent flags or task affinities are misconfigured.
  • Concurrent Local Storage Writes: Multiple tasks writing to uncoordinated preferences or cache files simultaneously trigger stale reads or FileNotFoundException races.

Claude Code tests multi-instance isolation directly on physical hardware by launching two side-by-side freeform windows (--windowingMode 5 with distinct task flags), calling control_tap and control_type inside Window A's bounds from get_ui_hierarchy, interacting with Window B's bounds, and calling get_latest_screenshot and get_logcat to confirm zero cross-window state bleed or storage contention.

Just as desktop users multitask across multiple Android windows, they frequently move between a desktop-mode Android app and a desktop Chrome or Edge browser tab—for example, authenticating via OAuth, inspecting a SaaS admin panel, or verifying live checkout webhooks. Through the ScreenSync MCP browser extension (Chrome/Edge Manifest V3, v1.14.4), Claude Code accesses *197 `web_` browser tools alongside its 29 phone and desktop tools** (226 MCP tools total) inside the same session, complete with a built-in human approval prompt before risky browser actions execute.

Production Checklist for Android Desktop Windowing Verification

A production desktop windowing audit verifies API 37 resizability compliance, WindowInsets.captionBar clearance, WindowMetrics-driven viewports, multi-instance state isolation, and keyboard/pointer ergonomics on real hardware. Running this seven-step checklist with Claude Code and ScreenSync MCP prevents large-screen regressions before shipping to Google Play.

  1. Audit Target SDK 37 Manifest Compliance: Remove legacy android:screenOrientation locks and android:resizeableActivity="false" flags on non-game activities, and test under forced freeform bounds on smallestScreenWidthDp >= 600.
  2. Verify Freeform & Connected Display Geometry: Launch activities via adb shell am start --windowingMode 5 and confirm WindowMetricsCalculator bounds—never full-display DisplayMetrics—drive responsive panes and CameraX preview surfaces.
  3. Check Desktop Caption Bar Clearance: Inspect get_latest_screenshot and get_ui_hierarchy to confirm WindowInsets.safeDrawing / WindowInsets.captionBar keeps top app bar actions unobstructed beneath window title bars.
  4. Test Continuous Resize Without Activity Loss: Drag window borders across Compact (< 600dp), Medium (600–839dp), and Expanded (>= 840dp) breakpoints with control_swipe, checking get_logcat for unexpected activity recreation or Choreographer dropped frames.
  5. Validate Multi-Instance Isolation: Spawn two side-by-side tasks in freeform mode and verify SavedStateHandle, rememberSaveable, and local persistence remain isolated per window.
  6. Verify Desktop-First Keyboard & Mouse Input: Test KEYCODE_TAB focus traversal via get_ui_hierarchy, Modifier.hoverable visual feedback, and keyboard shortcuts (onPreviewKeyEvent).
  7. Audit Local Security Boundaries: Keep ScreenSync MCP media streaming confined to your firewalled development LAN and use staging accounts whenever Claude Code captures screenshots for model analysis.

Ready to test Android 16 and 17 desktop windowing on real devices directly from your terminal? Visit ScreenSync MCP to grab the free Android app on Google Play, start the local Node.js hub, and pair Claude Code in minutes.

Next steps

FAQ

Questions, answered

What changed for desktop windowing in Android 16 and Android 17?

Android 16 introduced large-screen desktop windowing and connected display previews with a temporary developer opt-out. Android 17 (API level 37) removes that opt-out completely for non-game apps on displays at least 600dp wide, ignoring fixed orientation locks and non-resizable manifest flags so apps must adapt to freeform windows.

How does ScreenSync MCP capture desktop windowing screens without root?

ScreenSync MCP captures the live Android display through Android's native MediaProjection API after user consent each session, requiring zero root access and zero ADB overhead for video streaming. Interactive device control tools such as control_tap, control_swipe, and control_type execute separately through ADB over USB or wireless debugging.

How do I launch an Android app in freeform desktop mode using ADB?

Enable freeform support via adb shell settings put global enable_freeform_support 1, then launch your activity using adb shell am start --windowingMode 5 -n package/.ActivityName. Windowing mode 5 places the task inside a floating, resizable desktop window whose bounds can be verified with dumpsys window windows.

How can Claude Code verify that desktop header bars do not clip my TopAppBar?

Claude Code pairs get_ui_hierarchy with get_latest_screenshot through ScreenSync MCP. After launching the activity in freeform windowing mode, Claude Code reads exact node bounding boxes to verify WindowInsets.captionBar clearance and inspects the MediaProjection frame visually to confirm top app bar buttons remain unoccluded.

Does ScreenSync MCP support testing multi-instance Android windows side by side?

Yes. Once an app declares PROPERTY_SUPPORTS_MULTI_INSTANCE_SYSTEM_UI and avoids restrictive singleInstance launch modes, Claude Code can spawn two freeform tasks via ADB, drive independent interactions with control_tap and control_type, and inspect get_ui_hierarchy and get_logcat to verify isolated per-window state and storage.

Which AI coding clients work with ScreenSync MCP for Android desktop windowing QA?

ScreenSync MCP works with local MCP clients that communicate over stdio, including Claude Code, Claude Desktop, Cursor, and VS Code agent mode. ChatGPT's web app requires remote HTTPS MCP servers and is not supported. ScreenSync MCP targets Android 7.0+ devices, the desktop hub, and Chrome/Edge extensions.

How many MCP tools are included in ScreenSync MCP for mobile and browser testing?

ScreenSync MCP includes 226 MCP tools in total: 29 phone and desktop tools—covering 12 control_* actions, 3 os_* tools, and 14 capture and hub tools such as get_latest_screenshot, get_ui_hierarchy, get_logcat, and record_screen—plus 197 web_* browser automation tools via the Chrome/Edge extension.

Where are screen frames sent when Claude Code tests desktop windowing?

Live screen frames stream from the ScreenSync MCP Android app directly to your local Node.js desktop hub over your own network, never passing through EpsolDev servers (Drive fallback is optional). Any screenshot an AI agent explicitly requests via get_latest_screenshot is sent to that agent's model provider.

Written by

ScreenSync MCP team

The ScreenSync MCP team at EpsolDev builds the Android app, the desktop MCP hub and the browser extension that let AI agents see and control a real phone. These guides come out of that work.