Skip to content

feat: Implement per-app refresh rate - #564

Open
Mudit200408 wants to merge 2 commits into
sameerasw:developfrom
Mudit200408:feat-per-app-rr
Open

feat: Implement per-app refresh rate#564
Mudit200408 wants to merge 2 commits into
sameerasw:developfrom
Mudit200408:feat-per-app-rr

Conversation

@Mudit200408

Copy link
Copy Markdown
Contributor

No description provided.

- Improve app detection accuracy and filter system noise
@sameerasw
sameerasw self-requested a review August 2, 2026 08:08

@sameerasw sameerasw left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Can you take a look at these concerns?

Potential Issues & Suggestions

1. Shell Execution Overhead on Main Thread during App Switching

  • Location: AppFlowHandler.kt lines in checkPerAppRefreshRate()
  • Issue: RefreshRateUtils.applyFixedRefreshRate() and applyDynamicRefreshRate() run ShellUtils.runCommand(...) directly on the thread calling checkPerAppRefreshRate().
  • Detail: ShellUtils.runCommand executes su / shizuku shell commands synchronously. Running up to 4 shell commands (settings put system..., settings put global...) per app switch can freeze window transitions or cause noticeable UI latency during app launches.
  • Recommendation: Run RefreshRateUtils shell commands inside a background CoroutineScope(Dispatchers.IO) worker thread to prevent main thread blocking.

2. State Leak if Accessibility / App Detection Service is Stopped

  • Location: AppFlowHandler.kt
  • Issue: If the service crashes or is stopped while a per-app refresh rate is active, restoreFromSnapshot() is never called, leaving the device locked at the custom refresh rate (e.g. 60Hz fixed).
  • Recommendation: Implement a cleanup hook on service destroy (onDestroy()) that checks if perAppRateSnapshot != null and invokes restoreFromSnapshot().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants