Skip to content

v2.4.5 — Stale VM cache fix + foldable screen dimensions

Choose a tag to compare

@Tensorlong Tensorlong released this 12 May 15:27
· 1 commit to master since this release

Fixes

Stale ViewModel cache in OverlayService

The 5 getXxxViewModel() helpers used private lateinit var as a manual cache. Once the service's viewModelStore got cleared, ViewModelProvider would return a fresh ViewModel but the stale lateinit var still pointed at the old one — UI bound to a dead VM, translations silently stopped working until a full re-grant.

Fix: drop the manual cache and rely on ViewModelProvider's own caching in viewModelStore.

Foldable screen dimensions on inner ↔ outer transition

ScreenInfoHolder.updateScreenInfoInService() only swapped width/height based on orientation. That's correct for rotation but wrong for foldables — inner and outer screens are physically different displays (Z Fold 5: inner 1812×2176, outer 970×2485). After folding, the cached size was wrong, the VirtualDisplay was created at the wrong dimensions, and the bubble cursor disappeared off-screen.

Fix: re-read WindowManager.currentWindowMetrics.bounds on every configuration change (with displayMetrics fallback < API 30). Also fix a race in collectAndStoreScreenInfo so dimensions are set synchronously instead of inside decorView.post {}.

Known behavior

After folding/unfolding the device, screen recording permission must be re-granted on the next translate tap. This is Android's documented design: VirtualDisplay.resize()+setSurface() only covers same-display configuration changes; switching between physical displays invalidates the MediaProjection.

Install

Side-load the attached APK (debug-signed).