Repository: godotengine/godot
File: platform/android/java_godot_lib_jni.cpp (C++)

Code before:
}

JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *env, jclass clazz, jstring path) {
	String js = jstring_to_string(path, env);

	Variant setting_with_override = GLOBAL_GET(js);
	String setting_value = (setting_with_override.get_type() == Variant::NIL) ? "" : setting_with_override;
	return env->NewStringUTF(setting_value.utf8().get_data());
}

JNIEXPORT jobjectArray JNICALL Java_org_godotengine_godot_GodotLib_getRendererInfo(JNIEnv *env, jclass clazz, jboolean p_vulkan_requirements_met) {
	String rendering_driver_original = RenderingServer::get_singleton()->get_current_rendering_driver_name();
	String rendering_driver_chosen = rendering_driver_original;
	String rendering_method = RenderingServer::get_singleton()->get_current_rendering_method();

#ifdef VULKAN_ENABLED
	if (rendering_driver_original == "vulkan" && !DisplayServerAndroid::check_vulkan_global_context(p_vulkan_requirements_met)) {
		// The Android display server only gets created after this step, so a static check must be used to check for Vulkan
		// availability instead. If the check fails, it'll fall back to OpenGL3 accordingly if the relevant project setting
		// is enabled. The Vulkan context created by this check will be reused by the DisplayServer afterwards.
		rendering_driver_chosen = RenderingServer::get_singleton()->get_current_rendering_driver_name();
		rendering_method = RenderingServer::get_singleton()->get_current_rendering_method();
	}
#endif

	String rendering_driver_source = rendering_source_to_string(RenderingServer::get_singleton()->get_current_rendering_driver_name_source());
	String rendering_method_source = rendering_source_to_string(RenderingServer::get_singleton()->get_current_rendering_method_source());

	jobjectArray result = env->NewObjectArray(5, jni_find_class(env, "java/lang/String"), nullptr);
	env->SetObjectArrayElement(result, 0, env->NewStringUTF(rendering_driver_chosen.utf8().get_data()));
	env->SetObjectArrayElement(result, 1, env->NewStringUTF(rendering_driver_original.utf8().get_data()));
	env->SetObjectArrayElement(result, 2, env->NewStringUTF(rendering_method.utf8().get_data()));
	env->SetObjectArrayElement(result, 3, env->NewStringUTF(rendering_driver_source.utf8().get_data()));
	env->SetObjectArrayElement(result, 4, env->NewStringUTF(rendering_method_source.utf8().get_data()));

	return result;
}

JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getEditorSetting(JNIEnv *env, jclass clazz, jstring p_setting_key) {
	String editor_setting_value = "";
#ifdef TOOLS_ENABLED
	String godot_setting_key = jstring_to_string(p_setting_key, env);
	Variant editor_setting = EDITOR_GET(godot_setting_key);
	editor_setting_value = (editor_setting.get_type() == Variant::NIL) ? "" : editor_setting;
#else
	WARN_PRINT("Access to the Editor Settings in only available on Editor builds");
#endif

	return env->NewStringUTF(editor_setting_value.utf8().get_data());
}


Review comment (suggestion):
```suggestion
	String rendering_driver_source = rendering_source_to_string(OS::get_singleton()->get_current_rendering_driver_name_source());
```

Code after:
}

JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *env, jclass clazz, jstring path) {
	String js = jstring_to_string(path, env);

	Variant setting_with_override = GLOBAL_GET(js);
	String setting_value = (setting_with_override.get_type() == Variant::NIL) ? "" : setting_with_override;
	return env->NewStringUTF(setting_value.utf8().get_data());
}

JNIEXPORT jobjectArray JNICALL Java_org_godotengine_godot_GodotLib_getRendererInfo(JNIEnv *env, jclass clazz, jboolean p_vulkan_requirements_met) {
	String rendering_driver_original = RenderingServer::get_singleton()->get_current_rendering_driver_name();
	String rendering_driver_chosen = rendering_driver_original;
	String rendering_method = RenderingServer::get_singleton()->get_current_rendering_method();

#ifdef VULKAN_ENABLED
	if (rendering_driver_original == "vulkan" && !DisplayServerAndroid::check_vulkan_global_context(p_vulkan_requirements_met)) {
		// The Android display server only gets created after this step, so a static check must be used to check for Vulkan
		// availability instead. If the check fails, it'll fall back to OpenGL3 accordingly if the relevant project setting
		// is enabled. The Vulkan context created by this check will be reused by the DisplayServer afterwards.
		rendering_driver_chosen = RenderingServer::get_singleton()->get_current_rendering_driver_name();
		rendering_method = RenderingServer::get_singleton()->get_current_rendering_method();
	}
#endif

	String rendering_driver_source = rendering_source_to_string(OS::get_singleton()->get_current_rendering_driver_name_source());
	String rendering_method_source = rendering_source_to_string(OS::get_singleton()->get_current_rendering_method_source());

	jobjectArray result = env->NewObjectArray(5, jni_find_class(env, "java/lang/String"), nullptr);
	env->SetObjectArrayElement(result, 0, env->NewStringUTF(rendering_driver_chosen.utf8().get_data()));
	env->SetObjectArrayElement(result, 1, env->NewStringUTF(rendering_driver_original.utf8().get_data()));
	env->SetObjectArrayElement(result, 2, env->NewStringUTF(rendering_method.utf8().get_data()));
	env->SetObjectArrayElement(result, 3, env->NewStringUTF(rendering_driver_source.utf8().get_data()));
	env->SetObjectArrayElement(result, 4, env->NewStringUTF(rendering_method_source.utf8().get_data()));

	return result;
}

JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getEditorSetting(JNIEnv *env, jclass clazz, jstring p_setting_key) {
	String editor_setting_value = "";
#ifdef TOOLS_ENABLED
	String godot_setting_key = jstring_to_string(p_setting_key, env);
	Variant editor_setting = EDITOR_GET(godot_setting_key);
	editor_setting_value = (editor_setting.get_type() == Variant::NIL) ? "" : editor_setting;
#else
	WARN_PRINT("Access to the Editor Settings in only available on Editor builds");
#endif

	return env->NewStringUTF(editor_setting_value.utf8().get_data());
}