Zygote: Improve logging and error handling during connections.
Before this change, we were throwing a checked exception on success
and returning on failure. This made it hard to figure out where / when
something was going wrong. This change switches things around to throw
a RuntimeException when something goes wrong and to return a Runnable
on success. This lets us make stronger assertions in both the parent
and the child process about their state and expected return values.
This change also upgrades the severity of several errors that we would
earlier just ignore. We will now reject the command and terminate the
connection to the client when we encounter these errors such as:
- Malformed arguments
- Any ZygoteSecurityException, such as thown thrown by
applyUidSecurityPolicy and applyInvokeWithSecurityPolicy.
- Any error in setting up pipes etc. to facilitate communication
with child processes.
Bug:
13618569
Test: Manual
Change-Id: Id931d44135ae2e4ede1bbac6a4b187f6c139e1fd