Commit 668ef96
committed
fix(android): cover never appears on Samsung One UI (BadTokenException 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.1 parent 404d989 commit 668ef96
1 file changed
Lines changed: 48 additions & 3 deletions
Lines changed: 48 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
564 | 564 | | |
565 | 565 | | |
566 | 566 | | |
567 | | - | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
568 | 583 | | |
569 | 584 | | |
570 | 585 | | |
| |||
639 | 654 | | |
640 | 655 | | |
641 | 656 | | |
642 | | - | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
643 | 673 | | |
644 | 674 | | |
645 | 675 | | |
| |||
1740 | 1770 | | |
1741 | 1771 | | |
1742 | 1772 | | |
1743 | | - | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
1744 | 1789 | | |
1745 | 1790 | | |
1746 | 1791 | | |
| |||
0 commit comments