Flush BC_FREE_BUFFER and ref ops from non-looper threads.
BC_FREE_BUFFER and ref commands are normally just queued, and not automatically flushed out to the kernel driver. This usually works fine, because BC_FREE_BUFFER is typically called from a binder thread (which flushes when calling back into the kernel), or a thread making regular binder transactions itself. But it can happen that a Parcel is destructed from a thread that meets neither of those requirements; especially Parcels created from Java are sensitive to this, because if they aren't immediately recycled, they will instead be garbage collected, and in that case the BC_FREE_BUFFER will be queued to the FinalizerDaemon thread, which otherwise never makes or receives any binder calls. To prevent these commands from getting stuck, flush BC_FREE_BUFFER and refcount operations automatically from such threads. Bug: 68604253 Bug: 139697085 Test: boots, binderLibTest Change-Id: I98109a7046c122db22af0b15a268629284f06663
Loading
Please register or sign in to comment