|
@@ -68,14 +68,14 @@ class RadioService : MediaBrowserServiceCompat() {
|
68
|
68
|
// This *should* work in any case...
|
69
|
69
|
when (intent.getIntExtra("state", -1)) {
|
70
|
70
|
0 -> {
|
71
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Headset is unplugged")
|
|
71
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "Headset is unplugged")
|
72
|
72
|
}
|
73
|
73
|
1 -> {
|
74
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Headset is plugged")
|
|
74
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "Headset is plugged")
|
75
|
75
|
headsetPluggedIn = true
|
76
|
76
|
}
|
77
|
77
|
else -> {
|
78
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "I have no idea what the headset state is")
|
|
78
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "I have no idea what the headset state is")
|
79
|
79
|
}
|
80
|
80
|
}
|
81
|
81
|
/*
|
|
@@ -91,7 +91,7 @@ class RadioService : MediaBrowserServiceCompat() {
|
91
|
91
|
}
|
92
|
92
|
else
|
93
|
93
|
{
|
94
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Can't get state?")
|
|
94
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "Can't get state?")
|
95
|
95
|
}
|
96
|
96
|
|
97
|
97
|
*/
|
|
@@ -127,7 +127,7 @@ class RadioService : MediaBrowserServiceCompat() {
|
127
|
127
|
|
128
|
128
|
if (PlayerStore.instance.playbackState.value == PlaybackStateCompat.STATE_PLAYING)
|
129
|
129
|
{
|
130
|
|
- Log.d(tag, radioTag + "SONG CHANGED AND PLAYING")
|
|
130
|
+ //[REMOVE LOG CALLS]Log.d((tag, radioTag + "SONG CHANGED AND PLAYING")
|
131
|
131
|
// we activate latency compensation only if it's been at least 2 songs...
|
132
|
132
|
when {
|
133
|
133
|
PlayerStore.instance.isStreamDown -> {
|
|
@@ -233,7 +233,7 @@ class RadioService : MediaBrowserServiceCompat() {
|
233
|
233
|
startForeground(radioServiceId, nowPlayingNotification.notification)
|
234
|
234
|
|
235
|
235
|
PlayerStore.instance.isServiceStarted.value = true
|
236
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "created")
|
|
236
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "created")
|
237
|
237
|
}
|
238
|
238
|
|
239
|
239
|
private val handler = Handler()
|
|
@@ -274,7 +274,7 @@ class RadioService : MediaBrowserServiceCompat() {
|
274
|
274
|
Actions.CANCEL_FADE_OUT.name -> { handler.removeCallbacks(lowerVolumeRunnable) }
|
275
|
275
|
Actions.SNOOZE.name -> { RadioAlarm.instance.snooze(this) }
|
276
|
276
|
}
|
277
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "intent received : " + intent.getStringExtra("action"))
|
|
277
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "intent received : " + intent.getStringExtra("action"))
|
278
|
278
|
super.onStartCommand(intent, flags, startId)
|
279
|
279
|
// The service must be re-created if it is destroyed by the system. This allows the user to keep actions like Bluetooth and headphones plug available.
|
280
|
280
|
return START_STICKY
|
|
@@ -286,7 +286,7 @@ class RadioService : MediaBrowserServiceCompat() {
|
286
|
286
|
stopSelf()
|
287
|
287
|
}
|
288
|
288
|
super.onTaskRemoved(rootIntent)
|
289
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "task removed")
|
|
289
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "task removed")
|
290
|
290
|
}
|
291
|
291
|
|
292
|
292
|
override fun onDestroy() {
|
|
@@ -318,7 +318,7 @@ class RadioService : MediaBrowserServiceCompat() {
|
318
|
318
|
}
|
319
|
319
|
|
320
|
320
|
apiTicker.cancel() // stops the timer.
|
321
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "destroyed")
|
|
321
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "destroyed")
|
322
|
322
|
// if the service is destroyed, the application had become useless.
|
323
|
323
|
exitProcess(0)
|
324
|
324
|
}
|
|
@@ -389,10 +389,10 @@ class RadioService : MediaBrowserServiceCompat() {
|
389
|
389
|
for (i in 0 until it.length()) {
|
390
|
390
|
val entry = it.get(i)
|
391
|
391
|
if (entry is IcyHeaders) {
|
392
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "onMetadata: IcyHeaders $entry")
|
|
392
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "onMetadata: IcyHeaders $entry")
|
393
|
393
|
}
|
394
|
394
|
if (entry is IcyInfo) {
|
395
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "onMetadata: Title ----> ${entry.title}")
|
|
395
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "onMetadata: Title ----> ${entry.title}")
|
396
|
396
|
// Note : Kotlin supports UTF-8 by default.
|
397
|
397
|
numberOfSongs++
|
398
|
398
|
val data = entry.title!!
|
|
@@ -467,7 +467,7 @@ class RadioService : MediaBrowserServiceCompat() {
|
467
|
467
|
{
|
468
|
468
|
Thread.sleep(1000)
|
469
|
469
|
i++
|
470
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, "$i, isAlarmStopped=$isAlarmStopped")
|
|
470
|
+ //[REMOVE LOG CALLS]Log.d(tag, "$i, isAlarmStopped=$isAlarmStopped")
|
471
|
471
|
}
|
472
|
472
|
}
|
473
|
473
|
val post: (Any?) -> Unit = {
|
|
@@ -540,7 +540,7 @@ class RadioService : MediaBrowserServiceCompat() {
|
540
|
540
|
SystemClock.elapsedRealtime()
|
541
|
541
|
)
|
542
|
542
|
mediaSession.setPlaybackState(playbackStateBuilder.build())
|
543
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "begin playing")
|
|
543
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "begin playing")
|
544
|
544
|
}
|
545
|
545
|
|
546
|
546
|
private fun pausePlaying()
|
|
@@ -569,7 +569,7 @@ class RadioService : MediaBrowserServiceCompat() {
|
569
|
569
|
1.0f,
|
570
|
570
|
SystemClock.elapsedRealtime()
|
571
|
571
|
)
|
572
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "stopped")
|
|
572
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "stopped")
|
573
|
573
|
|
574
|
574
|
mediaSession.setPlaybackState(playbackStateBuilder.build())
|
575
|
575
|
}
|
|
@@ -657,7 +657,7 @@ class RadioService : MediaBrowserServiceCompat() {
|
657
|
657
|
Player.STATE_ENDED -> state = "Player.STATE_ENDED"
|
658
|
658
|
Player.STATE_READY -> state = "Player.STATE_READY"
|
659
|
659
|
}
|
660
|
|
- //[REMOVE LOG CALLS]//[REMOVE LOG CALLS]Log.d(tag, radioTag + "Player changed state: ${state}. numberOfSongs reset.")
|
|
660
|
+ //[REMOVE LOG CALLS]Log.d(tag, radioTag + "Player changed state: ${state}. numberOfSongs reset.")
|
661
|
661
|
}
|
662
|
662
|
}
|
663
|
663
|
|