Android, filament gltf viewer freezes emulator
kelvinwatson opened this issue · comments
Describe the bug
Emulator freezes periodically when running a simple gltf viewer app. Pasted all application code as it is a very small app.
build.gradle
implementation 'com.google.android.filament:filament-android:1.19.0'
implementation 'com.google.android.filament:filament-utils-android:1.19.0'
implementation 'com.google.android.filament:gltfio-android:1.19.0'
class MainActivity : AppCompatActivity() {
companion object {
init {
Utils.init()
}
}
private val frameCallback = object : Choreographer.FrameCallback {
override fun doFrame(currentTime: Long) {
choreographer.postFrameCallback(this)
modelViewer.render(currentTime)
}
}
private lateinit var surfaceView: SurfaceView
private lateinit var choreographer: Choreographer
private lateinit var modelViewer: ModelViewer
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
surfaceView = SurfaceView(this).apply {
setContentView(this)
}
choreographer = Choreographer.getInstance()
modelViewer = ModelViewer(surfaceView)
surfaceView.setOnTouchListener(modelViewer)
loadGlb("DamagedHelmet")
modelViewer.scene.skybox = Skybox.Builder().build(modelViewer.engine)
// make background white
val white = Color.WHITE
val alpha = Color.alpha(white).toFloat()
val red = Color.red(white).toFloat()
val green = Color.green(white).toFloat()
val blue = Color.blue(white).toFloat()
modelViewer.scene.skybox =
Skybox.Builder().color(red, green, blue, alpha).build(modelViewer.engine)
}
override fun onResume() {
super.onResume()
choreographer.postFrameCallback(frameCallback)
}
override fun onPause() {
super.onPause()
choreographer.removeFrameCallback(frameCallback)
}
override fun onDestroy() {
super.onDestroy()
choreographer.removeFrameCallback(frameCallback)
}
private fun loadGlb(name: String) {
val buffer = readAsset("models/${name}.glb")
modelViewer.loadModelGlb(buffer)
modelViewer.transformToUnitCube()
}
private fun loadEnvironment(ibl: String) {
// Create the indirect light source and add it to the scene.
val buffer = readAsset("envs/$ibl/${ibl}_ibl.ktx")
KTXLoader.createIndirectLight(modelViewer.engine, buffer).apply {
intensity = 50_000f
modelViewer.scene.indirectLight = this
}
}
private fun readAsset(assetName: String): ByteBuffer {
val input = assets.open(assetName)
val bytes = ByteArray(input.available())
input.read(bytes)
return ByteBuffer.wrap(bytes)
}
}
To Reproduce
Steps to reproduce the behavior:
- Run the app with the code above on an emulator
- Observe that the emulator freezes. Observe that this does not occur on a physical device.
Expected behavior
Emulator should not freeze when running a simple Filament app.
Screenshots
Logs
Emulator logs:
[ 9605.975696] binder: undelivered transaction 1341760
[ 9605.988210] binder: undelivered transaction 1341905
[ 9605.990193] binder: undelivered transaction 1341779
[ 9605.996223] binder: undelivered transaction 1341759
[ 9605.998655] binder: undelivered transaction 1341761
[ 9606.000879] binder: undelivered transaction 1341762
[ 9606.003947] binder: undelivered transaction 1341904
[ 9611.087601] healthd: battery l=100 v=0 t=0.0 h=2 st=2 chg=a
[ 9612.060093] audit: audit_lost=17473 audit_rate_limit=20 audit_backlog_limit=64
[ 9612.060114] type=1400 audit(1645648801.505:18355): avc: denied { getattr } for pid=10149 comm="ps" path="/proc/1" dev="proc" ino=128 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:init:s0 tclass=dir permissive=0
[ 9612.060445] type=1400 audit(1645648801.505:18356): avc: denied { search } for pid=10149 comm="ps" name="1" dev="proc" ino=128 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:init:s0 tclass=dir permissive=0
[ 9612.060493] type=1400 audit(1645648801.505:18357): avc: denied { search } for pid=10149 comm="ps" name="1" dev="proc" ino=128 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:init:s0 tclass=dir permissive=0
[ 9612.060618] type=1400 audit(1645648801.505:18358): avc: denied { getattr } for pid=10149 comm="ps" path="/proc/2" dev="proc" ino=7786 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.060689] type=1400 audit(1645648801.505:18359): avc: denied { search } for pid=10149 comm="ps" name="2" dev="proc" ino=7786 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.060721] type=1400 audit(1645648801.505:18360): avc: denied { search } for pid=10149 comm="ps" name="2" dev="proc" ino=7786 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.060752] type=1400 audit(1645648801.505:18361): avc: denied { getattr } for pid=10149 comm="ps" path="/proc/3" dev="proc" ino=7787 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.061253] type=1400 audit(1645648801.505:18362): avc: denied { search } for pid=10149 comm="ps" name="3" dev="proc" ino=7787 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.061359] type=1400 audit(1645648801.505:18363): avc: denied { search } for pid=10149 comm="ps" name="3" dev="proc" ino=7787 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.061631] type=1400 audit(1645648801.505:18364): avc: denied { getattr } for pid=10149 comm="ps" path="/proc/5" dev="proc" ino=7789 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.061685] type=1400 audit(1645648801.505:18365): avc: denied { search } for pid=10149 comm="ps" name="5" dev="proc" ino=7789 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.061837] type=1400 audit(1645648801.505:18366): avc: denied { search } for pid=10149 comm="ps" name="5" dev="proc" ino=7789 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.061893] type=1400 audit(1645648801.505:18367): avc: denied { getattr } for pid=10149 comm="ps" path="/proc/7" dev="proc" ino=7791 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.062137] type=1400 audit(1645648801.505:18368): avc: denied { search } for pid=10149 comm="ps" name="7" dev="proc" ino=7791 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.062386] type=1400 audit(1645648801.505:18369): avc: denied { search } for pid=10149 comm="ps" name="7" dev="proc" ino=7791 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.062584] type=1400 audit(1645648801.505:18370): avc: denied { getattr } for pid=10149 comm="ps" path="/proc/8" dev="proc" ino=7792 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.063089] type=1400 audit(1645648801.505:18371): avc: denied { search } for pid=10149 comm="ps" name="8" dev="proc" ino=7792 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.063123] type=1400 audit(1645648801.505:18372): avc: denied { search } for pid=10149 comm="ps" name="8" dev="proc" ino=7792 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.064956] type=1400 audit(1645648801.505:18373): avc: denied { getattr } for pid=10149 comm="ps" path="/proc/9" dev="proc" ino=7793 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.065108] type=1400 audit(1645648801.505:18374): avc: denied { search } for pid=10149 comm="ps" name="9" dev="proc" ino=7793 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
[ 9612.138682] audit: rate limit exceeded
Desktop (please complete the following information):
- OS: Mac OS Catalina 10.15.7
- GPU: AMD Radeon Pro 5500M, Intel UHD Graphics 630
- Backend: [OpenGL/Vulkan]
Smartphone (please complete the following information):
- Device: Nexus 5 Emulator
- OS: API 24 Emulator
Additional context
Add any other context about the problem here.
Is the emulator frozen or the app? If the former, that sounds like an emulator bug. I've never seen this issue myself even though I regularly work in the emulator.
@romainguy It's definitely the emulator. The 3 soft nav buttons become unresponsive to taps. The controls on the panel beside of the emulator also become unresponsive.
This should be reported against the emulator at b.android.com then, sorry :/