When the session holds the wake lock and the Wi-Fi lock, and when it ends for lack of audio.
More...
|
| class | Decision |
| | What to do now.
|
| |
|
|
| SessionPowerPolicy (long startMillis) |
| |
|
synchronized Decision | update (long nowMillis, boolean playing) |
| |
|
|
static final long | GRACE_MS = 60_000L |
| |
|
static final long | NO_AUDIO_CEILING_MS = 15L * 60 * 1000 |
| |
|
static final long | SUSTAINED_MS = 5_000L |
| | Audio must have played this long without a break to count as playing for the grace and the ceiling.
|
| |
When the session holds the wake lock and the Wi-Fi lock, and when it ends for lack of audio.
Security review W3 of Group 8: the locks belong to playing. A server that accepts the connection and never plays (or one that drops the connection every 11 seconds) must not keep the CPU and the radio awake for hours. So:
-
the locks are held while the engine plays, and for {@value GRACE_MS} ms after the session starts or after the last time it played for {@value SUSTAINED_MS} ms in a row (connecting, a short pause of the stream, a reconnect), then released;
-
they are taken again as soon as it plays again;
-
the wake lock is renewed every 30 minutes, only while the locks are held;
-
a session that has not played for {@value NO_AUDIO_CEILING_MS} ms (15 minutes) ends, whatever the connection does.
Pure: the service calls update on its watchdog tick and does what the decision says.
The documentation for this class was generated from the following file:
- /github/workspace/yaacc/src/main/java/de/yaacc/snapcast/client/SessionPowerPolicy.java