In camera apps, if zoom is digital, how is (auto) focus achieved? In almost all Android devices, zoom is digital -- there just isn't a mechanism for changing the length of the barrel and gathering more info.

So how is focus achieved?

If you're not physically changing the lens properties, or extending the barrel length, you've only got dilation of the aperture as the last focus method. Which is mechanical. Unless you've got a fixed focus system -- which most android phones do not seem to have.

The android-spec for the autoFocus() method isn't much help - although it says it must be supported by the hardware, although most phones seem to have it.

So if it is hardware -- how? I'm not hearing any little motors whirring around in there.... And is there really even any room for a mechanism in these things?

See Also: 


Android.SE: In camera apps, is “zoom” a digital zoom, or an optical zoom?
Understanding camera AutoFocus
Wikipedia:Autofocus
The focus function is achieved by moving the lens back or forth so it is actually a mechanical thing.

You can try it yourself. Download ZXings Barcode Scanner and fire it up. You'll hear a click every time it tries to refocus you can also see the lens moving back and forth.