Skip to content

fix: keep the video screen's background over the picture on Android 10 - #219

Merged
j0ker70 merged 1 commit into
mainfrom
fix/android10-video-screen-background
Nov 22, 2026
Merged

j0ker70 merged 1 commit into
mainfrom
fix/android10-video-screen-background

Conversation

@j0ker70

@j0ker70 j0ker70 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #211

A bug fix that makes the app match openspec/specs/player/spec.md, which already asks for the background to fill the window and for the minimize button, so no OpenSpec change. The maintainer subagent's plan check gave "Fix first" on round 1 (a clip on the 16:9 box would still blacken the bars beside a vertical or 4:3 picture on Android 10), then "Verdict: Build" on round 2. A round 3 about the emulator tests' isolation was stopped by the owner's call: this PR adds no second isolation fix and uses #212's stopPlayback helper instead.

What changed and why

  • The cause. Android 10 and 11 make a SurfaceView's hole with Canvas.drawColor(0, PorterDuff.Mode.CLEAR) (AOSP android-10.0.0_r47 and android-11.0.0_r48, SurfaceView.clearSurfaceViewPort). That clears everything inside the canvas's clip. Compose UI 1.12.1 draws an AndroidView into its enclosing layer's canvas with no clip of its own, and nothing on the video screen's path clipped it. So the hole wiped the screen's background and the minimize button, which were drawn before it. Those pixels were transparent in the window, which showed black there. Android 12 and later use Canvas.punchHole bounded to the view (android-12.0.0_r34), so they were fine.
  • The fix. ClippedContentFrame in :feature:player-ui does what media3-ui-compose 1.11.1's ContentFrame does with its defaults (SurfaceView, ContentScale.Fit, rememberPresentationState, the shutter while coverSurface), plus .clipToBounds() after resizeWithContentScale. The clip is then the SurfaceView's own rectangle, the same one Android 12 and later clear. The video screen and fullscreen use it in place of ContentFrame. Its KDoc says to compare it with ContentFrame when Media3 updates.
  • The regression test. VideoScreenBackgroundTest (emulator) opens the test video, waits for its 320x180 picture, pauses, captures the window with captureToImage, and checks that the minimize button's and the description's bounds have only opaque pixels, and that the button has more than one color. Without the fix it failed on Android 10: all 12,100 pixels of the button's bounds were transparent. It ends with A video opened offline stays stopped after Try again when a live stream was in the mini player #212's stopPlayback, as the other emulator tests do. Screenshot tests can't catch this, because layoutlib draws no SurfaceView hole.
  • Docs. docs/testing.md lists the three emulator tests and says what this one checks. docs/architecture.md's "The video area" and fullscreen's layout say the picture is ClippedContentFrame and why.

Not in this PR: the Android 10 three-button navigation bar over fullscreen's exit button, which #212's session is filing as its own issue. The mini player has no SurfaceView, so it isn't affected.

New dependencies

None.

Checklist

  • OpenSpec change archived, or not needed: not needed, a bug fix that makes the app match the player spec
  • docs/architecture.md updated, or the structure of the app didn't change: the video area and fullscreen sections name ClippedContentFrame
  • ADR added for any decision that would be hard to reverse, or there was none: none

Checks

  • ./gradlew --continue spotlessCheck detekt lint test testDebugScreenshotTestDefaultTestSuite assembleDebug :app:assembleDebugAndroidTest -Pandroid.builder.sdkDownload=false passes, and scripts/scan_screenshot_tests.py passes (66 files). The screenshot reference images didn't change.

  • Pre-push gate on ad079a2, on main at c2a4cd8 (the last lines):

    PASS gate's own tests tests=128
    PASS branch contains origin/main
    PASS commit ad079a2 fix: keep the video screen's background over the picture on Android 10
    PASS nothing uncommitted
    PASS full build and every test
    PASS the build changed no file
    PASS: the gate passed.
    
  • Emulator tests (am instrument with HiltTestRunner, all three classes in one run): OK (3 tests) twice on Android 10 (a temporary Pixel 4 AVD, android-29 google_apis arm64, deleted afterwards) and twice on Android 17 (Dewfall_Pixel_6_API_37, -feature -HardwareDecoder).

  • Hand checks, November 22, 2026, one emulator at a time, before the rebase onto fix: keep a failed video's failure when prepare clears an older error #217 (which changed no code this PR touches):

    • Android 10: a 16:9 video (Big Buck Bunny) and a vertical video, in light and dark. The background, the minimize button and the rounded box show, and the vertical video has surface bars beside it. screencap reads 0 non-opaque pixels on the video screen. Fullscreen: 397 non-opaque pixels, a single 1-pixel column at the picture's edge, down from about 389,000 before, black on the black scrim. Exiting fullscreen returns to portrait, and minimizing to the mini player works.
    • Android 12L (Dewfall_Pixel_6_API_32) and Android 17: the vertical video in light and dark looks the same as before; fullscreen reads 0 non-opaque pixels; exiting fullscreen and minimizing work.

