Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit eed080bd authored by Eric Biggers's avatar Eric Biggers
Browse files

Remove the obsolete field android.security.KeyStore.NO_ERROR

There's no such thing as a NO_ERROR Keystore error code anymore, let
alone one whose numeric value is 1.  The field
android.security.KeyStore.NO_ERROR is a remnant from Keystore1.
NO_ERROR existed in Keystore1 because Keystore1's binder methods used a
binder exception code of 0 ("success") even on failure, so they had to
use the return value to convey a Keystore error code or NO_ERROR.
Keystore2 instead uses binder's support for service-specific errors, and
there is no NO_ERROR error code because the success case is conveyed via
the binder exception code being 0 instead of EX_SERVICE_SPECIFIC.

Therefore, this CL removes the obsolete field
android.security.KeyStore.NO_ERROR and its two users.  These users were:

- AndroidKeyStoreCipherSpiBase checked for NO_ERROR "errors" from
  createOperation().  But this case is unreachable, and the operation
  cannot continue without the CreateOperationResponse anyway.  So this
  obsolete code can just be removed.

- AuthenticationClient checked the return value of
  KeyStore#addAuthToken() against NO_ERROR.  But this method actually
  just wraps Authorization#addAuthToken() which returns 0 on success, as
  per its javadoc.  So this was a bug, though it didn't matter much
  since it just caused a misleading log message.  Check for 0 instead.

Finally, NO_ERROR did have @UnsupportedAppUsage.  But since there's no
use case for it, removing it is allowed by the non-SDK interface policy.

Bug: 326508120
Test: atest CtsKeystoreTestCases
Change-Id: I735e005d7ca39e231667dd95da533519085ba4ef
parent ed2534a1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment