What you're doing is not only legal, it is encouraged. Everything in the Android Open Source Project that sits above the Linux kernel is licenced under the Apache 2.0 Software Licence.
Its exactly what HTC, Sony Ericsson, Samsung and the rest do for their own custom camera apps - build upon and extend (and sometimes ruin) the stock Android implementation.
What you're doing is not only legal, it is encouraged. Everything in the Android Open Source Project that sits above the Linux kernel is licenced under the Apache 2.0 Software Licence.
Its exactly what HTC, Sony Ericsson, Samsung and the rest do for their own custom camera apps - build upon and extend (and sometimes ruin) the stock Android implementation.