system_server : trigger runtime restart when we're close to the soft FD limit.

We arbitrarily define a high water mark as 12 below the max limit (1024)
and dump the list of open descriptors and restart the system_server when we
reach that mark.

The list of file descriptors is dumped to a file with prefix /data/anr/anr_fd_xxxxx.
This might be construed as a hack, but it allows us to take advantage of
existing code in dumpstate that will capture this file and add it to any
bugreport that's collected after.

Test: Manual
Bug: 63004717
Change-Id: I4052625574a3ab2df9ddf591f281a412e7b4b511
1 file changed