You should try to estimate the time taken to write the file, i.e. call System.currentTimeMillis() right before and immediately after calling cipher.doFinal() .
Thus, an Android phone usually uses a recent ARM processor with a clock frequency of 500 MHz or more, and such a beast is theoretically capable of encrypting AES or AES-decrypting several megabytes of data per second.
However, the Android code uses an almost Java virtual machine called Dalvik . Prior to Android 2.2, this is an interpreter (not a JIT compiler), which means that it is rather slow for tasks with intensive computation. If the mediocre performance you observe really comes from the AES operation itself (and not the file write), then the plausible answer is that your virtual machine provides an AES implementation written in Java and interpreted using Dalvik. In this case, there are few cures, besides the hope of having a better implementation of the virtual machine (VM can use the built-in code implementation for AES, and also with Android 2.2 and later versions, Dalvik has a JIT compiler that should improve code execution performance).
Thomas pornin
source share