Adjust the output message of connecting to OpenWrt device. am: f9b06b09bd

Original change: https://android-review.googlesource.com/c/platform/tools/acloud/+/1899054

Change-Id: Id97d7c1173f96f1a7f4d1cdedc5bcdbaa08d683c
diff --git a/public/actions/remote_instance_openwrt_device_factory.py b/public/actions/remote_instance_openwrt_device_factory.py
index 2f88807..b1c8bcb 100644
--- a/public/actions/remote_instance_openwrt_device_factory.py
+++ b/public/actions/remote_instance_openwrt_device_factory.py
@@ -93,10 +93,13 @@
 
     def CreateDevice(self):
         """Creates the OpenWrt device."""
+        # TODO(189417881): Update job status into report and move the hint
+        # messages into device summary.
         self._InstallPackages()
         self._BuildOpenWrtImage()
         self._LaunchOpenWrt()
         self._BootOpenWrt()
+        self._HintConnectMessage()
 
     @utils.TimeExecute(function_description="Install required packages")
     def _InstallPackages(self):
@@ -146,13 +149,17 @@
             1. Create screen section.
             2. Reset environment to default values.
             3. Set fdt_addr_r environment value.
-            4. Show the hint of connecting OpenWrt device.
         """
         self._OpenScreenSection()
         env_fdt_addr = self._GetFdtAddrEnv()
         self._ssh.Run(_CMD_SCREEN_RESET_ENV)
         self._ssh.Run(_CMD_SCREEN_SET_FDT_AND_BOOT % env_fdt_addr)
+
+    def _HintConnectMessage(self):
+        """Display the ssh and screen commands for users."""
         utils.PrintColorString(
-            "\nPlease run the following commands to control the OpenWrt device:\n"
-            "$%(ssh_cmd)s\n$screen -r\n" %
-            {"ssh_cmd": self._ssh.GetBaseCmd(constants.SSH_BIN)})
+            "Please run the following commands to control the OpenWrt device:\n")
+        utils.PrintColorString(
+            "$ %(ssh_cmd)s\n$ screen -r\n" %
+            {"ssh_cmd": self._ssh.GetBaseCmd(constants.SSH_BIN)},
+            utils.TextColors.OKGREEN)
diff --git a/public/actions/remote_instance_openwrt_device_factory_test.py b/public/actions/remote_instance_openwrt_device_factory_test.py
index c9b609a..187e790 100644
--- a/public/actions/remote_instance_openwrt_device_factory_test.py
+++ b/public/actions/remote_instance_openwrt_device_factory_test.py
@@ -58,6 +58,8 @@
             self.avd_spec, self.instance)
 
     @mock.patch.object(remote_instance_openwrt_device_factory.OpenWrtDeviceFactory,
+                       "_HintConnectMessage")
+    @mock.patch.object(remote_instance_openwrt_device_factory.OpenWrtDeviceFactory,
                        "_InstallPackages")
     @mock.patch.object(remote_instance_openwrt_device_factory.OpenWrtDeviceFactory,
                        "_BuildOpenWrtImage")
@@ -65,13 +67,15 @@
                        "_LaunchOpenWrt")
     @mock.patch.object(remote_instance_openwrt_device_factory.OpenWrtDeviceFactory,
                        "_BootOpenWrt")
-    def testCreateDevice(self, mock_boot, mock_launch, mock_build, mock_install):
+    def testCreateDevice(self, mock_boot, mock_launch, mock_build,
+                         mock_install, mock_hint):
         """Test CreateDevice."""
         self.openwrt_factory.CreateDevice()
         mock_install.assert_called_once()
         mock_build.assert_called_once()
         mock_launch.assert_called_once()
         mock_boot.assert_called_once()
+        mock_hint.assert_called_once()
 
     # pylint: disable=protected-access
     @mock.patch.object(ssh.Ssh, "Run")