Skip to content

feat: add default screen size detection and 960p screen size option (e.g. retroid pocket nova) - #1730

Open
joshuatam wants to merge 7 commits into
utkarshdalal:masterfrom
joshuatam:feat/add-960p-screen-size
Open

feat: add default screen size detection and 960p screen size option (e.g. retroid pocket nova)#1730
joshuatam wants to merge 7 commits into
utkarshdalal:masterfrom
joshuatam:feat/add-960p-screen-size

Conversation

@joshuatam

@joshuatam joshuatam commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

feat: add 960p default screen size (e.g. retroid pocket nova)

Recording

Screenshot_20260717_120030

Type of Change

  • Bug fix
  • Performance / stability improvement
  • Compatibility improvements
  • Other (requires prior approval)

Checklist

  • If I have access to #code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.
  • This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
  • I have attached a recording of the change.
  • I have read and agree to the contribution guidelines in CONTRIBUTING.md.

Summary by cubic

Add 1280x960 (4:3) and auto-detect the default screen size via DisplayManager with a getRealMetrics fallback and caching. Apply the detected aspect ratio to defaults for preferences, new containers, XServer state, imports, and launches (4:3, 16:10, or 16:9; 16:9 fallback), and fix config merging so screen-size overrides are respected — improving support for 960p handhelds like the Retroid Pocket Nova.

  • Refactors
    • Removed unused createDefaultContainerFuture in ContainerManager.

Written for commit 425e8d1. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added 1280×960 (4:3) as a selectable screen resolution option.
  • Improved Defaults

    • Default screen-size is now chosen automatically based on the device’s display characteristics, selecting the closest aspect ratio (16:9, 16:10, or 4:3).
    • This improved default is applied consistently across new containers, saved settings, and configuration parsing, with a safe fallback when display details can’t be determined.

@joshuatam
joshuatam requested a review from utkarshdalal as a code owner July 17, 2026 03:42
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review 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
📝 Walkthrough

Walkthrough

Screen-size configuration now defines explicit 16:9, 16:10, and 4:3 presets, detects the device aspect ratio at runtime, and uses the detected preset across preference, state, container-data, and intent defaults. A new 1280x960 (4:3) option is available.

Changes

Screen Size Defaults

Layer / File(s) Summary
Screen size presets and resource option
app/src/main/java/com/winlator/container/Container.java, app/src/main/java/com/winlator/container/ContainerManager.java, app/src/main/res/values/arrays.xml
Defines separate 16:9, 16:10, and 4:3 constants, keeps default container creation at 16:9, and adds the 1280x960 (4:3) option.
Runtime aspect-ratio detection
app/src/main/java/app/gamenative/PluviaApp.kt
Reads display dimensions, selects an aspect-specific preset, caches the result, and falls back to 16:9 when display information is unavailable or fails.
Dynamic default propagation
app/src/main/java/app/gamenative/PrefManager.kt, app/src/main/java/app/gamenative/ui/data/XServerState.kt, app/src/main/java/app/gamenative/utils/IntentLaunchManager.kt, app/src/main/java/com/winlator/container/ContainerData.kt
Uses PluviaApp.getDefaultScreenSize() for preference, state, container-data, and intent configuration defaults and merge checks.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PluviaApp
  participant DisplayManager
  participant Display
  participant PrefManager
  participant IntentLaunchManager
  PluviaApp->>DisplayManager: Obtain the default display
  DisplayManager-->>PluviaApp: Return the display
  PluviaApp->>Display: Read display dimensions
  Display-->>PluviaApp: Return width and height
  PluviaApp->>PluviaApp: Select aspect-specific preset
  PrefManager->>PluviaApp: Request default screen size
  IntentLaunchManager->>PluviaApp: Request fallback screen size
  PluviaApp-->>PrefManager: Return selected preset
  PluviaApp-->>IntentLaunchManager: Return selected preset
Loading

Possibly related PRs

Suggested reviewers: utkarshdalal

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: automatic screen-size detection plus a new 960p option.
Description check ✅ Passed The PR includes the required sections and checklist, with the only gap being a screenshot rather than a true recording/GIF.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 1 file

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/src/main/res/values/arrays.xml
@joshuatam joshuatam changed the title feat: add 960p default screen size (e.g. retroid pocket nova) feat: add 960p default screen size (e.g. retroid pocket nova) and default screen size detection Jul 17, 2026

