Avoid NullPointerException in getHandler()

mAttachInfo may be set to null by other threads while running
getHandler().

This fix assigns mAttachInfo to a local variable. Checking null pointer
and getting a member variable are executed through the local variable.
This local variable is constant. So NullPointerException doesn't occur
even if mAttachInfo is set to null while running getHandler().

Change-Id: I4013dfb7951bd864628868ed58f8c4f5b7cbd1d3
Expose AutoCloseable.

Bug: 3484927
Change-Id: I769c19ffbefb29ce11b828589f3533c24d134242
Expose @SafeVarargs.

Bug: 3484927
Change-Id: I8ac70b6a102ebf87c51c76935bd87a21f6c17506