Package com.aurelienpierre.sioul
Class DndReceiver
java.lang.Object
android.content.BroadcastReceiver
com.aurelienpierre.sioul.DndReceiver
Do-not-disturb applied in Sioul's own process (crates/sioul-app/src/
everywhere.rs, `apply`), where Android's modes of Sioul's are kept
(PauseMode): asked by the background service when your other devices
changed it, at the alarm of its next end (the switch's "until", waking,
the night), and after the phone's restart. Sioul's window open or not:
the library is loaded alone, as for a dose (
DoseAlarms.load(android.content.Context)), and Rust
answers on a thread of its own, the broadcast held open meanwhile.
Both ways (docs/do-not-disturb.md): the phone's own do-not-disturb heard as
it changes, Sioul closed or not. Android sends a package with Do Not
Disturb access ACTION_INTERRUPTION_FILTER_CHANGED (NotificationManagerService,
"explicitly send the broadcast to all DND packages, even if they aren't
currently running"), and the owner of a mode its
ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED; both are protected broadcasts,
which only the system sends, so this receiver stays not exported. Decided
in Java (DndHeard), the library loaded only for a press; a change heard
while Sioul's own settles is looked at again once it did. The notification
listener, while bound, hears every change too (AppNotes,
onInterruptionFilterChanged) and forwards it here (HEARD): whichever word
comes first is decided, the other finds nothing new. Each decision is
logged, without anything of the person's. The state found at a restart or
an update is noted, so that the next change counts from it. Also Sioul's
switch pressed on its quick-settings tile (DndTile).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static interfaceWork that may wait, on a thread of its own, the broadcast held open meanwhile.Nested classes/interfaces inherited from class android.content.BroadcastReceiver
BroadcastReceiver.PendingResult -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Stringprivate static final intprivate static final ObjectOne decision at a time in this process: Android's broadcast and the listener's word of one change, decided together, would both see it new.(package private) static final StringThe phone's interruption filter changed, as Sioul's notification listener heard it (AppNotes.onInterruptionFilterChanged(int), in its own process): decided here as Android's own broadcast is, whichever comes first.private static final intLooked at again at most this often while Sioul's own changes follow each other.(package private) static final StringSioul's switch pressed on its quick-settings tile (DndTile).private static final longA look again waits this long at most, the broadcast held open meanwhile. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringOne decision (PauseMode.decide(android.content.Context, java.lang.String, int, java.lang.String, java.lang.String)), never two at once in this process.(package private) static voidThe listener's word of a change (AppNotes, in its own process): decided in Sioul's own.private static voidheard(Context app, Intent intent, BroadcastReceiver.PendingResult held) A change of the phone's own do-not-disturb: decided, looked at again once Sioul's own change settled, pressed (Rust).private static voidlater(BroadcastReceiver.PendingResult held, String what, DndReceiver.Work work) (package private) static StringDo-not-disturb as the reasons say now, applied here (Rust); its answer, "" when none.(package private) static StringnativeHeard(String json) A change of the phone's own do-not-disturb, heard as it happened: {on}.(package private) static StringSioul's switch pressed on its tile: on, or off, as it is not now (Rust).void(package private) static voidAsked from the background service's process: applied in Sioul's own.(package private) static voidApplied again at `atMillis` (Unix milliseconds), the next end Rust gave; 0 takes the alarm away.Methods inherited from class android.content.BroadcastReceiver
abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getResultCode, getResultData, getResultExtras, getSentFromPackage, getSentFromUid, goAsync, isInitialStickyBroadcast, isOrderedBroadcast, peekService, setDebugUnregister, setOrderedHint, setResult, setResultCode, setResultData, setResultExtras
-
Field Details
-
APPLY
- See Also:
-
TOGGLE
Sioul's switch pressed on its quick-settings tile (DndTile).- See Also:
-
HEARD
The phone's interruption filter changed, as Sioul's notification listener heard it (AppNotes.onInterruptionFilterChanged(int), in its own process): decided here as Android's own broadcast is, whichever comes first.- See Also:
-
CODE
- See Also:
-
WAIT_MS
A look again waits this long at most, the broadcast held open meanwhile.- See Also:
-
LOOKS
Looked at again at most this often while Sioul's own changes follow each other.- See Also:
-
DECIDING
One decision at a time in this process: Android's broadcast and the listener's word of one change, decided together, would both see it new.
-
-
Constructor Details
-
DndReceiver
public DndReceiver()
-
-
Method Details
-
nativeApply
Do-not-disturb as the reasons say now, applied here (Rust); its answer, "" when none. -
nativeHeard
A change of the phone's own do-not-disturb, heard as it happened: {on}. A press when it disagrees (Rust). -
nativeToggle
Sioul's switch pressed on its tile: on, or off, as it is not now (Rust). -
onReceive
- Specified by:
onReceivein classBroadcastReceiver
-
heard
A change of the phone's own do-not-disturb: decided, looked at again once Sioul's own change settled, pressed (Rust). -
decided
One decision (PauseMode.decide(android.content.Context, java.lang.String, int, java.lang.String, java.lang.String)), never two at once in this process. -
forward
The listener's word of a change (AppNotes, in its own process): decided in Sioul's own. -
later
-
poke
Asked from the background service's process: applied in Sioul's own. -
schedule
Applied again at `atMillis` (Unix milliseconds), the next end Rust gave; 0 takes the alarm away. Exact through Doze while allowed, else within Android's inexact window.
-