code: public final void init(Key key, SecureRandom random)
              throws InvalidKeyException {
          if (spi != null && (key == null || lock == null)) {
              spi.engineInit(key, random);
          } else {
              try {
                  chooseProvider(I_NO_PARAMS, key, null, random);
              } catch (InvalidAlgorithmParameterException e) {
                  // should never occur
                  throw new InvalidKeyException(e);
              }
          }
  
          /* Android-removed: this debugging mechanism is not used in Android.
          if (!skipDebug && pdebug != null) {
              pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
                  this.provider.getName());
          }
          */
      }
docs: Initializes this key agreement with the given key and source of
  randomness. The given key is required to contain all the algorithm
  parameters required for this key agreement.
  
  <p> If the key agreement algorithm requires random bytes, it gets them
  from the given source of randomness, <code>random</code>.
  However, if the underlying
  algorithm implementation does not require any random bytes,
  <code>random</code> is ignored.
  
  @param key the party's private information. For example, in the case
  of the Diffie-Hellman key agreement, this would be the party's own
  Diffie-Hellman private key.
  @param random the source of randomness
  
  @exception InvalidKeyException if the given key is
  inappropriate for this key agreement, e.g., is of the wrong type or
  has an incompatible algorithm type.