[4.1.2] Sleep Timer does not always work/activate as expected #439

Open
opened 5 months ago by tepozoa · 3 comments

Google Pixel 6a
Android 13, stock ROM

Since the 4.1.2 upgrade changes, the sleep mode timer does not always work as expected but I cannot reproduce the problem at will; it might have something to do with Android deep sleep or charging, it's unclear. But it's happened 3 nights this week on it's own.

Process: start a Radio stream, turn on sleep timer for 1 hour (4 taps), press Home to background app. Lock screen, plug into charging cable on nightstand and go to sleep.

Result: when I wake up, sometimes - about 50%-75% of the time this week - the app is still playing the radio station. But sometimes, it works as expected and it's turned off.

Testing: I can't seem to force it to happen when I try to reproduce the problem manually; in the older 4.1.1 and below code it did work as expected, so I can only make a theory it has something to do with the new media3 API in 4.1.2 and Android sleep mode or ....?

Google Pixel 6a Android 13, stock ROM Since the 4.1.2 upgrade changes, the sleep mode timer does not always work as expected but I cannot reproduce the problem at will; it might have something to do with Android deep sleep or charging, it's unclear. But it's happened 3 nights this week on it's own. Process: start a Radio stream, turn on sleep timer for 1 hour (4 taps), press Home to background app. Lock screen, plug into charging cable on nightstand and go to sleep. Result: when I wake up, sometimes - about 50%-75% of the time this week - the app is still playing the radio station. But sometimes, it works as expected and it's turned off. Testing: I can't seem to force it to happen when I try to reproduce the problem manually; in the older 4.1.1 and below code it did work as expected, so I can only make a theory it has something to do with the new media3 API in 4.1.2 and Android sleep mode or ....?
tepozoa added the
bug
label 5 months ago
y20k commented 5 months ago
Owner

I do not use the sleep timer regularly myself. So I am thankful for any feedback!

Yesterday evening I tried to set the timer to 15 minutes and it worked. I am not sure what might have caused to stop the timer on your device.

Did you change stations while the timer was running?

I do not use the sleep timer regularly myself. So I am thankful for any feedback! Yesterday evening I tried to set the timer to 15 minutes and it worked. I am not sure what might have caused to stop the timer on your device. Did you change stations while the timer was running?
Poster

No, no station changes - if anything, I'm pretty boring and regular on how I use Transistor. :) It worked as expected last night doing the exact same nightly process, so we have 3 nights it worked and 3 nights it didn't work this week on my device.

I'm continuing to brainstorm - "maybe the network pausing when the timer is supposed to trigger, but the app is trying to (re)start the station?" "maybe Google Play Services is upgrading something in the background that trips up the app?" "maybe it has to do with how empty the battery is first when I start charging?"

I'll continue to hunt for clues, right now "it happens, randomly, and I don't know why." :(

No, no station changes - if anything, I'm pretty boring and regular on how I use Transistor. :) It worked as expected last night doing the exact same nightly process, so we have 3 nights it worked and 3 nights it didn't work this week on my device. I'm continuing to brainstorm - "maybe the network pausing when the timer is supposed to trigger, but the app is trying to (re)start the station?" "maybe Google Play Services is upgrading something in the background that trips up the app?" "maybe it has to do with how empty the battery is first when I start charging?" I'll continue to hunt for clues, right now "it happens, randomly, and I don't know why." :(
Poster

Hi @y20k I finally figured it out last night! It's caused when Transistor is playing with a sleep timer and the Android network connection changes from WiFi to LTE and causes the app to "restart" the station, which causes the sleep timer to get disabled/erased/reset. I tested on two phones and two hotspots to different ISPs this morning to create two repeatable simulations.

Simulation 1: make sure the Internet/WiFi toggle is in your Android quick access bar for this one (so we don't lose Transistor app focus to see something).

  1. Make sure phone is on WiFi
  2. Start Transistor playing a station
  3. Open station drawer, tap once to start sleep timer, close drawer
  4. Pull down Android quick access bar and disable WiFi, close quick access

Watch Transistor - when the network falls back to LTE and the app re-buffers the station in about 10 seconds, you will see the Stop/Play button on the bottom right toggle itself. Pull up the station drawer and the sleep timer is disabled.

Simulation 2: this is simulating a real life ISP failure.

  1. Make sure phone is on WiFi to hotspot
  2. Start Transistor playing a station
  3. Open station drawer, tap once to start sleep timer, close drawer
  4. Lock phone (like you're going to sleep)
  5. Unplug hotspot

Listen to the phone until you hear the pause/re-buffer of the music, unlock the phone and open Transistor, the sleep timer will be disabled.

Real Life: my ISP connection will pause/die/resume sometimes, it's a 5G cellular connection on the other side of the Wifi hotspot. When that happens, the Android detects "no internet" and falls back to LTE. Later, Android will detect the WiFi has internet access again and reconnect - but I'm asleep and don't notice. Last night it never "came back" so I woke up to Transistor playing music on LTE which gave me the final clue to debug.

Hi @y20k I finally figured it out last night! It's caused when Transistor is playing with a sleep timer and the Android network connection changes from WiFi to LTE and causes the app to "restart" the station, which causes the sleep timer to get disabled/erased/reset. I tested on two phones and two hotspots to different ISPs this morning to create two repeatable simulations. **Simulation 1**: make sure the Internet/WiFi toggle is in your Android quick access bar for this one (so we don't lose Transistor app focus to see something). 1. Make sure phone is on WiFi 2. Start Transistor playing a station 3. Open station drawer, tap once to start sleep timer, close drawer 4. Pull down Android quick access bar and disable WiFi, close quick access Watch Transistor - when the network falls back to LTE and the app re-buffers the station in about 10 seconds, you will see the Stop/Play button on the bottom right toggle itself. Pull up the station drawer and the sleep timer is disabled. **Simulation 2**: this is simulating a real life ISP failure. 1. Make sure phone is on WiFi to hotspot 2. Start Transistor playing a station 3. Open station drawer, tap once to start sleep timer, close drawer 4. Lock phone (like you're going to sleep) 5. Unplug hotspot Listen to the phone until you hear the pause/re-buffer of the music, unlock the phone and open Transistor, the sleep timer will be disabled. **Real Life**: my ISP connection will pause/die/resume sometimes, it's a 5G cellular connection on the other side of the Wifi hotspot. When that happens, the Android detects "no internet" and falls back to LTE. Later, Android will detect the WiFi has internet access again and reconnect - but I'm asleep and don't notice. Last night it never "came back" so I woke up to Transistor playing music on LTE which gave me the final clue to debug.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
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: y20k/transistor#439
Loading…
There is no content yet.