@RequiresApi(Build.VERSION_CODES.M)
  static boolean generateKeyIfNotExist(String keyUri) throws GeneralSecurityException {
    AndroidKeystoreKmsClient client = new AndroidKeystoreKmsClient();
    synchronized (keystoreLock) {
      if (!client.hasKey(keyUri)) {
        generateNewAesGcmKeyWithoutExistenceCheck(keyUri);
        return true;
      }
      return false;
    }
  }
Checks if the key exists, and generates a new one if it does not yet exist.

<p>Returns true if a new key was generated.
java_src/src/main/java/com/google/crypto/tink/integration/android/AndroidKeystoreKmsClient.java