Keystore: Surface service error message

Surface the service-specific error message. To avoid API changes, the
error message is surfaced in the toString / getMessage methods.

Test: atest android.security.keystore.KeyStoreExceptionTest
Bug: 217593122
Change-Id: Id4090564b46db9b3b10ea390390f6683f7314463
This commit is contained in:
Eran Messeri
2022-02-02 22:50:50 +00:00
parent 9b73fc72a1
commit 5eedf5a373
5 changed files with 81 additions and 18 deletions

View File

@@ -157,6 +157,16 @@ public class KeyStoreException extends Exception {
mErrorCode = errorCode;
}
/**
* @hide
*/
public KeyStoreException(int errorCode, @Nullable String message,
@Nullable String keystoreErrorMessage) {
super(message + " (internal Keystore code: " + errorCode + " message: "
+ keystoreErrorMessage + ")");
mErrorCode = errorCode;
}
/**
* Returns the internal error code. Only for use by the platform.
*