Stop illegal FD from causing SensorService crash

If an illegal FD is passed into the SensorService code that sets up
direct connections, it doesn't do any verification before using some
ashmem helpers which will crash the service if an illegal fd is passed
in. Verify any FD is valid before this step to avoid the crash.

Bug: 143896234
Test: Ran newly added code to sensorservicetest and verified system
server crash doesn't occur

Change-Id: If44481de8c7fce5e01c8e1c9d90f01241d1f1cc5
2 files changed