diff --git a/crates/bevy_asset/Cargo.toml b/crates/bevy_asset/Cargo.toml index 52a0510805714..095bb9c27b11b 100644 --- a/crates/bevy_asset/Cargo.toml +++ b/crates/bevy_asset/Cargo.toml @@ -44,7 +44,7 @@ wasm-bindgen-futures = "0.4" js-sys = "0.3" [target.'cfg(target_os = "android")'.dependencies] -ndk-glue = { version = "0.2" } +ndk-glue = { version = "0.3" } [dev-dependencies] futures-lite = "1.4.0" diff --git a/crates/bevy_internal/Cargo.toml b/crates/bevy_internal/Cargo.toml index 9d557aff5d167..9268843934964 100644 --- a/crates/bevy_internal/Cargo.toml +++ b/crates/bevy_internal/Cargo.toml @@ -75,4 +75,4 @@ bevy_winit = { path = "../bevy_winit", optional = true, version = "0.5.0" } bevy_gilrs = { path = "../bevy_gilrs", optional = true, version = "0.5.0" } [target.'cfg(target_os = "android")'.dependencies] -ndk-glue = {version = "0.2", features = ["logger"]} +ndk-glue = {version = "0.3", features = ["logger"]} diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index 3ba197c05c9f2..930f80bdb599b 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -233,6 +233,8 @@ pub fn winit_runner_with(mut app: App, mut event_loop: EventLoop<()>) { .get_resource::() .map_or(false, |config| config.return_from_run); + let mut suspended = cfg!(target_os = "android"); + let event_handler = move |event: Event<()>, event_loop: &EventLoopWindowTarget<()>, control_flow: &mut ControlFlow| { @@ -481,8 +483,25 @@ pub fn winit_runner_with(mut app: App, mut event_loop: EventLoop<()>) { event_loop, &mut create_window_event_reader, ); - app.update(); + if !suspended { + app.update(); + } + } + event::Event::Resumed => { + suspended = false; + #[cfg(target_os = "android")] + { + let mut window_created_events = app + .world + .get_resource_mut::>() + .unwrap(); + + window_created_events.send(WindowCreated { + id: bevy_window::WindowId::primary(), + }); + } } + event::Event::Suspended => suspended = true, _ => (), } }; @@ -510,6 +529,7 @@ fn handle_create_window_events( &create_window_event.descriptor, ); windows.add(window); + #[cfg(not(target_os = "android"))] window_created_events.send(WindowCreated { id: create_window_event.id, }); diff --git a/deny.toml b/deny.toml index 81ce3419fe023..d87e69a17214a 100644 --- a/deny.toml +++ b/deny.toml @@ -70,8 +70,6 @@ skip = [ { name = "getrandom", version = "0.1" }, { name = "libm", version = "0.1" }, { name = "mach", version = "0.2" }, - { name = "ndk", version = "0.2" }, - { name = "ndk-glue", version = "0.2" }, { name = "num_enum", version = "0.4" }, { name = "num_enum_derive", version = "0.4" }, { name = "rand", version = "0.7" },