A workaround for the Xperia Z1 CM-based roms camera issues, based on code and idea by @drklaw on XDA