CodeRabbit

Reviewed ad079a2: "No actionable comments were generated", with no inline, nitpick or outside-diff comments. Its title, linked-issue and out-of-scope checks passed. Nothing to fix or decline.

Reviewer

Final verdict: Ready

  • Round 1 on 807a35b (Ready). Its should-fixes, all done: use the closing keyword only after the hand checks pass; cover dark mode and fullscreen on Android 10; show the Android 10 run with and without the fix; show the gate output.
  • Round 2 on the rebased commit (Ready): nothing to fix. It compared ClippedContentFrame with ContentFrame's 1.11.1 sources and checked that testing.md's Android 10 emulator matches emulator-tests.yml.
  • No questions for the maintainer.

🤖 Generated with Claude Code

- Android 10 and 11 make a SurfaceView's hole with drawColor(CLEAR), which
  clears everything inside the canvas's clip. Compose draws the SurfaceView
  into its enclosing layer with no clip, so the hole wiped the screen's
  background and minimize button, which then showed black.
- ClippedContentFrame does what ContentFrame does, with a clip after the
  resize at the SurfaceView's own bounds, the same rectangle that Android 12
  and later clear with punchHole. The video screen and fullscreen use it.
- VideoScreenBackgroundTest captures the window while the picture shows and
  checks that the minimize button and the description are opaque. It fails
  on Android 10 without the fix. It ends with stopPlayback, as the other
  emulator tests do, so the next test gets its own PlaybackService.
- docs/testing.md and docs/architecture.md describe the test and the frame.

Issue #211.
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The video screen and fullscreen picture now use ClippedContentFrame to render the player surface. A new Android instrumentation test captures the video screen and checks pixels in the minimize-button and description regions.

Changes: Video Surface Background

Layer / File(s) Summary
Clipped surface frame and player integration
feature/player-ui/src/main/kotlin/io/github/dewfallapp/feature/player/ui/ClippedContentFrame.kt, feature/player-ui/src/main/kotlin/io/github/dewfallapp/feature/player/ui/VideoArea.kt, feature/player-ui/src/main/kotlin/io/github/dewfallapp/feature/player/ui/FullscreenPlayer.kt, feature/player-ui/src/main/kotlin/io/github/dewfallapp/feature/player/ui/PlayerPreviewParts.kt, docs/architecture.md
ClippedContentFrame renders a fitted PlayerSurface clipped to its bounds and shows the shutter when the presentation state covers the surface. VideoArea and FullscreenPicture now use it. The architecture documentation describes the frame and platform behavior.
Video screen pixel test
app/src/androidTest/kotlin/io/github/dewfallapp/VideoScreenBackgroundTest.kt, docs/testing.md
The test plays and pauses a test video, captures the window, and checks opacity in the minimize-button and description regions. It also checks that the button has multiple colors. The testing documentation describes the test.

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

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • dewfallapp/dewfall#210 — The test checks video screen appearance, which overlaps with some of this issue’s open hand checks. The PR does not cover all of its checks.

Possibly related PRs

  • dewfallapp/dewfall#206 — This PR changes the video-screen and fullscreen player surfaces established by that PR.
Merge Risk: Minimal · up to ad079

