Skip to content

fix: detect Android screen recording across runtimes (OK-46258)#12552

Open
huhuanming wants to merge 6 commits into
xfrom
codex/ok-46258-android-screen-recording
Open

fix: detect Android screen recording across runtimes (OK-46258)#12552
huhuanming wants to merge 6 commits into
xfrom
codex/ok-46258-android-screen-recording

Conversation

@huhuanming

@huhuanming huhuanming commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

OK-46258


Summary

  • scope capture callbacks, content observers, and display listeners to each React context instead of sharing them through companion state
  • detect Android MediaProjection virtual displays directly from onDisplayAdded, including private displays that are not returned by DisplayManager.getDisplay()
  • fix screen-recording detection for OneKey's main and background React Native runtimes

Jira: https://onekeyhq.atlassian.net/browse/OK-46258

Runtime notes

The main and background ReactHosts run in the same native process but use separate JS heaps. Android's DisplayManager / MediaProjection resources are process-wide, while each module instance must retain its own callback state so events are delivered into the correct React context. The native display callback fires first; the existing recovery-phrase hook then shows its warning after the current debounce/timer delay.

Verification

  • yarn agent:check
  • app:assembleProdDebug -PreactNativeArchitectures=x86_64
  • patch applies cleanly to pristine react-native-capture-protection@2.3.0
  • Android 15 / API 35 emulator, SystemUI entire-screen recording:
    • native callback: display add event 3
    • main JS runtime: CaptureEventType.RECORDING (1)
    • sensitive OneKey window retained FLAG_SECURE
    • recorded sensitive-page interval was pure black (92 consecutive one-second samples, pixel mean and standard deviation both 0)

@huhuanming
huhuanming marked this pull request as ready for review July 19, 2026 11:49
@huhuanming
huhuanming enabled auto-merge (squash) July 19, 2026 11:49
Comment thread patches/react-native-capture-protection+2.3.0.patch
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