Part 1 of terminal support fix

Changed the daemon to use pseudo-terminals closer to the way SSH or telnet does. Changes are extensive because the slave device was being opened by the wrong end of the connection, ie. the client is the one which should be opening the master ptmx device.

SIGWINCH is still not being handled. The next commit will attempt to address this.
Added SIGWINCH handling and better cleanup

Added a task to forward SIGWINCH from the client to the daemon via the
correct ioctl. Terminal window sizing now seems to work correctly.

Also added signal handler to catch signals which can cause the client to
terminate, allowing the client to restore stdin's termios. Previously,
killing the su client using (for example) SIGTERM would result in the
terminal being left in an unusable state.
Refactored pseudo-terminal code into pts.c
Undo a change which resulted in dangling FDs
Removed a hackish check for stdout in pump()
Made scoket protocol uniform

Also eliminated some control flow branches
Changed when the client sends pts-slave
Treat each standard I/O stream separately
Eliminated use of FIFOs, factored PTY proxy code

Instead of opening FIFOs, we now send the standard I/O descriptors
across the Unix socket.

Also, the I/O pumps were moved to pts.c
Fix typos.

Change-Id: I9b2658336ac4d66df7cf745b8d58d8d49813ec16
Improve logging code.

- Write to log buffer ourselves instead of calling log, so the printed
  pid is correct
- Reduce debug spam

Change-Id: I9afe7249fc589268ea61419a7cfc724897981e9e
Add workaround for Samsung set*id restrictions (bug #196)
Don't use "am --user" unless multiuser mode is enabled (bug #204)
Update activity.c

another am invocation with unconditional --user (the last one on line 185 needs no condition as it is only called in multiuser mode)
Merge pull request #208 from h1618/patch-1

Update activity.c
assign user before use

sorry, jumped too short on my last commit: the user array has to be initialized before first use ...
Merge pull request #211 from h1618/patch-1

assign user before use
Merge remote-tracking branch 'github/cm-10.2' into cm-11.0

Conflicts:
	Superuser/jni/su/daemon.c

Change-Id: Ia849b63cf44d8da9e31b1fbe13b54b0b8289e75d
Merge remote-tracking branch 'koush/master' into cm-11.0
Merge remote-tracking branch 'cern/multiuser-regression-v1' into cm-11.0

Conflicts:
	Superuser/jni/su/su.c

Change-Id: I2474f5048e590592e1baa7f4bb1caf76e1245b74