Fix race in finalizeAllEnqueued.

The problem was as follows:
The GC finishes and enqueues all cleared references on the
ReferenceQueue.unenqueued list. Then someone calls
finalizeAllEnqueued which enqueues a finalizer reference directly on
the finalizer reference queue. However the recently cleared references
had not yet been processed by the ReferenceQueueDaemon resulting
in the sentinal being finalized before the objects which were freed
in the GC.

The fix is enqueuing the sentinel finalizer reference on the unenqueued
queue.

Bug: 17371542
Bug: 17381967

Change-Id: I0455c665558397b70a88a97c59fe50090fa57401
1 file changed