scripts: Always restart ash on deploying lacros by default

This CL lets Ash restart on deploying lacros by default.

lacros-only mode requires ash to restart, otherwise rsync fails with
ETXTBSY error.
Since we are deprecating lacros side-by-side and lacros primary and
moving on to lacros-only, we should set restart_ui by default.

For users who don't want to restart_ui, added an option
`--skip-restart-ui` which will always skip restarting Ash.

BUG=chromium:1450153
TEST=./run_tests deploy_chrome_unittest.py

Change-Id: I663e179f0d36af8c52de70dbf0ac01cf66fe32d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4574550
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
Commit-Queue: Eriko Kurimoto <elkurin@chromium.org>
Tested-by: Eriko Kurimoto <elkurin@chromium.org>
diff --git a/scripts/deploy_chrome.py b/scripts/deploy_chrome.py
index 09b9f39..e4b181e 100644
--- a/scripts/deploy_chrome.py
+++ b/scripts/deploy_chrome.py
@@ -640,16 +640,20 @@
             self._PrepareStagingDir,
         ]
 
-        restart_ui = True
+        restart_ui = not self.options.skip_restart_ui
         if self.options.lacros:
-            # If this is a lacros build, we only want to restart ash-chrome if
-            # needed.
-            restart_ui = False
             steps.append(self._KillLacrosChrome)
             if self.options.reset_lacros:
                 steps.append(self._ResetLacrosChrome)
+            config_modified = False
             if self.options.modify_config_file:
-                restart_ui = self._ModifyConfigFileIfNeededForLacros()
+                config_modified = self._ModifyConfigFileIfNeededForLacros()
+            if config_modified and not restart_ui:
+                logging.warning(
+                    "Config file modified but skipping restart_ui "
+                    "due to option --skip-restart-ui. Config file "
+                    "update is not reflected."
+                )
 
         if restart_ui:
             steps.append(self._KillAshChromeIfNeeded)
@@ -858,6 +862,14 @@
         help="Reset Lacros by deleting Lacros user data dir if it exists.",
     )
     group.add_argument(
+        "--skip-restart-ui",
+        action="store_true",
+        default=False,
+        help="Skip restarting ash-chrome on deploying lacros-chrome. Note "
+        "that this flag may cause ETXTBSY error on rsync, and also won't "
+        "reflect the /etc/chrome_dev.conf file updates as it won't restart.",
+    )
+    group.add_argument(
         "--skip-enabling-lacros-support",
         action="store_false",
         dest="enable_lacros_support",