[speech] implement recognizer proxy

This is a followup to ag/25166321: it turns out the active connection
keeps the SpeechRecognizer object from being GC'd, so implementing a
finalizer there does not work.

This CL adds a proxy object that will actually get GC'd when the client
no longer holds a reference to it. Finalizing this object destroys the
actual SpeechRecognizer.

The public API is untouched.

Test: use a sample app to purposefully leak a bunch of SpeechRecognizer
objects, forcing GC in between. Observe a single session being active at
a time.
Bug: 297249772

Change-Id: I4ff6474dbc27858ad03731916cef5729ba9e6c96
4 files changed