acloud: Support acloud reconnect command.

Bug: 118648283
Test: m acloud && atest acloud_test && acloud reconnect
1. remote instance, no ssh tunnel established.
   - tunnel established , adb connect and vnc started.
2. remote instance, ssh tunnel established, no adb connect/vnc started.
   - adb connect and vnc started.
3. remote instance, ssh tunnel established, adb connected but no vnc started.
   - vnc started.
4. remote instance, ssh tunnel established, no connected but vnc started.
   - adb started.
5. local instance, no adb connected/vnc started.
   - adb connect and vnc started.
6. local instance, no adb connected but vnc started.
   - adb connect.
7.local instance, adb connected but no vnc started.
   - vnc started.
Change-Id: I19e3fea1d312666907deeb3e2069cae2458107ea
diff --git a/internal/lib/utils.py b/internal/lib/utils.py
index e17794c..575b6ba 100755
--- a/internal/lib/utils.py
+++ b/internal/lib/utils.py
@@ -62,7 +62,7 @@
 _VNC_BIN = "ssvnc"
 _CMD_PGREP = "pgrep"
 _CMD_SG = "sg "
-_CMD_START_VNC = "%(bin)s vnc://127.0.01:%(port)d"
+_CMD_START_VNC = "%(bin)s vnc://127.0.0.1:%(port)d"
 _CMD_INSTALL_SSVNC = "sudo apt-get --assume-yes install ssvnc"
 _ENV_DISPLAY = "DISPLAY"
 _SSVNC_ENV_VARS = {"SSVNC_NO_ENC_WARN": "1", "SSVNC_SCALE": "auto"}
@@ -854,13 +854,13 @@
         avd_spec: AVDSpec object that tells us what we're going to create.
     """
     for device in report.data.get("devices", []):
-        _LaunchVncClient(device.get(constants.VNC_PORT),
-                         avd_width=avd_spec.hw_property["x_res"],
-                         avd_height=avd_spec.hw_property["y_res"])
+        LaunchVncClient(device.get(constants.VNC_PORT),
+                        avd_width=avd_spec.hw_property["x_res"],
+                        avd_height=avd_spec.hw_property["y_res"])
 
 
-def _LaunchVncClient(port=constants.DEFAULT_VNC_PORT, avd_width=None,
-                     avd_height=None):
+def LaunchVncClient(port=constants.DEFAULT_VNC_PORT, avd_width=None,
+                    avd_height=None):
     """Launch ssvnc.
 
     Args:
@@ -980,7 +980,7 @@
     """
     try:
         with open(os.devnull, "w") as dev_null:
-            subprocess.check_call([_CMD_PGREP, command],
+            subprocess.check_call([_CMD_PGREP, "-f", command],
                                   stderr=dev_null, stdout=dev_null)
         return True
     except subprocess.CalledProcessError: