Hold reference to and close both ends of PFD

Speculative fix for bug attached to this CL. Crash is occurring as a
result of a file descriptor attempting to be closed while in use. Crash
seems to be due to a ParcelFileDescriptor in statsd codebase.
ParcelFileDescriptor in StatsCompanionService may be garbage collected
before a reference of it is grabbed. Initiating ParcelFileDescriptor as
an instance variable in the StatsCompanionService class and closing both
ends of the pipe after writing proto data.

Bug: 267350818
Test: statsd_test
Test: CtsStatsdHostTestCases
Change-Id: I412eba330dd98f755ef5e9388c2a40693b36809a
1 file changed