mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-21 19:48:29 +00:00
Make voice note playback log statement more readable.
This commit is contained in:
@@ -115,24 +115,23 @@ public class VoiceNotePlaybackService extends MediaSessionService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlaybackStateChanged(int playbackState) {
|
public void onPlaybackStateChanged(int playbackState) {
|
||||||
Log.d(TAG, "[onPlaybackStateChanged] playbackState: " + playbackState);
|
|
||||||
boolean playWhenReady = player.getPlayWhenReady();
|
boolean playWhenReady = player.getPlayWhenReady();
|
||||||
|
Log.d(TAG, "[onPlaybackStateChanged] playbackState: " + playbackStateToString(playbackState) + "\tplayWhenReady: " + playWhenReady);
|
||||||
switch (playbackState) {
|
switch (playbackState) {
|
||||||
case Player.STATE_BUFFERING:
|
case Player.STATE_BUFFERING, Player.STATE_READY -> {
|
||||||
case Player.STATE_READY:
|
|
||||||
|
|
||||||
if (!playWhenReady) {
|
if (!playWhenReady) {
|
||||||
stopForeground(false);
|
stopForeground(false);
|
||||||
} else {
|
} else {
|
||||||
sendViewedReceiptForCurrentWindowIndex();
|
sendViewedReceiptForCurrentWindowIndex();
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case Player.STATE_ENDED:
|
case Player.STATE_ENDED -> {
|
||||||
if (previousPlaybackState == Player.STATE_READY) {
|
if (previousPlaybackState == Player.STATE_READY) {
|
||||||
player.clearMediaItems();
|
player.clearMediaItems();
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
default -> {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
previousPlaybackState = playbackState;
|
previousPlaybackState = playbackState;
|
||||||
}
|
}
|
||||||
@@ -361,4 +360,14 @@ public class VoiceNotePlaybackService extends MediaSessionService {
|
|||||||
Log.e(TAG, "Could not start VoiceNotePlaybackService, encountered a ForegroundServiceStartNotAllowedException.");
|
Log.e(TAG, "Could not start VoiceNotePlaybackService, encountered a ForegroundServiceStartNotAllowedException.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String playbackStateToString(int playbackState) {
|
||||||
|
return switch (playbackState) {
|
||||||
|
case Player.STATE_IDLE -> "Player.STATE_IDLE";
|
||||||
|
case Player.STATE_BUFFERING -> "Player.STATE_BUFFERING";
|
||||||
|
case Player.STATE_READY -> "Player.STATE_READY";
|
||||||
|
case Player.STATE_ENDED -> "Player.STATE_ENDED";
|
||||||
|
default -> "UNKNOWN(" + playbackState + ")";
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user