mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 02:26:16 +00:00
a/android: Add API for getting display refresh rate
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/1786>
This commit is contained in:
parent
4029233069
commit
f2f092521f
|
@ -251,3 +251,25 @@ android_custom_surface_can_draw_overlays(struct _JavaVM *vm, void *context)
|
|||
jni::init(vm);
|
||||
return Settings::canDrawOverlays(Context{(jobject)context});
|
||||
}
|
||||
|
||||
float
|
||||
android_custom_surface_get_display_refresh_rate(struct _JavaVM *vm, void *context)
|
||||
{
|
||||
jni::init(vm);
|
||||
try {
|
||||
auto clazz = loadClassFromRuntimeApk((jobject)context, MonadoView::getFullyQualifiedTypeName());
|
||||
if (clazz.isNull()) {
|
||||
U_LOG_E("Could not load class '%s' from package '%s'", MonadoView::getFullyQualifiedTypeName(),
|
||||
XRT_ANDROID_PACKAGE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Teach the wrapper our class before we start to use it.
|
||||
MonadoView::staticInitClass((jclass)clazz.object().getHandle());
|
||||
|
||||
return MonadoView::getDisplayRefreshRate(Context((jobject)context));
|
||||
} catch (std::exception const &e) {
|
||||
U_LOG_E("Could not get display refresh rate: %s", e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,6 +109,9 @@ android_custom_surface_get_display_metrics(struct _JavaVM *vm,
|
|||
bool
|
||||
android_custom_surface_can_draw_overlays(struct _JavaVM *vm, void *context);
|
||||
|
||||
float
|
||||
android_custom_surface_get_display_refresh_rate(struct _JavaVM *vm, void *context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue