Finalize BulkCursorNative asynchronously

BulkNativeCursor should be closed explicitly but when it is not, it is
closed by the finalizer.  If the remote process is busy, this can
trigger a TimeoutException from the FinalizerWatchdogDaemon.  The
solution is to make the remote call asynchronous, if the current
thread is the finalizer.

This is a best-effort mitigation, for clients that fail to explicitly
close BulkNativeCursor instances.

Tested with an instrumented build that leaked a BulkNativeCursor and
waited for the finalizer to clean up the instance.  Verified that the
remote call was one-way.

Flag: android.database.sqlite.oneway_finalizer_close
Bug: 368221351
Test: atest
 * FrameworksCoreTests:android.database
 * CtsDatabaseTestCases
Change-Id: I39b1a4b4465b4b9d66c73c80db0455b1352c7862
2 files changed