github Baggio94/SleepManager v0.3.2
SleepManager 0.3.2

latest releases: v0.7.3, v0.7.2, v0.7.1...
one month ago

Highlights

  • More reliable Syncthing shutdown before managed radios are disabled.
  • AYN Thor closed-lid false wakes remain blocked without restoring connectivity.
  • Wi-Fi and Bluetooth restore only the state SleepManager actually changed.
  • Complete Android launcher icon support, including Android 13+ themed icons and legacy fallbacks.
  • Stable build identity and signing guidance for seamless APK updates.
  • README and release notes reorganized for clarity.

Fixed

Syncthing sleep sequence

SleepManager now sends Syncthing STOP before disabling managed radios.

When Syncthing STOP is sent and Wi-Fi or Bluetooth also needs to be disabled:

  1. STOP is sent immediately.
  2. SleepManager waits 1 second.
  3. The Helper applies the Wi-Fi/Bluetooth sleep action.

A temporary one-shot partial wake lock keeps the CPU alive during this short transition and has a safety timeout. It is released as soon as the Helper completes the sleep action, when the transition is cancelled by a real wake, or when the service stops.

This prevents the network from being removed so quickly that Syncthing cannot complete its remote disconnect cleanly.

AYN Thor false wakes

If Android reports SCREEN_ON while the Thor Hall sensor still reports SW_LID = CLOSED:

  • Wi-Fi/Bluetooth are not restored.
  • Syncthing FOLLOW is not scheduled or sent.
  • SleepManager calls lockNow().
  • The resulting duplicate SCREEN_OFF does not run the sleep actions a second time.

Repeated closed-lid false wakes remain protected.

Connectivity behavior

Wi-Fi and Bluetooth remain state-aware.

SleepManager records whether each radio was already on and whether SleepManager actually changed it. On wake, it restores only the radios it changed.

Validated cases include:

  • Wi-Fi ON / Bluetooth ON -> both are restored.
  • Wi-Fi ON / Bluetooth OFF -> only Wi-Fi is restored.
  • Wi-Fi OFF / Bluetooth ON -> only Bluetooth is restored.
  • Radios that were already off are never treated as app-managed changes.

Syncthing wake behavior

On a normal wake, managed connectivity is restored first and Syncthing FOLLOW is currently scheduled 2.5 seconds later.

Launcher icon

The 0.3.2 icon setup includes:

  • adaptive icon foreground/background
  • Android 13+ monochrome/themed icon
  • round icon support
  • legacy mdpi, hdpi, xhdpi, xxhdpi, and xxxhdpi launcher fallbacks
  • separate store icon source

Build and update consistency

The project keeps stable Android application IDs:

  • com.med.sleepmanager
  • com.med.sleepmanager.helper

Version metadata is centralized so the main app and Helper cannot drift accidentally.

The build documentation now makes the Android update requirements explicit:

  • same application ID
  • same signing certificate
  • compatible/increasing versionCode

The main app and Helper must use the same signer because the Helper control permission is signature-protected.

Documentation

  • README reorganized into features, installation, setup, architecture, update identity, troubleshooting, and roadmap.
  • Syncthing requirements are easier to find.
  • AYN Thor behavior is documented separately.
  • Build signing and update compatibility are documented explicitly.

Known limitation

Syncthing wake currently uses a fixed 2.5-second delay before FOLLOW.

A future release may replace this with a network-ready check so FOLLOW is sent when connectivity is actually usable rather than after a fixed timer.

Don't miss a new SleepManager release

NewReleases is sending notifications on new releases.