Close MQDescriptor internal FDs while writing to Parcel to transfer to native code.
Though ParcelFileDescriptors do close the wrapped fds in finalize(), GC
may not run for a while so it is beneficial to close them explicitly.
Also recycle the temporary Parcel written into by MQDescriptor since
that dups the MQDescriptor's fds as well. They're not needed after the
native FMQ Reader has been created since the MQDescriptor in the native
code dups those descriptors upon creation from the AParcel as well.
Bug: 383702975
Flag: EXEMPT; bugfix
Test: Run test app with StrictMode on, no longer get android.os.strictmode.LeakedClosableViolation
for ParceFileDescriptor
Change-Id: Ic2a49577f1e0da13dbc33ef14a2a437966aebc99
Signed-off-by:
Jayant Chowdhary <jchowdhary@google.com>
Loading
Please register or sign in to comment