Skip to content

feat(display): enable 120Hz high refresh rate on supported displays and guard service unbinding - #2715

Open
smartworldarafath wants to merge 2 commits into
maxrave-dev:devfrom
smartworldarafath:fix/display-120hz-refresh-rate
Open

smartworldarafath wants to merge 2 commits into
maxrave-dev:devfrom
smartworldarafath:fix/display-120hz-refresh-rate

Conversation

@smartworldarafath

Copy link
Copy Markdown

What & why

Many modern Android devices support display refresh rates of 90Hz or 120Hz, but by default apps can remain capped at 60Hz unless preferred display modes are explicitly requested on the Window.

This PR adds high refresh rate negotiation to MainActivity:

  • Queries available display modes via Display.supportedModes (using android.view.Display on API 30+ and falling back to WindowManager.defaultDisplay on API 23–29).
  • Filters for modes matching the current display dimensions (handling portrait/landscape orientations) and picks the mode with the highest refresh rate (> 60Hz).
  • Sets preferredDisplayModeId and preferredRefreshRate on window.attributes.
  • Triggers setup in onCreate, onAttachedToWindow, and onConfigurationChanged to maintain smooth scrolling and animations across rotation and lifecycle events.
  • Also wraps unbindService in onStop and onDestroy with safe try-catch handling and resets state flags (shouldUnbind = false, mBound = false) to prevent uncaught IllegalArgumentException: Service not registered crashes.
  • Fixes NetworkFirstInterceptorTest local file URI handling for cross-platform test reliability.

Linked issue

Closes #2086

Checklist

  • This PR addresses an accepted issue (linked above)
  • I wrote or personally reviewed every line of this change
  • I tested it on Android and/or Desktop (say which, and how)

Tested via ./gradlew :composeApp:jvmTest (all JVM tests passed green) and verified refresh rate mode selection and service unbind lifecycle handling on Android.

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.

Improve high refresh rate support (90Hz / 120Hz optimization)

1 participant