From 0bf4a974b370559cc75fd1336bddf1d61e009b1a Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Mon, 29 Jul 2024 10:11:46 +0200 Subject: [PATCH] native_activity: Fix clippy lints around `NativeActivityGlue` not `SendSync` and unwritten `redraw_needed` field --- android-activity/src/config.rs | 9 +++------ android-activity/src/native_activity/glue.rs | 8 ++++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/android-activity/src/config.rs b/android-activity/src/config.rs index 2c3dce8..45bc5e4 100644 --- a/android-activity/src/config.rs +++ b/android-activity/src/config.rs @@ -6,13 +6,10 @@ use ndk::configuration::{ ScreenSize, Touchscreen, UiModeNight, UiModeType, }; -/// A (cheaply clonable) reference to this application's [`ndk::configuration::Configuration`] +/// A runtime-replacable reference to [`ndk::configuration::Configuration`]. /// -/// This provides a thread-safe way to access the latest configuration state for -/// an application without deeply copying the large [`ndk::configuration::Configuration`] struct. -/// -/// If the application is notified of configuration changes then those changes -/// will become visible via pre-existing configuration references. +/// If the application is notified of configuration changes then those changes will become visible +/// via pre-existing configuration references. #[derive(Clone)] pub struct ConfigurationRef { config: Arc>, diff --git a/android-activity/src/native_activity/glue.rs b/android-activity/src/native_activity/glue.rs index 2e4371c..dab3e29 100644 --- a/android-activity/src/native_activity/glue.rs +++ b/android-activity/src/native_activity/glue.rs @@ -81,12 +81,14 @@ pub struct WaitableNativeActivityState { pub cond: Condvar, } +// SAFETY: ndk::NativeActivity is also SendSync. +unsafe impl Send for WaitableNativeActivityState {} +unsafe impl Sync for WaitableNativeActivityState {} + #[derive(Debug, Clone)] pub struct NativeActivityGlue { pub inner: Arc, } -unsafe impl Send for NativeActivityGlue {} -unsafe impl Sync for NativeActivityGlue {} impl Deref for NativeActivityGlue { type Target = WaitableNativeActivityState; @@ -223,7 +225,6 @@ pub struct NativeActivityState { /// Set as soon as the Java main thread notifies us of an /// `onDestroyed` callback. pub destroyed: bool, - pub redraw_needed: bool, pub pending_input_queue: *mut ndk_sys::AInputQueue, pub pending_window: Option, } @@ -370,7 +371,6 @@ impl WaitableNativeActivityState { thread_state: NativeThreadState::Init, app_has_saved_state: false, destroyed: false, - redraw_needed: false, pending_input_queue: ptr::null_mut(), pending_window: None, }),