Omkar Amberkar
12/13/2022, 1:09 AMAndroidView(
modifier = modifier.fillMaxSize(),
factory = { context ->
val view = LayoutInflater.from(context).inflate(R.layout.layout_player, FrameLayout(context), false)
val aspectRatioFrameLayout = view.findViewById<AspectRatioFrameLayout>(R.id.aspect_ratio_frame_layout)
aspectRatioFrameLayout.setAspectRatio(videoAspectRatioValue)
val surfaceView = view.findViewById<SurfaceView>(R.id.surface_view)
surfaceView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
override fun onViewAttachedToWindow(view: View) {
attachSurface(view as SurfaceView)
}
override fun onViewDetachedFromWindow(view: View) {
detachSurface(view as SurfaceView)
}
})
return@AndroidView view
}
)
and seeing random closing/disposing of the composable and navigating back to its previous screen when the video is playing and here is the logs that I am getting right now when it happens. the detach is just from the surface view detach callback set right now and then afterwards the composable is disposed. how can I fix this? is this an internal bug with surface view and composable?Omkar Amberkar
12/13/2022, 1:10 AM15:08:31.242 21064-21064 SurfaceSyncer E Failed to find sync for id=1
15:08:31.242 21064-21064 SurfaceSyncer E Failed to find sync for id=2
15:08:31.242 21064-21064 SurfaceSyncer E Failed to find sync for id=3
15:08:31.242 21064-21064 SurfaceSyncer E Failed to find sync for id=4
15:08:31.242 21064-21064 SurfaceSyncer E Failed to find sync for id=5
15:08:31.242 21064-21064 SurfaceSyncer E Failed to find sync for id=6
15:08:31.253 21064-21064 SurfaceSyncer E Failed to find sync for id=0
15:08:31.253 21064-21064 SurfaceSyncer E Failed to find sync for id=1
15:08:31.253 21064-21064 SurfaceSyncer E Failed to find sync for id=2
15:08:31.253 21064-21064 SurfaceSyncer E Failed to find sync for id=3
15:08:31.253 21064-21064 SurfaceSyncer E Failed to find sync for id=4
15:08:31.253 21064-21064 SurfaceSyncer E Failed to find sync for id=5
15:08:31.253 21064-21064 SurfaceSyncer E Failed to find sync for id=6
15:08:31.626 21064-21473 BufferPoolAccessor2.0 D bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 1774/1780 (recycle/alloc) - 6/1779 (fetch/transfer)
15:08:31.955 21064-21631 TrafficStats D tagSocket(138) with statsTag=0xffffffff, statsUid=-1
15:08:33.566 21064-21479 BufferPoolAccessor2.0 D bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 1766/1771 (recycle/alloc) - 5/1770 (fetch/transfer)
15:08:33.966 21064-21642 TrafficStats D tagSocket(412) with statsTag=0xffffffff, statsUid=-1
15:08:35.974 21064-21646 TrafficStats D tagSocket(103) with statsTag=0xffffffff, statsUid=-1
15:08:36.677 21064-21473 BufferPoolAccessor2.0 D bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 2074/2080 (recycle/alloc) - 6/2079 (fetch/transfer)
15:08:37.982 21064-21651 TrafficStats D tagSocket(224) with statsTag=0xffffffff, statsUid=-1
15:10:48.657 21064-22418 TrafficStats D tagSocket(185) with statsTag=0xffffffff, statsUid=-1
15:10:48.741 21064-21064 bo.mobile.debug W type=1400 audit(0.0:607267): avc: granted { execute } for path="/data/data//code_cache/startup_agents/3c67707e-agent.so" dev="dm-40" ino=170340 scontext=u:r:untrusted_app:s0:c77,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c77,c257,c512,c768 tclass=file app=
15:10:48.775 21064-21468 SurfaceUtils D connecting to surface 0xb4000076f5ddfff0, reason connectToSurface
15:10:48.775 21064-21468 MediaCodec I [c2.qti.avc.decoder] setting surface generation to 21569538
15:10:48.775 21064-21468 SurfaceUtils D disconnecting from surface 0xb4000076f5ddfff0, reason connectToSurface(reconnect)
15:10:48.775 21064-21468 SurfaceUtils D connecting to surface 0xb4000076f5ddfff0, reason connectToSurface(reconnect)
15:10:48.777 21064-21468 Codec2-Out...ufferQueue D remote graphic buffer migration 17/17
15:10:48.778 21064-21468 Codec2Client D setOutputSurface -- failed to set consumer usage (6/BAD_INDEX)
15:10:48.778 21064-21468 Codec2Client D setOutputSurface -- generation=21569538 consumer usage=0x900
15:10:48.783 21064-21468 Codec2Client D Surface configure completed
15:10:48.783 21064-21468 SurfaceUtils D disconnecting from surface 0xb4000076f5db78c0, reason disconnectFromSurface
15:10:48.791 21064-21064 (DefaultPl...achSurface D Player: action detach
15:10:48.792 21064-21064 (DefaultPl...achSurface D Player: action detach successful
15:10:49.407 21064-21064 Choreographer I Skipped 38 frames! The application may be doing too much work on its main thread.