OSDN Git Service

Zygote: Improve logging and error handling during connections.
authorNarayan Kamath <narayan@google.com>
Wed, 5 Jul 2017 13:45:38 +0000 (14:45 +0100)
committerNarayan Kamath <narayan@google.com>
Thu, 6 Jul 2017 11:49:22 +0000 (12:49 +0100)
commitbf99d06003e76469a99269816babe16a22d83b89
tree84a132bb152b20ac2d5230e37e5c2c4ae06b5b42
parentc276c79e83680c4d14e790ba002c14e4a7dacb49
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
core/java/com/android/internal/os/RuntimeInit.java
core/java/com/android/internal/os/WebViewZygoteInit.java
core/java/com/android/internal/os/WrapperInit.java
core/java/com/android/internal/os/Zygote.java
core/java/com/android/internal/os/ZygoteConnection.java
core/java/com/android/internal/os/ZygoteInit.java
core/java/com/android/internal/os/ZygoteServer.java