Class WakeRinger

All Implemented Interfaces:
ComponentCallbacks, ComponentCallbacks2

public final class WakeRinger extends Service
The alarm at waking, ringing (WakeAlarms): a service in the foreground for as long as it rings, its notification on the "Waking" channel with the screen over the lock screen (WakeScreen), Stop and 10 min later. Sioul plays the sound itself, the phone's alarm sound as an alarm (it comes through Android's do-not-disturb, which lets alarms through unless set to total silence), rising from very low to full over half a minute: a channel's sound would be at one volume, and an insistent one stops as the shade opens. It rings until Stop or 10 min later; never silent: another sound when the alarm's does not play, beeps when none does, and the ring without this service when Android refuses it. From Android 14 the service is of the type alarms keep ringing with ("systemExempted", allowed to apps that set exact alarms). A try ("Try the alarm") rings here the same way; its Stop and 10 min later touch only the try: 10 min later rings it once more, then it offers Stop alone. A waking that comes while a try rings takes it over; a try that comes while a waking rings changes nothing.
  • Field Details

  • Constructor Details

  • Method Details

    • ring

      static void ring(Context context, long at, boolean trial, boolean lastTry)
      The alarm rings (WakeReceiver): this service, in the foreground; else the ring from here. `trial`: a try's; `lastTry`: a try's last ring.
    • stop

      static void stop(Context context, boolean later, boolean trial)
      Stop, or 10 min later (its buttons, its notification swiped away, the screen's buttons). What rings says whether it is a try; when nothing rings here (a "rings again" line's Stop, Sioul started again since), the button's own word, `trial`.
    • trying

      static boolean trying()
      Whether what rings is a try.
    • laterOffered

      static boolean laterOffered()
      Whether "10 min later" is offered: always but on a try's last ring.
    • begin

      private static void begin(boolean trial, boolean lastTry, boolean ringingAlready)
      What rings from now: a waking takes a try over; a try never takes a waking over.
    • ringing

      static boolean ringing()
      Whether it rings now (the screen opened late shows nothing).
    • onStartCommand

      public int onStartCommand(Intent intent, int flags, int id)
      Overrides:
      onStartCommand in class Service
    • onDestroy

      public void onDestroy()
      Overrides:
      onDestroy in class Service
    • onBind

      public IBinder onBind(Intent intent)
      Specified by:
      onBind in class Service
    • end

      private void end(boolean later)
      Stop, or 10 min later: silent, the notification and the screen gone.
    • ended

      private static void ended(Context context, boolean later, boolean trial, boolean lastTry)
      After the ring, whichever way it rang: 10 min later set, or nothing more until the next waking. A try's touch only the try: 10 min later rings it once more, as a try, its last time; after that, or at Stop, it is over. The next waking and its own "10 min later" stay as they are.
    • alarm

      private static AudioAttributes alarm()
    • sounds

      private static List<Uri> sounds(Context context)
      The sounds tried in turn: the phone's alarm sound (the settings' own address, which Android keeps readable before the first unlock), then the same by its file, the notifications' sound, the ringtone.
    • play

      private void play()
    • gain

      private static float gain(double t)
      The gain at `t` of the rise (0 to 1): even steps in decibels, as the ear hears them.
    • beep

      private void beep()
      No sound plays: beeps, as an alarm, at full; the phone kept awake for them until the end.
    • silence

      private void silence()
    • ringBare

      private static void ringBare(Context context, long at, boolean trial, boolean lastTry)
      Android refused this service: the notification and the alarm sound from here, as long as Android lets the process be.
    • hold

      private static void hold(Context context)
    • release

      private static void release()
    • clock

      static String clock(Context context, long at)
      "07:00", as the phone writes times (12 or 24 hours).
    • note

      private static Notification note(Context context, long at)
      The ring's notification: the screen over the lock screen (full-screen, WakeScreen), Stop and 10 min later (not on a try's last ring); swiped away, it stops. Shown on the lock screen whole: a time and two buttons. A try's buttons by codes of their own, saying a try's.
    • again

      private static void again(Context context, long at, boolean trial)
      After "10 min later": when it rings again, with Stop (a try's, its own line and Stop). Silent: the "Waking" channel has no sound of its own (WakeAlarms.channel(android.content.Context)).
    • button

      private static PendingIntent button(Context context, String what, int code, boolean trial)
    • action

      private static Notification.Action action(Context context, String what, int code, String word, boolean trial)