Chinese researchers have built a compact gravity sensor that measures tiny mass changes, with the potential to detect submarines at sea.