Clean up exception usage in LockSettingsService (part 1)

RemoteException are thrown when someone invokes a binder call
but the binder calls fails due to technical reasons (the remote
process died; data sent through binder is too big etc). Right now
in LockSettingsService most RemoteExceptions are just blindly
bubbled up through the call chain. This has the issue that it
will be silently ignored if this is part of some app calling into
LSS via binder, because RemoteException cannot be propagated
across binder at the moment. To fix this, we look at each place
within LSS where RemoteException is thrown and take the following
action:

* If the RemoteException is not critical, just swallow it in place
  and emit a log.
* If it's critical (LSS cannot carry on with the failed invocation):
  ** Rethrow as IllegalStateException (which is binder-compatible)
     so it fails fast.
  ** Unless the surronding method has appropriate error return semantics
     which can be adopted instead. In this case, swallow the exception,
     return error code, and emit log.

Bug: 128831839
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/locksettings

Change-Id: I4e19b8e63a86e5477933bf21c718771e9018e718
3 files changed