Package com.aurelienpierre.sioul
Class WakeAlarms
java.lang.Object
com.aurelienpierre.sioul.WakeAlarms
The alarm at waking (docs/android.md, "Waking"): it rings when the night
ends, on the mornings ticked with the night in Sioul's Health settings.
Rust hands the coming wakings, eight days ahead, whenever they change
(crates/sioul-app/src/wake.rs, through android/main.cpp). Here they are
kept, in the storage a phone reads before its first unlock (a phone that
restarted in the night still rings), and the next is given to Android's
alarm clock: setAlarmClock, exact, through Doze, the alarm shown in the
status bar. At each ring, a little before each and as each night starts,
after a restart, a change of time or of zone, Rust is asked again
(WakeReceiver); when it cannot answer, the list kept goes on, then the
usual week, repeated: never nothing. Apart from the doses: its own list,
codes, channel and receiver.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringAfter "10 min later": when it rings again.private static final intprivate static final StringThe ring last given to Android, and the last that rang: a ring missed while the phone was off.(package private) static final StringA ring's time (Unix milliseconds), on its intent.(package private) static final StringThe "Waking" channel: the ring's notification, and the one after "10 min later".private static final longA ring due within a minute is the one ringing now: never given again.private static final String(package private) static final String(package private) static final String(package private) static final int(package private) static final intMinutes "10 min later" puts the alarm off by (wake.rs, LATER_MINUTES).private static final String(package private) static final Stringprivate static final intprivate static final longA ring missed while the phone was off rings as it starts again, when this late at most.private static final String(package private) static final Stringprivate static final int(package private) static final intprivate static final int(package private) static final String(package private) static final int(package private) static final StringOn a ring and its buttons: a try's; and a try's last ring, after its "10 min later" (no other).(package private) static final String"Try the alarm": rung as a waking, by its own action (told apart in `dumpsys alarm`).private static final StringA try's own keys: when it rings, and its words (before any list).private static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final intA try's answers (wake.rs): it rings; exact alarms, notifications or the full screen refused.(package private) static final intSeconds before a try rings (wake.rs, TRY_SECONDS).(package private) static final intprivate static final Stringprivate static final String[][] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static voidThe next ring and look given to Android's alarm clock, from the list kept: Android forgets them at a restart, a change of zone moves them.(package private) static voidRust asked for the coming wakings, then given them (WakeReceiver, on a thread of its own: Rust reads the sharing first, `fetch` the sync app given twenty seconds).(package private) static voidThe "Waking" channel: high importance (over the lock screen, the screen lit).(package private) static boolean"Alarms & reminders": Android 12 gives it at install and lets you take it back; 13 gives it for good (USE_EXACT_ALARM).private static longThe first of `times` after `after`, moved to the same time on the clock here; 0 when none.(package private) static booleanfullScreen(Context context) The screen lit over the lock screen as it rings: yours to refuse from Android 14.private static SharedPreferencesKept where the phone reads it before its first unlock (device-protected storage): times and words only, nothing of what Sioul keeps.(package private) static long"10 min later": the alarm again in ten minutes, kept for a restart; when.private static JSONObjectprivate static PendingIntentThe question before a ring and as a night starts.(package private) static longA ring the phone missed while it was off, no more than half an hour ago; 0 when none.(package private) static StringnativeNext(String zone, boolean fetch) The coming wakings (wake.rs, `sioul_wake_next`), in the phone's `zone`; JSON, or {"unknown": true}.(package private) static booleannotificationsAllowed(Context context) Sioul's notifications shown, and the "Waking" channel not turned off: else the ring has no Stop to show.(package private) static voidA ring rang (or rings now): known, so that a restart does not ring it again.(package private) static longA time made in another zone (the phone taken elsewhere, or Sioul's zone a few minutes behind a change), at the same time on the clock here: a waking at 07:00 stays at 07:00.private static PendingIntentA ring's alarm (the next waking, or the one after "10 min later"), to WakeReceiver, by no other app.(package private) static voidRust's wakings (wake.rs): {rings, looks (Unix ms), week (Monday first, "07:00" or ""), zone, words}.(package private) static voidAndroid's page where one is allowed: "exact", "screen", "notifications"; Sioul's own page else.private static PendingIntentThe alarm tapped in the status bar or on the lock screen: Sioul, as by its icon.(package private) static intFor Rust (android/main.cpp): 1 exact alarms, 2 the full screen, 4 notifications.(package private) static voidStop: nothing rings again before the next waking.private static PendingIntentA try's alarm: to WakeReceiver as a waking's, by its own action and code.(package private) static longA try's "10 min later": rung once more, as a try, its last time (without "10 min later"); when.(package private) static int"Try the alarm" (Health's settings; wake.rs hands {at (Unix ms), words}): the alarm at `at`, ten seconds on, through the path a waking takes: Android's alarm clock, WakeReceiver, WakeRinger (the rising sound, in the foreground), WakeScreen over the lock screen.(package private) static voidtryStopped(Context context) A try over (Stop, or its last ring): its alarm, if one is left, taken back; nothing of the waking's.(package private) static booleanWhether the phone was unlocked since it started: Sioul's own files can be read.(package private) static longThe next ring of the usual `week` (Monday first: "07:00", or "" when that morning does not ring) after `after`, here; 0 when none is ticked.(package private) static StringThe words said here, as Rust gave them with the wakings (or with a try), in the person's language (crates/sioul-core/locales); before either, these, by the phone's language.private static ZoneId
-
Field Details
-
RING
- See Also:
-
LOOK
- See Also:
-
STOP
- See Also:
-
LATER
- See Also:
-
TRY
"Try the alarm": rung as a waking, by its own action (told apart in `dumpsys alarm`).- See Also:
-
AT
A ring's time (Unix milliseconds), on its intent.- See Also:
-
TRIAL
On a ring and its buttons: a try's; and a try's last ring, after its "10 min later" (no other).- See Also:
-
LAST
- See Also:
-
TRY_SECONDS
Seconds before a try rings (wake.rs, TRY_SECONDS).- See Also:
-
TRY_RINGS
A try's answers (wake.rs): it rings; exact alarms, notifications or the full screen refused.- See Also:
-
TRY_NO_EXACT
- See Also:
-
TRY_NO_NOTIFICATIONS
- See Also:
-
TRY_NO_SCREEN
- See Also:
-
LATER_MINUTES
Minutes "10 min later" puts the alarm off by (wake.rs, LATER_MINUTES).- See Also:
-
CHANNEL
The "Waking" channel: the ring's notification, and the one after "10 min later".- See Also:
-
RING_CODE
- See Also:
-
LOOK_CODE
- See Also:
-
AGAIN_CODE
- See Also:
-
SHOW_CODE
- See Also:
-
STOP_CODE
- See Also:
-
LATER_CODE
- See Also:
-
SCREEN_CODE
- See Also:
-
TRY_CODE
- See Also:
-
TRY_STOP_CODE
- See Also:
-
TRY_LATER_CODE
- See Also:
-
KEPT
- See Also:
-
LIST
- See Also:
-
ARMED
The ring last given to Android, and the last that rang: a ring missed while the phone was off.- See Also:
-
RANG
- See Also:
-
AGAIN
After "10 min later": when it rings again.- See Also:
-
TRY_AT
A try's own keys: when it rings, and its words (before any list). Never the waking's.- See Also:
-
TRY_WORDS
- See Also:
-
MISSED_MS
A ring missed while the phone was off rings as it starts again, when this late at most.- See Also:
-
DUE_MS
A ring due within a minute is the one ringing now: never given again.- See Also:
-
WORDS
-
-
Constructor Details
-
WakeAlarms
private WakeAlarms()
-
-
Method Details
-
nativeNext
The coming wakings (wake.rs, `sioul_wake_next`), in the phone's `zone`; JSON, or {"unknown": true}. -
set
Rust's wakings (wake.rs): {rings, looks (Unix ms), week (Monday first, "07:00" or ""), zone, words}. Kept, then the next ring and look given to Android. Rust not knowing ({"unknown": true}: the night's file does not read) changes nothing kept. Any thread. -
arm
The next ring and look given to Android's alarm clock, from the list kept: Android forgets them at a restart, a change of zone moves them. The list run out (Sioul not asked for eight days), the usual week. A ring after "10 min later" given again too. Never inexact: without "Alarms & reminders", nothing, and the Health settings say so. Any thread. -
ask
Rust asked for the coming wakings, then given them (WakeReceiver, on a thread of its own: Rust reads the sharing first, `fetch` the sync app given twenty seconds). Not before the phone's first unlock: Sioul's files cannot be read then, and the list kept rings. No answer: the list kept goes on. -
rang
A ring rang (or rings now): known, so that a restart does not ring it again. -
missed
A ring the phone missed while it was off, no more than half an hour ago; 0 when none. -
later
"10 min later": the alarm again in ten minutes, kept for a restart; when. -
stopped
Stop: nothing rings again before the next waking. -
tryNow
"Try the alarm" (Health's settings; wake.rs hands {at (Unix ms), words}): the alarm at `at`, ten seconds on, through the path a waking takes: Android's alarm clock, WakeReceiver, WakeRinger (the rising sound, in the foreground), WakeScreen over the lock screen. By its own action, code and keys: the next waking, its list and its "10 min later" are left as they are, and nothing is written of the night. When Android refuses exact alarms, notifications or the full screen, nothing is set: the answer says which (TRY_NO_…), for the setting to say why, rather than a try that rings unseen or not at all. Not given again after a restart. -
tryLater
A try's "10 min later": rung once more, as a try, its last time (without "10 min later"); when. -
tryStopped
A try over (Stop, or its last ring): its alarm, if one is left, taken back; nothing of the waking's. -
trial
A try's alarm: to WakeReceiver as a waking's, by its own action and code. -
first
The first of `times` after `after`, moved to the same time on the clock here; 0 when none. -
rezoned
A time made in another zone (the phone taken elsewhere, or Sioul's zone a few minutes behind a change), at the same time on the clock here: a waking at 07:00 stays at 07:00. -
usual
The next ring of the usual `week` (Monday first: "07:00", or "" when that morning does not ring) after `after`, here; 0 when none is ticked. What rings when Sioul cannot be asked: the usual mornings, repeated. -
zone
-
ring
A ring's alarm (the next waking, or the one after "10 min later"), to WakeReceiver, by no other app. -
look
The question before a ring and as a night starts. -
show
The alarm tapped in the status bar or on the lock screen: Sioul, as by its icon. -
exact
"Alarms & reminders": Android 12 gives it at install and lets you take it back; 13 gives it for good (USE_EXACT_ALARM). -
fullScreen
The screen lit over the lock screen as it rings: yours to refuse from Android 14. -
notificationsAllowed
Sioul's notifications shown, and the "Waking" channel not turned off: else the ring has no Stop to show. -
state
For Rust (android/main.cpp): 1 exact alarms, 2 the full screen, 4 notifications. -
settings
Android's page where one is allowed: "exact", "screen", "notifications"; Sioul's own page else. -
unlocked
Whether the phone was unlocked since it started: Sioul's own files can be read. -
channel
The "Waking" channel: high importance (over the lock screen, the screen lit). Without a sound of its own: WakeRinger plays it, rising, where a channel's would be at one volume and stop as the shade opens. -
kept
Kept where the phone reads it before its first unlock (device-protected storage): times and words only, nothing of what Sioul keeps. -
list
-
word
The words said here, as Rust gave them with the wakings (or with a try), in the person's language (crates/sioul-core/locales); before either, these, by the phone's language.
-