Hi Joshua,
I tried with SimpleMixer, but couldn’t replicate the sound bug.
But it happens with “Freeze!” and our other Android apps (with and without Google Play Game Services) on the NEXUS 7.
We use only the following libraries, nothing fancy:
* Particle Candy
* gtween
I was wondering if maybe the size of the app (“Freeze!” is about 45 MB) may have something to do with the issue, because much more is going on internally than with the simple examples like SimpleMixer.
To locate the problem I started adb logcat and started “Freeze!” a few times, the bg music starts to play as soon as the home screen of the game is displayed.
And then I switched off with the power button - and after a few tries the bug occurred and the bg music continued to play on the switched off device.
Here is the log for the normal shut down when everything is fine and the music stops to play in the bg:
– BG MUSIC STOPPED AFTER SHUT DOWN
I/PowerManagerService( 518): Going to sleep by user request…
D/SurfaceFlinger( 176): Screen released, type=0 flinger=0xb8735478
D/audio_hw_primary( 179): adev_set_parameters: enter: screen_state=off
D/audio_hw_primary( 179): adev_set_parameters: exit with code(-2)
I/L ( 4498): videos.remote.MediaRouteManager.stopScan:155 Scanning stopped
D/BaseCastMediaRouteProvider( 4498): in onDiscoveryRequestChanged: request=null
D/YouTube ( 6518): youtube.app.prefetch.g.onReceive:367 Received: android.intent.action.SCREEN_OFF
V/KeyguardHostView( 518): hide transport, gen:1
V/KeyguardHostView( 518): music state changed: 0
D/SsdpScanner( 4498): Receive thread got an exception; mShouldStop=true
D/SsdpScanner( 4498): java.net.SocketException: Socket closed
D/SsdpScanner( 4498): at libcore.io.Posix.recvfromBytes(Native Method)
D/SsdpScanner( 4498): at libcore.io.Posix.recvfrom(Posix.java:140)
D/SsdpScanner( 4498): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
D/SsdpScanner( 4498): at libcore.io.IoBridge.recvfrom(IoBridge.java:506)
D/SsdpScanner( 4498): at java.net.PlainDatagramSocketImpl.doRecv(PlainDatagramSocketImpl.java:161)
D/SsdpScanner( 4498): at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:169)
D/SsdpScanner( 4498): at java.net.DatagramSocket.receive(DatagramSocket.java:253)
D/SsdpScanner( 4498): at com.google.cast.SsdpScanner.a(SourceFile:372)
D/SsdpScanner( 4498): at com.google.cast.SsdpScanner.a(SourceFile:45)
D/SsdpScanner( 4498): at com.google.cast.SsdpScanner$b.run(SourceFile:625)
D/SsdpScanner( 4498): at java.lang.Thread.run(Thread.java:841)
D/DeviceManager( 4498): notifyStateChanged: 0
D/PhoneStatusBar( 653): disable: < expand icons alerts ticker system_info back home RECENT* clock search >
D/SurfaceControl( 518): Excessive delay in blankDisplay() while turning screen off: 292ms
V/TAG ( 518): bug 7643792: fitSystemWindows([0,50][0,0])
D/PhoneStatusBar( 653): disable: < expand icons alerts ticker system_info BACK* HOME* RECENT CLOCK* search >
I/wpa_supplicant( 633): wlan0: WPA: Group rekeying completed with 00:1c:4a:4a:27:e4 [GTK=TKIP]
D/audio_hw_primary( 179): out_standby: enter: usecase(1: low-latency-playback)
D/audio_hw_primary( 179): stop_output_stream: enter: usecase(1: low-latency-playback)
D/audio_hw_primary( 179): disable_audio_route: reset mixer path: low-latency-playback
D/audio_hw_primary( 179): disable_snd_device: snd_device(2: speaker)
D/audio_hw_primary( 179): stop_output_stream: exit: status(0)
D/audio_hw_primary( 179): out_standby: exit
And here is the log for the bug, the music didn’t stop playing:
– BG MUSIC CONTINUED TO PLAY AFTER SHUT DOWN
I/PowerManagerService( 518): Going to sleep by user request…
D/LightsService( 518): Excessive delay setting light: 53ms
D/SurfaceFlinger( 176): Screen released, type=0 flinger=0xb8735478
D/audio_hw_primary( 179): adev_set_parameters: enter: screen_state=off
D/audio_hw_primary( 179): adev_set_parameters: exit with code(-2)
V/KeyguardHostView( 518): hide transport, gen:1
V/KeyguardHostView( 518): music state changed: 0
I/L ( 4498): videos.remote.MediaRouteManager.stopScan:155 Scanning stopped
D/BaseCastMediaRouteProvider( 4498): in onDiscoveryRequestChanged: request=null
D/YouTube ( 6518): youtube.app.prefetch.g.onReceive:367 Received: android.intent.action.SCREEN_OFF
D/SsdpScanner( 4498): Receive thread got an exception; mShouldStop=true
D/SsdpScanner( 4498): java.net.SocketException: Socket closed
D/SsdpScanner( 4498): at libcore.io.Posix.recvfromBytes(Native Method)
D/SsdpScanner( 4498): at libcore.io.Posix.recvfrom(Posix.java:140)
D/SsdpScanner( 4498): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
D/SsdpScanner( 4498): at libcore.io.IoBridge.recvfrom(IoBridge.java:506)
D/SsdpScanner( 4498): at java.net.PlainDatagramSocketImpl.doRecv(PlainDatagramSocketImpl.java:161)
D/SsdpScanner( 4498): at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:169)
D/SsdpScanner( 4498): at java.net.DatagramSocket.receive(DatagramSocket.java:253)
D/SsdpScanner( 4498): at com.google.cast.SsdpScanner.a(SourceFile:372)
D/SsdpScanner( 4498): at com.google.cast.SsdpScanner.a(SourceFile:45)
D/SsdpScanner( 4498): at com.google.cast.SsdpScanner$b.run(SourceFile:625)
D/SsdpScanner( 4498): at java.lang.Thread.run(Thread.java:841)
D/DeviceManager( 4498): notifyStateChanged: 0
D/PhoneStatusBar( 653): disable: < expand icons alerts ticker system_info back home RECENT* clock search >
D/SurfaceControl( 518): Excessive delay in blankDisplay() while turning screen off: 294ms
V/KeyguardHostView( 518): hide transport, gen:1
V/KeyguardHostView( 518): music state changed: 0
V/TAG ( 518): bug 7643792: fitSystemWindows([0,50][0,0])
D/PhoneStatusBar( 653): disable: < expand icons alerts ticker system_info BACK* HOME* RECENT CLOCK* search >
As you can see there is no internal crash of my game or bad stuff happening.
But once in a while after shut down the whole stop-audio-block is missing:
D/audio_hw_primary( 179): out_standby: enter: usecase(1: low-latency-playback)
D/audio_hw_primary( 179): stop_output_stream: enter: usecase(1: low-latency-playback)
D/audio_hw_primary( 179): disable_audio_route: reset mixer path: low-latency-playback
D/audio_hw_primary( 179): disable_snd_device: snd_device(2: speaker)
D/audio_hw_primary( 179): stop_output_stream: exit: status(0)
D/audio_hw_primary( 179): out_standby: exit
So there might be a problem with the audio HAL implementation, because on exit sometimes these functions are not called?
Hope this helps,
best,
Andreas