Skip to content

fix(mobile): correct text and layout scaling in Samsung DeX - #20198

Closed
badaverse wants to merge 8 commits into
stablyai:mainfrom
badaverse:investigate/samsung-dex-text
Closed

badaverse wants to merge 8 commits into
stablyai:mainfrom
badaverse:investigate/samsung-dex-text

Conversation

@badaverse

@badaverse badaverse commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Samsung DeX can show clipped text and navigation content at the wrong size. This change makes navigation frames use the density of their own display, alongside the Activity density handling now included in main.

What Changed

Backport per-view frame conversion in react-native-screens 4.24.0 and register its pnpm patch. Merge main at 2b21c904a85b and reuse its Android window-density plugin (#36977), removing this PR's duplicate lifecycle plugin and its obsolete transform tests. The remaining diff is four mobile patch/configuration/documentation files.

Why

The Activity metrics fix is now upstream. Keeping a second plugin would generate duplicate lifecycle overrides and fail prebuild. Retaining only the screens conversion patch avoids that conflict without upgrading the React Native stack.

Linked Issue

Fixes #18841

Visual Proof

Current implementation — Android emulator, 1920×1080 external display at 160dpi

The screens patch is present in both images. Disabling Activity synchronization reproduces clipped text; enabling it restores readable text.

Activity synchronization disabled

Activity synchronization disabled

Activity synchronization enabled

Activity synchronization enabled

Physical Fold8 — Android 17 / One UI 9.0

Before

Fold8 DeX before

After

Fold8 DeX after

The evidence above predates this refresh; the integration with #36977 has not been revalidated on a physical device.

Testing

  • Manually tested the refreshed integration on a device
  • Automated checks completed; obsolete duplicate-plugin tests removed

On macOS: frozen-lockfile mobile install passed with scripts disabled; the installed Kotlin source contains the per-view density conversion. Expo config introspection passed with the existing rotation-lock and window-density plugins. The changed-code quality gate passed against main. No new TypeScript implementation remains. Android compilation and phone/DeX transitions are still unverified on this revision.

Risk

Level: Medium. Android navigation frames may scale incorrectly during display transitions. The patch changes conversion only when screens updates its state; it does not add an update trigger. Revert the patch registration, patch file, and lockfile changes to back it out. No persisted data or remote protocol changes.

AI Disclosure

Refreshed with OpenAI Codex (GPT-6).

Review

Checked overlap with upstream Android lifecycle handling and confirmed the frozen installation applies the patch. Physical DeX, split-screen, folding, keyboard, and touch-alignment checks remain necessary.

Agent skill upstream boundary

  • No upstream skill-installer code or assets copied.

Notes

Android rendering only; no SSH routing, git-provider, folder-workspace, or wire-format changes. iOS and desktop behavior are unchanged.

Checklist

  • This PR is small and focused
  • Explained user-facing behavior, mechanism, and reuse of upstream handling
  • Stated risk and rollback
  • Earlier visual evidence attached, with revalidation limit noted
  • Self-reviewed scope and compatibility
  • Cross-platform and remote impact considered
  • Full lint, typecheck, tests, and Android build

@coderabbitai

coderabbitai Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 69089c6c-a537-4eab-9d24-21da754691eb
Commits

Reviewing files that changed from the base of the PR and between dd978bf and 5ee685b.

Files ignored due to path filters: 1
  • mobile/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 2
  • mobile/patches/android-display-density.md
  • mobile/pnpm-workspace.yaml

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The change registers a patch for [email protected]. The patch converts width, height, and headerHeight from pixels to DIP using the view’s display density, with a fallback when that density is not positive. Documentation describes the patch, its limitations, maintenance steps, and device validation.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 5ee68

The change applies a documented patch so navigation frames in Samsung DeX use the density of their own display. No concrete defect remains. Verifying phone-to-DeX transitions on a device before release is still advisable.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title "fix(mobile): correct text and layout scaling in Samsung DeX" matches the main change. The PR backports per-view display-density frame conversion from react-native-screens 4.24.0 to fix clip…
Description check Passed The description follows the template well. It has ELI5, What Changed, Why, Linked Issue (Fixes #18841), Visual Proof, Testing, Risk (Level: Medium, with rollback), AI Disclosure, Review, Agent skill u…
Linked Issues check Passed Issue #18841 reports incorrect Orca Mobile rendering on Samsung DeX and has no specific acceptance criteria. The PR adds per-view density conversion in [email protected] and registers the …
Out of Scope Changes check Passed The reviewed changes are limited to the Android screens patch, its pnpm patch registration, and related mobile documentation/configuration. The density conversion and configuration support issue #18…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check

Explanation

The title "fix(mobile): correct text and layout scaling in Samsung DeX" matches the main change. The PR backports per-view display-density frame conversion from react-native-screens 4.24.0 to fix clipped text and wrongly sized navigation content in Samsung DeX. The title names the right area (mobile), the problem (text and layout scaling), and the context (Samsung DeX). It does not name the specific mechanism, but it is specific enough for a teammate to identify the change.

Full details: Description check

Explanation

The description follows the template well. It has ELI5, What Changed, Why, Linked Issue (Fixes #18841), Visual Proof, Testing, Risk (Level: Medium, with rollback), AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. The Visual Proof section gives before and after images for the emulator and the Fold8, and it notes that the evidence predates this refresh. The Testing section is mostly complete, but the 'Manually tested the refreshed integration on a device' box is unchecked and the author says Android compilation is unverified. The Linked Issue section uses 'Fixes #18841', which is correct. The description is mostly complete, so it passes. The author should state the open verification gaps clearly before merge.

Full details: Linked Issues check

Explanation

Issue #18841 reports incorrect Orca Mobile rendering on Samsung DeX and has no specific acceptance criteria. The PR adds per-view density conversion in [email protected] and registers the patch for the mobile dependency. The PR also reuses the existing Android window-density handling described in the current summary. These changes directly address display-density and layout scaling on external displays.

Full details: Out of Scope Changes check

Explanation

The reviewed changes are limited to the Android screens patch, its pnpm patch registration, and related mobile documentation/configuration. The density conversion and configuration support issue #18841. No unrelated product area or protocol change is established. The excluded mobile/pnpm-lock.yaml is intentionally unavailable and is not evidence of an out-of-scope change.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 8bbb84df-ecfe-4505-af1b-dd0e0dc67c5d

📥 Commits

Reviewing files that changed from the base of the PR and between 556a777 and e6cc447.

⛔ Files ignored due to path filters (1)
  • mobile/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • mobile/app.json
  • mobile/patches/android-display-density.md
  • mobile/patches/[email protected]
  • mobile/plugins/android-display-density.js
  • mobile/pnpm-workspace.yaml
  • mobile/src/platform/android-display-density-plugin.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

This PR fixes Samsung DeX text clipping and undersized content by synchronizing React Native's display metrics with the Activity hosting the app, plus a backport of the react-native-screens per-view frame conversion.

  • Activity display-density config plugin — new mobile/plugins/android-display-density.js (withMainActivity) injects DisplayMetricsHolder.initDisplayMetrics(this) before super.onCreate(null), re-syncs and emits didUpdateDimensions after creation, and re-syncs on onResume / onConfigurationChanged; registered in mobile/app.json. Fails loudly on non-Kotlin or drifted templates, and is MARKER-guarded for idempotency.
  • react-native-screens 4.24.0 patch — divides frame px by the view's resources.displayMetrics.density (fallback PixelUtil.getDisplayMetricDensity()), matching upstream #4160's pxToDp behavior for the pinned 4.24.0 that predates the fix.
  • Tests and docs — transform tests for lifecycle insertion, LF/CRLF idempotency, incompatible-template rejection, and changed-anchor failure; mobile/patches/android-display-density.md; lockfile/workspace patchedDependencies wiring.

I verified during review that the screens patch context matches the published [email protected] source exactly (so it applies cleanly), that PixelUtil.getDisplayMetricDensity() and DisplayMetricsHolder.getDisplayMetricsWritableMap(Double) are public in RN 0.83.10, that the lockfile patch hash equals the patch file's sha256, and that the new files pass oxfmt --check and oxlint. The documented limitations (process-global metrics holder, un-isolated screens patch necessity, Activity recreation on density transitions, and #16018 coordination) are accurate and appropriately scoped.

Pullfrog  | View workflow run | Using openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

Re-reviewed the delta since the prior pullfrog review at e6cc4471be (which found no issues): the follow-up commit d62f6ab3f3 that makes the config plugin preserve the MainActivity template's line endings.

  • Preserved template EOL in every plugin insertion — applyActivityDisplayDensity now detects \r\n vs \n once and applies it to the injected METHODS block, the DisplayMetricsHolder import, and the onCreate anchor replacement, so a CRLF template no longer gains bare-LF lines.
  • Hardened the CRLF test — the lifecycle test now strips the detected eol from the result and asserts no residual \r/\n remain, and its exact-content assertions are eol-parameterized.

I verified the extracted transform stays idempotent, adds the import, and produces no lone line endings for both \n and \r\n inputs; the strengthened assertions would fail against the pre-fix code (bare LFs leak into the CRLF result). This cleanly closes the line-ending concern raised by CodeRabbit.

Pullfrog  | View workflow run | Using openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@badaverse

Copy link
Copy Markdown
Contributor Author

I'd like to help unblock DeX support, since it has been stalled for a while.

The triage note on #8592 says reproduction is blocked because there is no DeX-capable device. That's completely understandable, since no team can own every device. So let me fill that gap: I have a Galaxy Z Fold8 (Android 17 / One UI 9.0), and I'm happy to verify this PR, or any other DeX-related PR, on real hardware and post screenshots or recordings. I can keep doing this for future DeX changes too.

I don't think this is a niche edge case. DeX + Orca Mobile is one of the most natural ways to use Orca remotely: a phone you already carry, plugged into a monitor and keyboard, gives you a full desktop view of your remote host's worktrees and agents. Right now that setup is unusable. There are two open issues (#8592, #18841) and independent reproductions from several people on different devices.

For reference, here are the three open PRs touching this area:

PR Scope Size
#20198 (this one) Fixes the display-density mismatch: clipped text, content filling only part of the window +193/-9
#16018 Full responsive-layout rework driven by window bounds +2,540/-381
#20489 Terminal startup stabilization + Android window rendering +1,771/-1,303

Whichever direction you choose, I'll verify the relevant PRs on the device. Just tell me what you'd like checked.

cc @nwparker

@badaverse

Copy link
Copy Markdown
Contributor Author

I tested the latest Orca Mobile release in Samsung DeX and can confirm that the rendering problem is now fixed on my setup.

Closing this PR because I no longer have a remaining issue that requires its patch. Thanks for the Android window-density fix in #36977 and the related work!

I will also update #18841 with this confirmation.

@badaverse badaverse closed this Nov 3, 2026
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.

[Bug]: Orca Mobile does not render correctly on Samsung Dex

1 participant