Repository navigation
fix(android): enable split-screen/multi-window for Samsung devices - #9190
techinpark wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughAndroid configuration registers a new local Expo plugin. The plugin updates the main Android activity to enable resizing and merges required 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 277a26a8-5907-41ab-bfc6-ce3efc0fab76
📥 Commits
Reviewing files that changed from the base of the PR and between 1c54171 and 3d5a619692980959a64dbced85ea29c655266b01.
📒 Files selected for processing (13)
mobile/app.jsonmobile/plugins/android-split-screen-fix.jssrc/cli/args.tssrc/cli/handlers/core.tssrc/cli/runtime/launch.tssrc/main/index.tssrc/main/runtime/device-registry.tssrc/main/runtime/runtime-rpc.tssrc/renderer/src/components/sidebar/PairedDevicesPanel.tsxsrc/renderer/src/components/sidebar/index.tsxsrc/renderer/src/web/web-pairing.tssrc/shared/mobile-relay-pairing-offer.tssrc/shared/runtime-types.ts
There was a problem hiding this comment.
🧹 Nitpick comments (3)
src/main/runtime/runtime-rpc.ts (3)
561-565: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRename
revokeMobileDeviceto reflect its broadened scope.Since this method now revokes both
mobileanddesktopscoped devices, consider renaming it torevokeRemoteDevice(and updating its callers) to better reflect its new behavior.
701-712: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSimplify relay revocation logic for desktop pairing.
Since desktop pairing explicitly rejects relays, the
connectionModeargument no longer influences relay behavior. TheswitchingPendingToLocalcheck, copied from the mobile logic, can be safely removed. Any hypothetically stranded relay bindings on a desktop pending device (e.g., from older, unreleased buggy builds) can simply be revoked when a rotation is requested.♻️ Proposed refactor
- const switchingPendingToLocal = - args.connectionMode === 'local-only' && pending?.relayBinding !== undefined - if (args.rotate || switchingPendingToLocal) { - if (pending?.relayBinding) { - this.queueRelayDeviceRevoke(pending.relayBinding) - } + if (args.rotate && pending?.relayBinding) { + this.queueRelayDeviceRevoke(pending.relayBinding) } const direct = this.createPairingOffer({ ...args, - rotate: args.rotate || switchingPendingToLocal, + rotate: args.rotate, scope: 'desktop' })
1115-1126: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRename
MOBILE_RPC_METHOD_ALLOWLISTto reflect its broadened scope.Now that this allowlist gates both
mobileanddesktopscopes (and the error message correctly refers to "remote clients" on line 1121), consider renaming the constant (defined on line 164) toREMOTE_RPC_METHOD_ALLOWLISTfor clarity.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f02457ee-5f9c-4f4a-8fa4-96c0f4779d01
📥 Commits
Reviewing files that changed from the base of the PR and between 3d5a619692980959a64dbced85ea29c655266b01 and 6d37a024d3b6a00aa019ebfbae59030fb8a63622.
📒 Files selected for processing (3)
mobile/app.jsonsrc/main/runtime/runtime-rpc.tssrc/renderer/src/components/sidebar/PairedDevicesPanel.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/components/sidebar/PairedDevicesPanel.tsx
|
thanks for the PR. @Jinwoo-H will review it soon |
Samsung OneUI requires explicit android:resizeableActivity=true in the main activity manifest to render correctly in split-screen and pop-up window modes. Without it the app letterboxes instead of filling the split. Changes: - Introduce android-split-screen-fix.js config plugin to inject resizeableActivity and screenSize|smallestScreenSize|density|orientation |screenLayout into the activity's configChanges so resizing does not trigger an activity restart. - Register the plugin in app.json; keep resizeableActivity out of app.json directly because Expo's schema does not expose that field. Fixes: Samsung Android split-screen 'does not fill the screen' issue
6d37a02 to
29afdcf
Compare
|
Maintainer review. I dug into this against the real Expo SDK 55 prebuild pipeline, and unfortunately this change is very close to a no-op on the manifest Orca actually ships — for reasons that aren't obvious from reading the diff. Details below so the analysis is reproducible. 1. The
|
|
I’m working through the mobile bug shortlist, including this Android split-screen lifecycle fix. I’ll review and credit the original patch, reproduce the activity restart, and validate a focused fix on an Android emulator with before/after evidence. |
|
Thanks @techinpark for the original multi-window patch. I reviewed it and checked the native Android behavior before adapting it. I could not reproduce ordinary split-divider resizing restarting Orca in the tested current configuration. Expo 55.0.31's actual template and a clean Android prebuild at android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode|smallestScreenSize"I then installed the official v0.0.58 APK (versionCode 22; SHA-256 With Settings beside Orca, I opened “Paste pairing code,” typed Two sizes from the unmodified app: As a separate control, ELI5: the current app already keeps its place when the divider moves. Changing Android's display scale is a different operation and can still reset the open drawer. I'm recording the ordinary split-resize report as not reproduced in this environment, with no replacement split-screen PR. This does not establish Samsung One UI behavior; that needs Samsung-specific reproduction evidence. The remaining |
|
@nwparker following up on your request for Samsung-specific evidence: #36305 has logs and videos from a Galaxy Z Fold7 (One UI 9.0, Android 17).
So |
|
Thanks for this! Split screen is now fixed in #36977, which adds |


Summary
Adds an Expo config plugin that patches the Android
MainActivitymanifest entry for multi-window support: it setsandroid:resizeableActivity="true"and addssmallestScreenSize+densitytoandroid:configChanges.Be aware of what actually does the work here.
resizeableActivityis largely a no-op on the SDK this app targets — it defaults totruefortargetSdk >= 24and is ignored entirely on API 31+, and this app is on Expo 55 / RN 0.83. The real fix is theconfigChangeshalf: Expo's template omitssmallestScreenSizeanddensity, so dragging the split-screen divider destroys and recreates the activity, remounting the React tree and losing UI state. Adding those two keys is what makes split-screen usable rather than merely permitted.I'd suggest the title undersells it — this is closer to "stop the activity restarting on split-screen resize" than "enable split-screen".
ELI5
On Android you can run two apps side by side and drag the divider to resize them. Orca was being torn down and rebuilt from scratch every time you dragged that divider, so whatever you were looking at got reset. This tells Android "I can handle being resized myself, don't restart me," so dragging the divider just resizes the app smoothly.
The other half of the change — the part the title is about — turns out to have no effect on modern Android, and I've said so rather than claiming credit for it.
Proof of fix
The mobile Vitest suite cannot run in this environment —
mobile/tsconfig.jsonextendsexpo/tsconfig.base.json, which fails to resolve here (TSConfckParseError). I confirmed this is pre-existing and unrelated to this PR by reproducing it on unmodifiedmainwith an existing test (src/host-route-action-state.test.ts→ same error,Tests no tests). So I proved the plugin by driving it directly with a stubbedexpo/config-plugins, feeding it Expo SDK 55's real template value forMainActivity:Edge cases, same harness:
Idempotency matters because
expo prebuildruns repeatedly; a naive string concat would accumulate duplicates. The plugin uses aSet, so it doesn't.Registration verified — a config plugin that isn't listed in
app.json'spluginsarray is dead code. The diff adds"./plugins/android-split-screen-fix.js"to that array, alongside the existingandroid-respect-rotation-lock.js.I did not run
expo prebuildand diff the generatedAndroidManifest.xml. That would be stronger, but it needs the Android SDK and network access that aren't available here. Stating that plainly rather than implying a verification I didn't perform.Proof of no regressions
configChanges; the probe confirmsREMOVED = (none)and that all six Expo defaults survive.withAndroidManifestis Android-only; no iOS code path or config is modified.app.json. No TypeScript, no runtime behavior outside the manifest.expo/tsconfig.base.jsonresolution failure, reproduced on cleanmain). No test was modified or removed.Behavior that changes for users: on Android, dragging the split-screen divider no longer recreates the activity, so in-progress UI state survives a resize. Nothing else.
Compatibility
resizeableActivityhas no effect on API 31+ (this app's target), so on current devices the observable change is entirely fromsmallestScreenSize/density. On older devices (API 24–30) the explicitresizeableActivity="true"is a harmless restatement of the default. iOS, macOS, Linux, and Windows are untouched.Screenshots
No screenshot. Split-screen behavior can only be demonstrated on a physical Samsung/Android device or emulator, which isn't available in this environment, and a mocked-up image would not evidence anything. The manifest transformation — which is the entire change — is shown as literal before/after output under Proof of fix.
Testing
pnpm lint— not run; this PR touches onlymobile/, and the root lint suite does not cover it.pnpm typecheck— not applicable; the plugin is plain CommonJS JavaScript with no TypeScript surface, andapp.jsonis data.pnpm test— cannot run. Themobile/Vitest suite fails to start in this environment onexpo/tsconfig.base.jsonresolution; verified pre-existing on cleanmain, not caused by this PR.pnpm build— not run (requires the Android SDK).resizeableActivity, idempotency, bare-activity) but did not include it, because the suite it would live in cannot execute here and I won't add a test I can't demonstrate passing. The same five cases are proven above via the standalone harness. A maintainer who can runmobiletests should land that spec; I'm happy to attach it.AI Review Report
Reviewed with Claude Code (Opus 5). Cross-platform review confirmed: this is an Android-only, build-time manifest change with no shortcut, label, path, shell, or Electron surface, and no iOS effect. Findings:
resizeableActivitydefaults totrueattargetSdk >= 24and is ignored on API 31+; on Expo 55 / RN 0.83 that means the headline attribute changes nothing on any device users are likely running. Reported honestly in## Summaryrather than shipping a placebo. TheconfigChangeshalf is real and is why the PR is worth landing.configChangescauses destroy/recreate on every resize; the plugin adds exactlysmallestScreenSizeanddensity, the two Expo omits.app.json'spluginsarray. An unregistered plugin is silent dead code.Set-based union, verified to preserve all existing keys, produce no duplicates across repeated application, and handle an activity with noconfigChangeswithout emitting an empty token.resizeableActivityis set on<activity>viagetMainActivityOrThrow, which is correct; it is valid on both<activity>and<application>, and the activity-level placement is the narrower, intended one.com.samsung.android.multidisplay.keep_process_alive), which I'd have flagged as unjustified.Security Audit
expo/config-pluginsis already a transitive dependency used by the existingandroid-respect-rotation-lock.jsplugin.resizeableActivityandconfigChangesdo not widen the app's attack surface.Notes
mobilesuite can run; it's a straight port of the harness cases shown above.Original patch by @techinpark.