Clear binder references and flush operations when destroying NativeInputWindowHandle

NativeInputWindowHandle is the native object associated with InputWindowHandle. The object is lazily
initialized and destroyed when the java object is finalized, running in the finalizer thread. The
native object stores a weak reference to the layer handle and if the layer handle is destroyed before
the reference can be cleaned up, we end up leaking the reference. This is because the ref count
operations do not seem to be flushed. Fix this by explicitly flushing the commands.

Bug: 139375469
Test: Run app launch scripts from bug. Check for startup time regressions and node count increases
between launches

Change-Id: I837f7cd23f94bbcf59910664aec242fcf9c43986
1 file changed