Skip to content

FrameTune Suite v1.2.0

Choose a tag to compare

@Spec-Pilot Spec-Pilot released this 24 Oct 05:19
adac769

FrameTune Suite v1.2.0

Official release of FrameTune TV and FrameTune Remote companion.

✨ What's Added in this Release (Latest Commit Details)

  • 📱 FrameTune Remote: Align app version to 1.1.100 and support Wi-Fi ADB APK sideloading (23bb8a5)
    • Key components updated: PairingActivity.kt, AdbManager.kt

📦 Included APKs

  • FrameTune-TV.apk — Install on Android TV, Google TV, and Fire TV devices.
  • FrameTune-Remote.apk — Install on Android smartphones and tablets.

📋 Detailed Architecture & Phase Notes

[Phase 122] - 2026-10-18

  • Zero-Lag Media Engine: Tun Loop IPC & Disk I/O Elimination, Debounced SharedPreferences, and State-Gated Accessibility Traversal (:app & Docs):
    • The Requirement & Issue Solved:
      1. Following the update to v1.1.88, severe system-wide stutter and frame drops occurred during video playback across streaming apps (reproduced on Hotstar and YouTube), accompanied by Choreographer logcat warnings (Skipped 312 frames! The application may be doing too much work on its main thread).
      2. Root Causes Discovered via SysTrace & Kernel Profiling:
        • Per-Packet Disk I/O & JSON Parsing in Tun Loop: In FrameTuneDnsVpnService.kt, processDnsPacket() was creating a fresh DnsSettings(this) instance on every single incoming UDP DNS packet, synchronously reading dns_rules_persistent.json from flash storage and parsing JSON with JSONObject on the high-frequency TUN socket worker thread.
        • Blocking Binder IPC in Packet Loop: processDnsPacket() called am?.getRunningTasks(1) over synchronous Binder IPC whenever Hotstar was not detected (i.e. on 100% of YouTube packets and generic queries), locking ActivityTaskManagerService inside system_server and causing device-wide Choreographer thread starvation.
        • SharedPreferences & Memory Churn in Domain Logging: In DnsPacketFilter.kt, every blocked query called StandbyAuditStore.incrementLifetimeBlockedCount(), triggering immediate prefs.edit().apply() disk writes. Additionally, trimming targetSession.networkEvents via removeAt(0) performed O(N) System.arraycopy operations shifting 250 objects per query, causing continuous GC pauses (GC freed 167123(11MB)).
        • Unbounded Main-Thread Accessibility Tree Traversal: FrameTuneAccessibilityService.kt polled rootInActiveWindow every 500ms. In YouTubeHandler.kt, findSkipAdNode() fell back to a depth-12 BFS tree search with depth-6 DFS text extraction across all nodes whenever no skip button was visible (which is 100% of the time during smooth playback), while findFirstProgressNode() traversed down to depth 25.
        • Background Tooling Daemon: An Android Studio Device Mirroring agent (com.android.tools.screensharing.Main) was executing via ADB, utilizing software VPX encoding (C2SoftVpxEnc) consuming ~60% TV CPU.
    • Implementation Details:
      1. Zero-Copy In-Memory DNS Caching (FrameTuneDnsVpnService.kt & DnsSettings.kt):
        • Added volatile cached collections: isCachedDnsFilterEnabled, activeBlockedDomains, and activeAllowedDomains in FrameTuneDnsVpnService.
        • Completely eliminated DnsSettings(this) object allocations and disk reads from processDnsPacket().
        • Added FrameTuneDnsVpnService.refreshCachedRules() callbacks triggered immediately when rules, blocked lists, or filter toggles are updated.
        • Completely removed am?.getRunningTasks(1) Binder IPC call, relying strictly on cached reactive state from core.appDetector.activeTargetApp.value and core.appDetector.foregroundPackage.value.
      2. Debounced Telemetry Counter & O(1) Sliding Window (StandbyAuditStore.kt & StandbyAuditModels.kt):
        • Replaced immediate prefs.edit().apply() on packet arrival with an in-memory AtomicLong and a 15-second debounced background disk flush.
        • Switched networkEvents from ArrayList to LinkedList to achieve O(1) node unlinking for sliding event logs.
        • Added ConcurrentHashMap memoization in SmartTvTelemetryCatalog.kt for rapid domain classification without regular expression re-evaluations.
      3. Adaptive Accessibility Polling & State-Gated Traversal (FrameTuneAccessibilityService.kt & YouTubeHandler.kt):
        • Relaxed YouTube background evaluation poll interval from 500ms to 3000ms during normal video playback; poll interval dynamically drops to 500ms only when commercial ads, muting, or skip buttons are actively detected.
        • Gated findSkipAdNode() fallback BFS tree search to run strictly when isAdCurrentlyPlaying == true and capped depth to 6.
        • Bounded findFirstProgressNode() to depth 8.
        • Throttled YouTubeSponsorBlockManager metadata lookups to once every 3000ms when currentVideoId is already resolved.
      4. Version Bump:
        • Updated versionCode 10189, versionName "1.1.89".
    • Verification:
      • Full unit test suite passed (./gradlew testDebugUnitTest - 54/54 passed).
      • Deployed v1.1.89 to living room TV (192.168.0.102:5555).
      • Verified smooth 100% full-framerate playback on Hotstar (Avengers: Endgame) and YouTube (Global Finance Awards) with Network Shield ON and Display-On Radar ON.
      • CPU idle increased from 0-25% to 241%-263% idle (out of 400%); com.frametune.tv CPU consumption dropped to 0.0%; 0 dropped frames recorded in Choreographer logcat.

🔨 Full Commit Log

  • 23bb8a5 — fix(remote): align app version to 1.1.100 and support Wi-Fi ADB APK sideloading (Spec-Pilot, 2026-10-24)