Skip to content

Instantly share code, notes, and snippets.

@pflammertsma
Created March 18, 2022 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pflammertsma/671f571c5a763b0e4916ad1e9cefa82e to your computer and use it in GitHub Desktop.
Save pflammertsma/671f571c5a763b0e4916ad1e9cefa82e to your computer and use it in GitHub Desktop.
Sample for refresh rate switching with application focus
/* Copyright 2021 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
val params: WindowManager.LayoutParams = window.attributes
if (requestedMode.modeId !== params.preferredDisplayModeId) {
params.preferredDisplayModeId = requestedMode.modeId
window.attributes = params
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment