Installation:

  1. Install Automate and Quick Task from the Play Store
  2. Open Quick Task, grant all permissions and create a new tile called "Lullaby"
  3. Download my script from the attached files below
  4. Open the file on your Android device to import it into Automate and grant all required permissions
  5. In the Automate settings check "Run on system startup"
  6. Select the "Lullaby: Music Sleep Timer" from the list and run it
  7. Add the "Lullaby" tile to your quick settings, on LineageOS tap the pencil icon


Usage:

  • Tap the tile to start the timer. Multiple taps increase the duration. The default presets are: 5 min, 10 min, 20 min, off
  • The time is shown below the tile. It is updated every minute to show the remaining time.
  • After the time runs out it won't be shown anymore, however the tile will stay "enabled" until the music stops.
  • Tap the tile again at any time to "bump" the time up to the next timeout preset and re-start the timer from there.
  • Hold the tile to customize the presets (this also stops the timer.) Tap any entry to change the value. To add an entry tap the first line, to remove one set it's time to 0 and tap "ok". Tap "Cancel" exit the menu, all changes are saved automatically.


Known Issues:

  • After tapping the tile does not update instantly. Most likely Android tries hard to save power and goes a bit too far. Typically "taps" are not lost, it's just a visual thing, so be patient.
  • The real timeout duration may differ from the set duration. In this case please try the timing workarounds in Automate's settings.