ART Services: Distinguish fatal and non-fatal errors.
Fatal errors should never happen. System server should crash if fatal
errors happen.
Non-fatal errors are error that service-art should handle (e.g., I/O
errors, sub-process crashes). The scope of the error depends on the
function that throws it, so service-art should catch the error at every
call site and take different actions.
Ideally, this should be a checked exception or an additional return
value that forces service-art to handle it, but
`ServiceSpecificException` (a separate runtime exception type) is the
best approximate we have given the limitation of Java and Binder.
This CL distinguishes them by defining fatal errors as
IllegalStateException and non-fatal errors as ServiceSpecificException.
This CL also adds helper functions and macros for throwing those errors
from artd.
Bug: 229268202
Test: atest ArtServiceTests
Ignore-AOSP-First: ART Services.
Change-Id: I9106d28a5af8e78988bdd1db427f191a65c09387
4 files changed