Do not try to fully answer this question here, just trying to give it some direction.
So, you need driver support for this kind of operation. Then at some point you ask the driver from your application to set the required focus distance.
Another question: "If someone really needs such functionality?".
Android Documentation:
public static final String FOCUS_MODE_FIXED
Focus is fixed. The camera is always in this mode if the focus is not adjustable. If the camera has autofocus, this mode can lock the focus, which is usually at hyperfocal distance . Applications should not call autoFocus (AutoFocusCallback) in this mode.
Let's see what hyperfocal distance is.
Hyperfocal distance
From Wikipedia, the free encyclopedia
In optics and photography, hyperfocal distance is the distance beyond which all objects can be brought into “acceptable” focus. There are two commonly used definitions of hyperfocal distance, leading to values that differ slightly:
Definition 1: Hyperfocal distance is the closest distance that the lens can be focused, keeping objects at infinity reasonably sharp. When the lens is focused at this distance, all objects at distances from half the hyperfocal distance to infinity will be sharp enough.
Definition 2: hyperfocal distance is the distance beyond which all objects are reasonably sharp, for a lens focused at infinity.
The distinction between the two values is rarely made, since they have almost the same values. The value calculated in accordance with the first definition exceeds the value indicated by the second with just one focal length.
Since hyperfocal distance is the focusing distance giving the maximum depth of field, this is the most desirable distance for setting the focus of a camera with a fixed focus.
Thus, the focus is not set at the most remote setting, but is configured to ensure that all visible objects are sharp enough.
Back to the question.
If you are a developer of this specific camera firmware, you can add all the necessary IOCTLs to it. But then you still have to call them. This cannot be achieved without adding additional features to the Android OS and further recompiling Android itself and the Linux kernel.
It seems you cannot achieve this goal, and not from user space, at least.