@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: defaults

Review profile: CHILL

Plan: Pro

Run ID: e2fa0467-e858-4c6e-afdd-896fd7746b82

📥 Commits

Reviewing files that changed from the base of the PR and between 25ccff2 and 97fe52b.

📒 Files selected for processing (7)
  • app/src/main/java/app/gamenative/PluviaApp.kt
  • app/src/main/java/app/gamenative/PrefManager.kt
  • app/src/main/java/app/gamenative/ui/data/XServerState.kt
  • app/src/main/java/app/gamenative/utils/IntentLaunchManager.kt
  • app/src/main/java/com/winlator/container/Container.java
  • app/src/main/java/com/winlator/container/ContainerData.kt
  • app/src/main/java/com/winlator/container/ContainerManager.java

Comment thread app/src/main/java/app/gamenative/PluviaApp.kt

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 7 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/src/main/java/app/gamenative/PluviaApp.kt Outdated
Comment thread app/src/main/java/app/gamenative/utils/IntentLaunchManager.kt Outdated
Comment thread app/src/main/java/app/gamenative/PluviaApp.kt Outdated
Comment thread app/src/main/java/app/gamenative/PrefManager.kt
Comment thread app/src/main/java/com/winlator/container/ContainerManager.java Outdated

@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

♻️ Duplicate comments (1)
app/src/main/java/app/gamenative/PluviaApp.kt (1)

288-288: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use getRealMetrics() instead of getMetrics().

display.getMetrics() returns logical dimensions that exclude system decorations like the navigation bar. Subtracting the navigation bar can alter the calculated aspect ratio enough to misidentify the device's true screen size (e.g., miscategorizing a 16:10 device as 16:9). Use getRealMetrics() to get the physical dimensions.

🐛 Proposed fix
                         val displayMetrics = DisplayMetrics()
                         `@Suppress`("DEPRECATION")
-                        display.getMetrics(displayMetrics)
+                        display.getRealMetrics(displayMetrics)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/main/java/app/gamenative/PluviaApp.kt` at line 288, In the display
metrics setup around display.getMetrics(), use getRealMetrics() so
displayMetrics contains the physical screen dimensions including system
decorations. Leave the surrounding aspect-ratio and device-size calculation
logic unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/src/main/java/app/gamenative/PluviaApp.kt`:
- Line 274: Qualify the DISPLAY_SERVICE reference in the companion object’s
displayManager initialization with android.content.Context.DISPLAY_SERVICE so
the getSystemService call compiles without relying on an out-of-scope symbol.

---

Duplicate comments:
In `@app/src/main/java/app/gamenative/PluviaApp.kt`:
- Line 288: In the display metrics setup around display.getMetrics(), use
getRealMetrics() so displayMetrics contains the physical screen dimensions
including system decorations. Leave the surrounding aspect-ratio and device-size
calculation logic unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ba09c406-9d1d-4165-8d7d-f5797f39757d

📥 Commits

Reviewing files that changed from the base of the PR and between 97fe52b and 6966aca.

📒 Files selected for processing (1)
  • app/src/main/java/app/gamenative/PluviaApp.kt

Comment thread app/src/main/java/app/gamenative/PluviaApp.kt

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/src/main/java/app/gamenative/PluviaApp.kt">

<violation number="1" location="app/src/main/java/app/gamenative/PluviaApp.kt:291">
P2: Pre-Android-11 16:9 devices can be misclassified as 16:10 because `getMetrics()` excludes system decorations from the measured area. Using the real display metrics here preserves the device aspect ratio used by the default-size detection.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread app/src/main/java/app/gamenative/PluviaApp.kt Outdated
@joshuatam joshuatam changed the title feat: add 960p default screen size (e.g. retroid pocket nova) and default screen size detection feat: add default screen size detection and 960p screen size option (e.g. retroid pocket nova) Jul 17, 2026
@joshuatam
joshuatam force-pushed the feat/add-960p-screen-size branch 3 times, most recently from afa5e0d to fcae650 Compare July 21, 2026 16:37
@joshuatam
joshuatam force-pushed the feat/add-960p-screen-size branch from fcae650 to 425e8d1 Compare July 22, 2026 23:52
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.

1 participant