Clean up temporary files and avoid saving to SD card if possible.

Backport of 1ab989c to 2.1.X branch.

We don't need to write the image data to the FS if using our
customer overlay activity IF the user does not want it saved
to the photo gallery.