diff options
author | Janis Danisevskis <jdanis@google.com> | 2021-03-04 15:48:12 -0800 |
---|---|---|
committer | Janis Danisevskis <jdanis@google.com> | 2021-03-04 15:48:12 -0800 |
commit | 051d7668f7aec8e9c429d592dfbe1f713f2fd10e (patch) | |
tree | 9094e244285e0879e40955830d9f2a91a51c56b7 /keystore | |
parent | 78a488cd10a99aa7d2a3323ad9a0e36eee7337a5 (diff) |
Keystore 2.0: Silence common error on operation abort.
Test: N/A
Change-Id: I7c85ae881165bc77d836624bfe20251b971d4479
Diffstat (limited to 'keystore')
-rw-r--r-- | keystore/java/android/security/keystore2/KeyStoreCryptoOperationUtils.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/keystore/java/android/security/keystore2/KeyStoreCryptoOperationUtils.java b/keystore/java/android/security/keystore2/KeyStoreCryptoOperationUtils.java index 992454285738..0006b92b1b9b 100644 --- a/keystore/java/android/security/keystore2/KeyStoreCryptoOperationUtils.java +++ b/keystore/java/android/security/keystore2/KeyStoreCryptoOperationUtils.java @@ -18,6 +18,7 @@ package android.security.keystore2; import android.app.ActivityThread; import android.hardware.biometrics.BiometricManager; +import android.hardware.security.keymint.ErrorCode; import android.security.GateKeeper; import android.security.KeyStore; import android.security.KeyStoreException; @@ -183,15 +184,19 @@ abstract class KeyStoreCryptoOperationUtils { try { operation.abort(); } catch (KeyStoreException e) { - // We log this error, but we can afford to ignore it. Dropping the reference - // to the KeyStoreOperation is enough to clean up all related resources even - // in the Keystore daemon. We log it anyway, because it may indicate some - // underlying problem that is worth debugging. - Log.w( - "KeyStoreCryptoOperationUtils", - "Encountered error trying to abort a keystore operation.", - e - ); + // Invalid operation handle is very common at this point. It occurs every time + // an already finalized operation gets aborted. + if (e.getErrorCode() != ErrorCode.INVALID_OPERATION_HANDLE) { + // This error gets logged but ignored. Dropping the reference + // to the KeyStoreOperation is enough to clean up all related resources even + // in the Keystore daemon. It gets logged anyway, because it may indicate some + // underlying problem that is worth debugging. + Log.w( + "KeyStoreCryptoOperationUtils", + "Encountered error trying to abort a keystore operation.", + e + ); + } } } } |