This change keeps the video screen's background and minimize button visible over the picture on Android 10 and 11 by clipping the video surface to its bounds. It touches only the player UI and adds a pixel test. No concrete merge-blocking risk was found.

Security architecture risk: Minimal · up to ad079

The change confines video drawing to its bounds and adds a test. No introduced or worsened risk to security, failure containment, rollback, or ownership was established in the inspected changes.

Pre-merge checks: Passed 3

Check name Status Explanation
Title check Passed The title uses the conventional commit type "fix", has no scope, and follows it with a colon and a space, which meets the configured format. The description is specific and matches the main change: Cl…
Linked Issues check Passed Directly linked issue #211 is open and active, so its coding requirements apply. Requirement 1: on Android 10, the video screen keeps its background and minimize button while a video plays. The fix re…
Out of Scope Changes check Passed Every changed area supports #211. The changes are: ClippedContentFrame.kt (new fix); VideoArea.kt and FullscreenPlayer.kt (switch to the fix on the video screen and in fullscreen); PlayerPreviewParts.…
Full details: Title check

Explanation

The title uses the conventional commit type "fix", has no scope, and follows it with a colon and a space, which meets the configured format. The description is specific and matches the main change: ClippedContentFrame replaces ContentFrame so the video screen background and minimize button stay visible over the SurfaceView picture on Android 10.

Full details: Linked Issues check

Explanation

Directly linked issue #211 is open and active, so its coding requirements apply. Requirement 1: on Android 10, the video screen keeps its background and minimize button while a video plays. The fix replaces ContentFrame with ClippedContentFrame on the video screen and in fullscreen (VideoArea.kt, FullscreenPlayer.kt). ClippedContentFrame.kt applies .clipToBounds() after resizeWithContentScale(ContentScale.Fit, ...). This limits the SurfaceView hole, which Android 10 and 11 clear with Canvas.drawColor(0, CLEAR), to the SurfaceView's own rectangle. The file KDoc gives the same cause. Requirement 2: automated test coverage. VideoScreenBackgroundTest (emulator, app/src/androidTest) captures the window during playback and checks the minimize button and description for opaque pixels. Screenshot tests cannot cover this because layoutlib draws no SurfaceView hole, and the PR says so. Requirement 3: manual checks on Android 10, 12L and the newest Android. These are non-coding and were not used in this verdict. I read ClippedContentFrame.kt at the reviewed head. I did not run the emulator tests. The emulator and hand-check results come from the PR description and were not independently verified. Stack: no stack evidence was supplied. This PR is assessed alone, and no stack objective applies.

Full details: Out of Scope Changes check

Explanation

Every changed area supports #211. The changes are: ClippedContentFrame.kt (new fix); VideoArea.kt and FullscreenPlayer.kt (switch to the fix on the video screen and in fullscreen); PlayerPreviewParts.kt (comment-only update that names the new composable); VideoScreenBackgroundTest.kt (regression test for the bug); docs/architecture.md and docs/testing.md (describe the fix and the new test). The PR explicitly leaves out the Android 10 navigation-bar overlap on fullscreen's exit button and assigns it to #212. I found no changed code unrelated to the issue. No new dependencies are reported, and the diff summary shows none.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between c2a4cd8 and ad079a2.

Files selected for processing: 7

  • app/src/androidTest/kotlin/io/github/dewfallapp/VideoScreenBackgroundTest.kt
  • docs/architecture.md
  • docs/testing.md
  • feature/player-ui/src/main/kotlin/io/github/dewfallapp/feature/player/ui/ClippedContentFrame.kt
  • feature/player-ui/src/main/kotlin/io/github/dewfallapp/feature/player/ui/FullscreenPlayer.kt
  • feature/player-ui/src/main/kotlin/io/github/dewfallapp/feature/player/ui/PlayerPreviewParts.kt
  • feature/player-ui/src/main/kotlin/io/github/dewfallapp/feature/player/ui/VideoArea.kt

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

@j0ker70
j0ker70 merged commit d48f7bb into main Nov 22, 2026
3 checks passed
@j0ker70
j0ker70 deleted the fix/android10-video-screen-background branch November 22, 2026 11: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.

Android 10: the video screen's background and minimize button vanish while a video plays

1 participant