Port OpenJDK 8 changes to CipherInputStream

List of changes:
 - Throwing back IllegalBlockException, BadPaddingException and
 IllegalStateException caught in getMoreDate().
 - An instance variable has been introduced to keep a note of state of the
   stream. If the stream is already closed, close method doesn't perform
   any operations. Also, minor optimization to not to call
   cipher.doFinal() when the end of the input stream has already been
   reached.
 - Minor updates in JavaDocs.

Added test for change in behavior of close method.

Test: libcore.javax.crypto.CipherInputStreamTest
Test: org.apache.harmony.crypto.tests.javax.crypto.CipherInputStreamTest
Test: org.apache.harmony.crypto.tests.javax.crypto.CipherInputStream1Test

Bug: 29631070
Change-Id: I407256a1b9ec2c72a59ce3ba50192496cd86d4bb
2 files changed