liblog: add a timeout for logd command socket operations

Add a 2s timeout for logd command socket operations:
  android_logger_clear
  android_logger_get_log_readable_size
  android_logger_get_log_size
  android_logger_set_log_size
  android_logger_get_statistics
  android_logger_get_prune_list
  android_logger_set_prune_list

That correspond to:
  logcat -c
  logcat -g
  logcat -G
  logcat -S
  logcat -p
  logcat -P

These operations should return immediately in typical circumstances,
but if logd is stuck, they would otherwise block indefinitely.  This
allows the commands to gracefully timeout instead.

Test: kill -s STOP `pidof logd`; logcat -g (and other options)
      times out appropriately
Test: logcat -g (and other options) work successfully otherwise
Change-Id: I6c4671a9b3daa4a454c0a14ae7d0b7d3b08be77a
1 file changed