Ok, I have had this problem too and after scouring the net and not finding an answer, I decided I would have to fix this on my own. I will explain the facts as I see them so that you can understand my conclusion (and yes, it worked for me)
- Different camera apps all have same issue - so the issue must be either OS or hardware related
- Many ppl claim it started after update to denim, but even more ppl say it happened randomly - So its likely just a coincidence and has nothing to do with updating to Denim; less than 1% of people who updated to denim reported the problem
- Most ppl who got their phone replaced no longer had the problem - so this tells me it has something to do with hardware
But what?? What could possibly have changed in the hardware? Did we all drop our phone? Then I thought harder about the problem: It appears to focus for a second then it gets distracted and focuses on something else. Led me to ask: How does the system know the correct point to focus? Well it goes through all the focus settings and the software then uses algorithms to figure out which one represents optimal focus in the part of the screen that you tap.
I also observed that this issue happens more often if I tap in certain parts of the screen to focus than other.
So with high confidence, I assumed that somehow some calibration issue or other hardware issue was causing this to happen.
But what could have changed?
Then it hit me. What if the camera decided that focusing on something really close was the correct place to focus? Why would it think that? Because of dust or another particle on the lens. So I tried cleaning the lens thoroughly. It seemed to help but still had the issue. What about dust inside the lens? Cleaned this and the problem was resolved.
How do you clean the dust inside the lens? Well, thats the real trick. I had certain tools that allowed it, but for most people, you might have to take it to an expert.
I hope this helps some of you. Try it. At least try to clean the outside thoroughly. A fingerprint on the lens could cause this issue. The camera will attempt to focus on the fingerprint.