wakelock not block system sleep (#8504)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-06-27 20:09:51 +08:00 committed by GitHub
parent a18947eed2
commit cfd27c8d87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,8 +104,11 @@ pub fn get_wakelock(_display: bool) -> WakeLock {
hbb_common::log::info!("new wakelock, require display on: {_display}");
#[cfg(target_os = "android")]
return crate::platform::WakeLock::new("server");
// display: keep screen on
// idle: keep cpu on
// sleep: prevent system from sleeping, even manually
#[cfg(not(target_os = "android"))]
return crate::platform::WakeLock::new(_display, true, true);
return crate::platform::WakeLock::new(_display, true, false);
}
pub(crate) struct InstallingService; // please use new