Shake to extend active sleep timer is not working #7

Closed
opened 2026-09-18 07:13:12 +02:00 by alexander · 0 comments
Owner

Problem

The shake to extend sleep timer behavior is not working during audiobook playback.

When a sleep timer is active, shaking the device should trigger BookWave's existing sleep-timer extension behavior. Currently, shaking the device does not extend the timer as expected.

Expected behavior

When all of the following are true:

  • audiobook playback is active;
  • a sleep timer is currently running;
  • shake-to-extend is enabled/configured where applicable;

then a qualifying shake gesture should extend the current sleep timer using BookWave's existing configured extension behavior.

The gesture should not create a second independent timer or reset unrelated playback state.

Investigation notes

Primary ownership: Playback & Lifecycle Agent

The implementation should also involve the Android/system boundary where device motion/sensor events are observed.

Check the full path from:

  1. accelerometer/sensor listener registration;
  2. shake detection;
  3. lifecycle/background behavior while playback is owned by the playback service;
  4. delivery of the detected gesture to the active sleep timer;
  5. persistence/UI state reflecting the updated timer.

Pay particular attention to whether the sensor listener is only alive while a Compose/UI surface is foregrounded. Sleep-timer behavior needs to remain correct while playback continues with the app backgrounded or the screen off, subject to Android platform constraints.

Acceptance criteria

  1. Start audiobook playback and start a sleep timer.
  2. With shake-to-extend enabled/configured, perform a qualifying shake.
  3. The active timer is extended using the existing configured extension amount/behavior.
  4. The updated remaining time is reflected consistently in any sleep-timer UI/state.
  5. Repeated valid shakes extend the timer predictably without creating duplicate timers.
  6. Accidental minor movement does not continuously extend the timer.
  7. The feature works in the relevant playback lifecycle states, including app foreground and background/screen-off behavior where Android permits sensor handling.
  8. Stopping/cancelling the sleep timer also stops shake-to-extend handling when it is no longer needed.
  9. Add regression coverage for the timer-extension path where practical, plus device-level verification because sensor behavior cannot be proven by unit tests alone.

User report

Observed on a real device during normal audiobook playback: shaking the device while a sleep timer is active does not extend the timer.

## Problem The **shake to extend sleep timer** behavior is not working during audiobook playback. When a sleep timer is active, shaking the device should trigger BookWave's existing sleep-timer extension behavior. Currently, shaking the device does not extend the timer as expected. ## Expected behavior When all of the following are true: - audiobook playback is active; - a sleep timer is currently running; - shake-to-extend is enabled/configured where applicable; then a qualifying shake gesture should extend the current sleep timer using BookWave's existing configured extension behavior. The gesture should not create a second independent timer or reset unrelated playback state. ## Investigation notes Primary ownership: **Playback & Lifecycle Agent** The implementation should also involve the Android/system boundary where device motion/sensor events are observed. Check the full path from: 1. accelerometer/sensor listener registration; 2. shake detection; 3. lifecycle/background behavior while playback is owned by the playback service; 4. delivery of the detected gesture to the active sleep timer; 5. persistence/UI state reflecting the updated timer. Pay particular attention to whether the sensor listener is only alive while a Compose/UI surface is foregrounded. Sleep-timer behavior needs to remain correct while playback continues with the app backgrounded or the screen off, subject to Android platform constraints. ## Acceptance criteria 1. Start audiobook playback and start a sleep timer. 2. With shake-to-extend enabled/configured, perform a qualifying shake. 3. The active timer is extended using the existing configured extension amount/behavior. 4. The updated remaining time is reflected consistently in any sleep-timer UI/state. 5. Repeated valid shakes extend the timer predictably without creating duplicate timers. 6. Accidental minor movement does not continuously extend the timer. 7. The feature works in the relevant playback lifecycle states, including app foreground and background/screen-off behavior where Android permits sensor handling. 8. Stopping/cancelling the sleep timer also stops shake-to-extend handling when it is no longer needed. 9. Add regression coverage for the timer-extension path where practical, plus device-level verification because sensor behavior cannot be proven by unit tests alone. ## User report Observed on a real device during normal audiobook playback: shaking the device while a sleep timer is active does not extend the timer.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
alexander/Audiobookshelf-Manager-Claude#7
No description provided.