Skip to content

fix(android): cover never appears on Samsung One UI + v0.1.7 - #4

Merged
amillez merged 2 commits into
mainfrom
fix/android-samsung-oneui-host-walk
Jun 1, 2026
Merged

amillez merged 2 commits into
mainfrom
fix/android-samsung-oneui-host-walk

Conversation

@amillez

@amillez amillez commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

v0.1.7. Single targeted fix on top of v0.1.6 for a Samsung One UI regression discovered after the v0.1.6 rollout.

On Samsung Galaxy A05 (SM-A057F, Android 14, One UI), pressing Home left the Recents thumbnail showing the underlying React Native UI instead of the configured privacy cover. Logcat from the device:

Cover : ensureCoverOnTopmost: reparent (topmost=FreezableFrameLayout)
Cover : attachCover: addView failed:
         android.view.WindowManager$BadTokenException:
         Unable to add window -- token android.view.ViewRootImpl$W@d70be2d
         is not valid; is your activity running?

The host-window walk (CoverWindowAttachment.topmostHostViewFor) excluded coverView (the cover Window's root — SurfaceView on the SCVH path) but not coverContent (the SCVH-hosted FreezableFrameLayout). On Samsung One UI's customised WindowManager the SCVH-hosted content appears in WindowManagerGlobal.mViews despite living inside the SCVH's own ViewRootImpl. The walk identified our own content view as the topmost host, addCover tried to attach the cover as a sub-window of itself, and WindowManager.addView rejected the token. The cover never reached the Recents thumbnail.

Fix

Pass exclude2 = coverContent at all three topmostHostViewFor callsites in HybridCover.kt. CoverWindowAttachment already supported the parameter (the blur source picker uses it for the same reason on the SCVH path).

-    val topmost = CoverWindowAttachment.topmostHostViewFor(activity, exclude = coverView) ?: decor
+    val topmost = CoverWindowAttachment.topmostHostViewFor(
+      activity,
+      exclude = coverView,
+      exclude2 = coverContent,
+    ) ?: decor

Verified on Samsung Galaxy A05 (Android 14, One UI)

Cover : ensureCoverOnTopmost: reparent (topmost=DecorView)
Cover : attachCover: preferredRefreshRate=90.0
Cover : broadcast: reason=homekey isEnabled=true isVisible=false sc=false
Cover : broadcast: fast scvh=false refl=false dt=1ms
Cover : performUserLeaveMount
Cover : setCoverVisibility: visible=true animated=false scvh=false

Recents thumbnail shows the #5F8AFA splash background with the icon — exactly the iOS App Switcher parity the library was designed to deliver. Tested in a downstream consumer app (NEAR Mobile, com.peersyst.nearmobilewallet).

Test plan

  • :react-native-cover:compileDebugKotlin clean (only pre-existing defaultDisplay deprecation warnings).
  • Manual verification on Samsung Galaxy A05 (Android 14, One UI 6.1 / 7.x).
  • Manual regression on Pixel_9 emulator (Android 16) — SCVH fast path should still win the snapshot race.
  • Manual regression on Favvy_Android_30 (API 30) — legacy path should still kick in via the existing pre-check.
  • Maestro suite green on at least one device.

Files changed

  • android/src/main/java/com/margelo/nitro/cover/HybridCover.kt — three callsites updated, one-paragraph explanatory comment.
  • package.json0.1.60.1.7.
  • CHANGELOG.md — new 0.1.7 - 2026-06-01 entry.

amillez added 2 commits June 1, 2026 19:17
…n on host walk)

Reported on Samsung Galaxy A05 (SM-A057F) running Android 14 with One UI:
pressing Home left the Recents thumbnail showing the underlying React Native
UI instead of the configured privacy cover. Logcat from the affected device:

  Cover : ensureCoverOnTopmost: reparent (topmost=FreezableFrameLayout)
                                                  ^^^^^^^^^^^^^^^^^^^^
  Cover : attachCover: addView failed:
          android.view.WindowManager$BadTokenException:
          Unable to add window -- token android.view.ViewRootImpl$W@d70be2d
          is not valid; is your activity running?

The host-window walk (`CoverWindowAttachment.topmostHostViewFor`) excluded
`coverView` (the cover Window's root — `SurfaceView` on the SCVH path,
`FrameLayout` on legacy) but not `coverContent` (the SCVH-hosted
`FreezableFrameLayout`). On Samsung One UI's customised WindowManager the
SCVH-hosted content appears in `WindowManagerGlobal.mViews` even though it
lives inside the SCVH's own `ViewRootImpl`. The walk found our own content
view as the "topmost host", `addCover` tried to attach the cover as a
sub-window of itself, and `addView` rejected the token. The cover never
reached the Recents thumbnail.

Fix: pass `exclude2 = coverContent` at all three `topmostHostViewFor`
callsites in `HybridCover.kt`. `CoverWindowAttachment` already supported
the parameter (the blur source picker uses it for the same reason on the
SCVH path).

Verified on Samsung Galaxy A05 (Android 14, One UI):

  Cover : ensureCoverOnTopmost: reparent (topmost=DecorView)
  Cover : attachCover: preferredRefreshRate=90.0
  Cover : broadcast: reason=homekey isEnabled=true isVisible=false sc=false
  Cover : broadcast: fast scvh=false refl=false dt=1ms
  Cover : performUserLeaveMount
  Cover : setCoverVisibility: visible=true animated=false scvh=false

Recents thumbnail shows the #5F8AFA splash background with the icon, exactly
the iOS App Switcher parity the library was designed to deliver.
@amillez
amillez merged commit 0055b87 into main Jun 1, 2026
3 checks passed
@ibrahimkanna736-pixel

Copy link
Copy Markdown

Update Samsung A05

@ibrahimkanna736-pixel ibrahimkanna736-pixel left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update Samsung A05

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.

2 participants