Files
readest/apps/readest-app/src-tauri/plugins
Huang Xin 5861aead4b fix(android): move plugin @Command I/O off the main thread; fix WebView leak & #3297 blank screen (#4628)
Backports the Android ANR/stability fixes from the julianshen fork,
adapted to upstream — notably preserving the cold-start shared-intent
replay queue and the #4559 dictionary-dispatch logic, neither of which
the fork kept.

- NativeBridgePlugin: run blocking @Command I/O (copy_uri_to_path,
  install_package, get_sys_fonts_list, and show_lookup_popover's
  queryIntentActivities) on Dispatchers.IO via a Main-dispatched
  pluginScope; startActivity hops back to Main; resolves are
  isActive-guarded; onDestroy cancels the scope and clears the static
  instance; the system-font scan is cached (@Volatile). The cold-start
  shared-intent queue (emitOrQueue / registerListener) is left intact.
- MediaPlaybackService: unmarshal the artwork Bitmap off the main thread
  (serviceScope + Dispatchers.Default), isActive-guarded; cancel the
  scope in onDestroy.
- ClipUrlController: hold the Activity via WeakReference and check
  isFinishing/isDestroyed before presenting, to avoid leaking the
  Activity/WebView during the up-to-30s clip window.
- MainActivity (#3297): on Android 14+ the window can gain focus before
  the WebView paints its first frame, leaving a blank screen. Force one
  repaint when both the window has focus and the WebView exists
  (whichever happens last).

Kotlin-only; not exercised by the JS/Rust test suites. Verified via
ktlint parse + a release `tauri android build` and on-device smoke test
(Xiaomi). The touch-event throttle and intent-handling rewrite from the
fork are intentionally NOT backported (they dropped touchmove forwarding
and the cold-start queue).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 07:13:45 +02:00
..