For one mobile phone, if \$f\$ is changed, \$s\$ varies immediately
\$f\$ doesn't change unless you switch the lens, which implies a different phone or a different camera on the same phone.
Focal length is a property of the lens, it doesn't depend on the focus distance1. So in your formulas, everything except \$s\$ is a constant. The formula assumes that the lens is focused at distance \$s\$, but it makes no difference whether you use autofocus or not.
If you have a zoom lens then you zoom first, this gives the focal length, and the focal length won't change until next time you zoom.
If we use the wide angle camera of the iPhone 7 (4mm f/1.8) as an example, focused at an object 20 cm away:
- \$s\$ = 0.2 m
- \$f\$ = 0.004 m
- \$N\$ = 1.8
- \$c\$ = 4e-6 m (6 mm sensor diagonal divided by 1500 = 4 µm)
The circle of confusion has several formulations. Which one you use depend on how you expect to use the picture as well as how critical you are. I've used sensor_diagonal/1500
here, adjust to taste2.
The calculation for 20 cm focus distance then becomes:
$$\begin{align}
D_\text{near} &= \frac{sf^2}{f^2 + Nc(s-f)} \\
&= \frac{0.2 \times (0.004)^2}{(0.004)^2 + 1.8\times 4\times10^{-6}\times(0.2-0.004)} \\
&= 0.18\,\text{m} = 18\,\text{cm} \\
D_\text{far} &= \frac{sf^2}{f^2 - Nc(s-f)} \\
&= \frac{0.2 \times (0.004)^2}{(0.004)^2 - 1.8\times 4\times10^{-6}\times(0.2-0.004)} \\
&= 0.22\,\text{m} = 22\,\text{cm} \\
\end{align}$$
So at 0.2 m focus distancee, the DoF goes from 0.18 m (near) to 0.22 m (far).
While at 2 m focus distance, the DoF goes from 1 m (near) to 20 m (far).
Note that at normal distances (not macrophotography), when the distance to the subject is a lot more than the focal length of the lens, then \$s - f\$ is approximately the same as \$s\$, so you can simplify the formula a bit to:
$$\begin{align}
D_\text{near} &\approx \frac{sf^2}{f^2+Ncs} \\
D_\text{far} &\approx \frac{sf^2}{f^2-Ncs}
\end{align}$$
Footnotes:
1) Except for focus breathing, were the focal length does vary with the focus distance. But we tend to ignore this for DoF calculations; partly because the effect is small, partly because it's different for every lens and the numbers are rarely available unless you measure it yourself.
2) The image is in perfect focus only at one specific distance. The CoC specifies your tolerance for out-of-focus blurriness, so you can consider it a fudge factor of sorts. Blurriness that's invisible when you shrink say a 12 Mpx picture to fit a 2 Mpx screen may be visible if you show the picture at 100% to look at individual pixels.