boolean hasKey(String keyUri) throws GeneralSecurityException {
    String keyId = Validators.validateKmsKeyUriAndRemovePrefix(PREFIX, keyUri);
    try {
      synchronized (keystoreLock) {
        return getAndroidKeyStore().containsAlias(keyId);
      }
    } catch (NullPointerException ex1) {
      Log.w(TAG, "Keystore is temporarily unavailable, wait, reinitialize Keystore and try again.");
      sleepRandomAmount();
      synchronized (keystoreLock) {
        return getAndroidKeyStore().containsAlias(keyId);
      }
    }
  }
Returns whether a key exists in Android Keystore.
java_src/src/main/java/com/google/crypto/tink/integration/android/AndroidKeystoreKmsClient.java