From 7a88d5bf283952cfcccef111143c88923017599e Mon Sep 17 00:00:00 2001 From: Fredy Huya-Kouadio Date: Mon, 25 Apr 2022 00:03:00 -0700 Subject: [PATCH] Fix the issue causing the screen to be black after resuming when in low processor mode. This is done by forcing a redraw and buffers swap when resuming the app. --- platform/android/java_godot_lib_jni.cpp | 2 ++ platform/android/os_android.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index d9936b545ac..f1500be5e6a 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -514,6 +514,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onRendererResumed(JNI if (step.get() <= 0) return; + // We force redraw to ensure we render at least once when resuming the app. + Main::force_redraw(); if (os_android->get_main_loop()) { os_android->get_main_loop()->notification(MainLoop::NOTIFICATION_APP_RESUMED); } diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 4ff86a79dda..9372b79025c 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -322,10 +322,11 @@ void OS_Android::main_loop_begin() { bool OS_Android::main_loop_iterate(bool *r_should_swap_buffers) { if (!main_loop) return false; + uint64_t current_frames_drawn = Engine::get_singleton()->get_frames_drawn(); bool exit = Main::iteration(); if (r_should_swap_buffers) { - *r_should_swap_buffers = !is_in_low_processor_usage_mode() || _update_pending; + *r_should_swap_buffers = !is_in_low_processor_usage_mode() || _update_pending || current_frames_drawn != Engine::get_singleton()->get_frames_drawn(); } return exit;