'Is it safe to use the older getRefreshRate with the newer setFrameRate?

The new one without a "get": https://developer.android.com/reference/android/view/Surface#setFrameRate(float,%20int)

While Unreal Engine uses the older to get:

public int AndroidThunkJava_GetNativeDisplayRefreshRate()
{
    if(ANDROID_BUILD_VERSION >= 24)
    {
        WindowManager windowManager =  getWindowManager();
        Display display = windowManager.getDefaultDisplay();
        Display.Mode currentmode = display.getMode();
        return (int)currentmode.getRefreshRate();
    }

    return 60;
}

For the most part, I'd think setFrameRate is provided as a smoother way to set, if no new get is provided, the old get should work.

This further convinces me:

https://android-developers.googleblog.com/2020/04/high-refresh-rate-rendering-on-android.html

"For this reason, applications may need to know the current device refresh rate. This can be done in the following ways:

SDK:

Registering a display listener with DisplayManager.DisplayListener and querying the refresh rate via Display.getRefreshRate

NDK

Registering a callback with AChoreographer_registerRefreshRateCallback (API level 30)"



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source