CHERRY-PICK: Remove wait for session manager messages

This change removes the explicit wait for login messages
from session manager.  That code causes problems in
factory test environments.

BUG=chrome-os-partner:36304
TEST=test factory test on panther_freon

Original-Change-Id: I4239222d3dab3bf5b3a1089241e53a540d50f204
Reviewed-on: https://chromium-review.googlesource.com/248120
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: David Sodman <dsodman@chromium.org>
Tested-by: David Sodman <dsodman@chromium.org>
Commit-Queue: David Sodman <dsodman@chromium.org>
Trybot-Ready: David Sodman <dsodman@chromium.org>
(cherry picked from commit f348b0d33f96e2d86b4c6ee5654bb00a280f803e)

Change-Id: I522517f26e8dde4fa04c3b35e84906da3d0ed208
Reviewed-on: https://chromium-review.googlesource.com/249663
Commit-Queue: Bowgo Tsai <bowgotsai@chromium.org>
Tested-by: Bowgo Tsai <bowgotsai@chromium.org>
Reviewed-by: David Sodman <dsodman@chromium.org>
diff --git a/splash.c b/splash.c
index dd4c131..2825cf1 100644
--- a/splash.c
+++ b/splash.c
@@ -22,7 +22,7 @@
 
 #define  MAX_SPLASH_IMAGES      (30)
 #define  FILENAME_LENGTH        (100)
-#define  MAX_SPLASH_WAITTIME    (5000)
+#define  MAX_SPLASH_WAITTIME    (5)
 
 typedef union {
 	uint32_t  *as_pixels;
@@ -234,18 +234,6 @@
 	return 0;
 }
 
-static void
-frecon_dbus_path_message_func(dbus_t* dbus, void* user_data)
-{
-	splash_t* splash = (splash_t*)user_data;
-
-	if (!splash->devmode)
-		exit(EXIT_SUCCESS);
-
-	dbus_stop_wait(dbus);
-	video_close(splash->video);
-}
-
 static void splash_clear_screen(splash_t *splash, uint32_t *video_buffer)
 {
 	int i,j;
@@ -272,14 +260,12 @@
 	int i;
 	uint32_t* video_buffer;
 	int status;
-	bool db_status;
 	int64_t last_show_ms;
 	int64_t now_ms;
 	int64_t sleep_ms;
 	struct timespec sleep_spec;
 	int fd;
 	int num_written;
-	int wfm_status;
 
 	status = 0;
 
@@ -318,12 +304,6 @@
 		}
 		video_unlock(splash->video);
 
-		/*
-		 * Next wait until chrome has drawn on top of the splash.  In dev mode,
-		 * dbus_wait_for_messages will return when chrome is visible.  In
-		 * verified mode, the frecon app will exit before dbus_wait_for_messages
-		 * returns
-		 */
 		do {
 			*dbus = dbus_init();
 			usleep(50000);
@@ -331,23 +311,6 @@
 
 		splash_set_dbus(splash, *dbus);
 
-		db_status = dbus_signal_match_handler(*dbus,
-				kLoginPromptVisibleSignal,
-				kSessionManagerServicePath,
-				kSessionManagerInterface,
-				kLoginPromptVisiibleRule,
-				frecon_dbus_path_message_func, splash);
-
-		if (db_status) {
-			wfm_status = dbus_wait_for_messages(*dbus, MAX_SPLASH_WAITTIME);
-			switch (wfm_status) {
-				case DBUS_STATUS_TIMEOUT:
-					LOG(WARNING, "timed out waiting for messages\n");
-					break;
-			}
-		}
-
-
 		if (splash->devmode) {
 			/*
 			 * Now set drm_master_relax so that we can transfer drm_master between
@@ -378,6 +341,12 @@
 		kLibCrosServicePath,
 		kLibCrosServiceInterface,
 		kTakeDisplayOwnership);
+
+	/*
+	 * Finally, wait until chrome has drawn on top of the splash.  In dev mode,
+	 * wait a few seconds for chrome to show up.
+	 */
+	sleep(MAX_SPLASH_WAITTIME);
 	return status;
 }