Skip to main content

Module wake

Module wake 

Source
Expand description

The alarm at waking, on a phone (docs/health.md, “The alarm at waking”; docs/android.md, “Waking”): it rings when the night ends, on the mornings ticked with the night in the Health page’s settings, each night as that day has it (needs::Needs::alarm_of). Android’s alarm clock rings it (android/package/src/com/aurelienpierre/sioul/WakeAlarms.java): Sioul hands Java the coming wakings, eight days ahead, whenever they change, and Java asks again here at each ring, a little before each and as each night starts (another device may have changed it while Android kept Sioul frozen), after a restart, a change of time or of zone. Elsewhere nothing rings: the setting travels with the night, and the page says when the phone will ring. “Try the alarm” rings it ten seconds on, the same way, handed apart (trial): nothing written, the next waking left as it is.

Constants§

LATER_MINUTES 🔒
Minutes “10 min later” puts the alarm off by (WakeAlarms.LATER_MINUTES).
LOOK_BEFORE_MINUTES 🔒
Java asks again this many minutes before each ring, and as its night starts.
NOT_A_PHONE 🔒
What a desktop answers a try: it never rings.
TRY_SECONDS 🔒
A try rings this many seconds after it is asked for (WakeAlarms.TRY_SECONDS).

Statics§

GIVEN 🔒
The wakings last handed to Java, so that they are handed again only when they change.

Functions§

allowed 🔒
What Android allows the alarm, as bits: 1 exact alarms, 2 the full screen, 4 notifications. All of it elsewhere, where nothing rings.
coming 🔒
What Java is handed: rings, the coming alarms (Unix milliseconds, eight days ahead); looks, when to ask again (each night’s start, and ten minutes before each ring); week, the usual mornings (Monday first, the waking or “” when it does not ring), repeated by Java should Sioul not answer; zone, the one the times were made in; words.
hand 🔒
The wakings handed to Java when they changed since they were last.
hand_try 🔒
A try handed to Java: its answer (sioul_android_wake_try); a desktop never rings.
next 🔒
Java’s question (WakeAlarms.nativeNext): at a ring; before one and as a night starts (fetch: the sync app asked first to bring what your other devices changed, and given twenty seconds); after a restart, an update, a change of time or of zone. What the other devices wrote is read first; then the wakings as coming makes them, in zone, the phone’s, as Java has it (Sioul’s own may lag minutes behind a change of zone). Blocks: never on Android’s main thread.
of_night 🔒
The alarm at the end of night’s night, for its row on the page: when it rings (“07:00”), and whether “No alarm” was asked; (“”, false) when none would ring (no morning ticked, the night taken out).
open_settings 🔒
Android’s own page where the alarm is allowed: “exact” (Alarms & reminders), “screen” (full-screen notifications, Android 14 and later), “notifications”. Nothing elsewhere.
read_needs 🔒
The usual night and its mornings, from Health’s file at path: none when the file is there but does not read, so that a file broken (or being written by hand) never cancels an alarm: Java then keeps what it has.
schedule 🔒
The coming wakings handed to Android when they changed: at each minute of the window, when the night, a day’s change or the mornings ticked are saved (here, or brought by the sharing, read at the next minute), and as Sioul is put away. Nothing on a desktop: it never rings.
sioul_wake_next⚠
next, for Java (android/main.cpp); a panic is answered as not known, so that Java keeps the wakings it has. Given back to sioul_string_free.
status 🔒
The option as the Health page’s settings show it (health::needs_page): the weekdays’ names and short names, Monday first; the next ring; on a phone, what Android refuses it.
trial 🔒
What a try hands Java (WakeAlarms.tryNow): {at, words}, the time it rings (Unix milliseconds, ten seconds on) and the words it says. Nothing of the night, its list or its next ring: a try is handed apart from them (sioul_android_wake_try, not sioul_android_set_wake) and rung by its own action and code, so the next waking stays as it is.
tried 🔒
Java’s answer to a try, said: {rings, line, fix, button}: it rings in ten seconds; or what Android refuses (exact alarms, notifications, the full screen), with its page (“exact”, “notifications”, “screen”) and the button’s words, rather than a try that rings unseen or not at all.
try_now 🔒
“Try the alarm” (the Health page’s settings, on a phone): the alarm rung ten seconds on, through the path a waking takes, over the lock screen. Nothing written, the next waking left as it is. JSON, as tried says it.
unknown 🔒
Java’s answer when the night’s file does not read: it keeps what it has.
words 🔒
The words Java says, in the person’s language, given ahead with the wakings: Sioul may not run when the alarm rings (before the phone’s first unlock, above all). {time} is the time Java puts in.