You can modify this equation to determine the effect of air's density, but it will be pretty small because the density of air is at best about a 1000th of the density of water.
I have the second expression in two slightly different forms, one using masses (Mw is the mass of the water below the submarine, while Mr is the mass of the solid Earth, G is the universal gravitational constant) and one using densities. In both cases, I've assumed that d, the depth of water below the submarine is much less the radius of the Earth, so that higher powers of d can be eliminated when convenient for simplification. You can modify this expression to determine the effect of air's density on doubling period, but it will be pretty small because the density of air is at best about a 1000th of the density of water.
Note that in the last expression, if the density of the "rock" is much less than the density of the material the vehicle is moving in ("water" or "air") then the second expression becomes oscillatory, not exponential - stability in the vertical domain. So a navigation system on a planet that was a light but strong hollow sphere surrounded by water, or air, would have a stable in the vertical feedback loop (this is one way to know that the Earth isn't hollow).
(I had an embarrassing typo in the last expression on this slide, but I've corrected it here. Dimensional analysis is important!)