Merge 4e9fae1fae237c9b3e85b4b1ec553ffd0367f5ac on remote branch

Change-Id: I1f9b12d6640d4a33978645628f86f295439dde8f
diff --git a/app/aboot/mdtp_ui.c b/app/aboot/mdtp_ui.c
index 1dc2d06..11303f3 100644
--- a/app/aboot/mdtp_ui.c
+++ b/app/aboot/mdtp_ui.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, 2019 The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -658,11 +658,11 @@
 	char* str2 = "\nError - mdtp image is corrupted\n";
 	fbcon_clear();
 	while(*str != 0) {
-		fbcon_putc_factor(*str++, FBCON_COMMON_MSG, big_factor);
+		fbcon_putc_factor(*str++, FBCON_COMMON_MSG, big_factor, 0);
 	}
 	fbcon_draw_line(FBCON_COMMON_MSG);
 	while(*str2 != 0) {
-		fbcon_putc_factor(*str2++, FBCON_COMMON_MSG, big_factor);
+		fbcon_putc_factor(*str2++, FBCON_COMMON_MSG, big_factor, 0);
 	}
 	fbcon_draw_line(FBCON_COMMON_MSG);
 
diff --git a/dev/fbcon/fbcon.c b/dev/fbcon/fbcon.c
index cc5e09e..848b967 100644
--- a/dev/fbcon/fbcon.c
+++ b/dev/fbcon/fbcon.c
@@ -2,7 +2,7 @@
  * Copyright (c) 2008, Google Inc.
  * All rights reserved.
  *
- * Copyright (c) 2009-2015, 2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2015, 2018, 2019 The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -336,7 +336,33 @@
 	cur_pos.y = 0;
 }
 
-void fbcon_putc_factor(char c, int type, unsigned scale_factor)
+void fbcon_clear_msg(unsigned y_start, unsigned y_end)
+{
+	unsigned i, j;
+	uint32_t bg_color;
+	char *pixels;
+	unsigned count;
+
+	/* ignore anything that happens before fbcon is initialized */
+	if (!config)
+		return;
+
+	count = config->width * (FONT_HEIGHT * (y_end - y_start) - 1);
+	pixels = config->base;
+	pixels += y_start * ((config->bpp / 8) * FONT_HEIGHT * config->width);
+
+	fbcon_set_colors(FBCON_COMMON_MSG);
+	for (i = 0; i < count; i++) {
+		bg_color = BGCOLOR;
+		for (j = 0; j < (config->bpp / 8); j++) {
+			*pixels = (unsigned char) bg_color;
+			bg_color = bg_color >> 8;
+			pixels++;
+		}
+	}
+}
+
+void fbcon_putc_factor(char c, int type, unsigned scale_factor, int y_start)
 {
 	char *pixels;
 
@@ -366,6 +392,11 @@
 	fbcon_set_colors(type);
 
 	pixels = config->base;
+	/* if y_start is null, it will start from current y loaction */
+	if (y_start) {
+		cur_pos.x = 0;
+		cur_pos.y = y_start;
+	}
 	pixels += cur_pos.y * ((config->bpp / 8) * FONT_HEIGHT * config->width);
 	pixels += cur_pos.x * scale_factor * ((config->bpp / 8) * (FONT_WIDTH + 1));
 
@@ -388,9 +419,9 @@
 		fbcon_flush();
 }
 
-void fbcon_putc(char c)
+void fbcon_putc(char c, int y_start)
 {
-	fbcon_putc_factor(c, FBCON_COMMON_MSG, SCALE_FACTOR);
+	fbcon_putc_factor(c, FBCON_COMMON_MSG, SCALE_FACTOR, y_start);
 }
 
 uint32_t fbcon_get_current_line(void)
diff --git a/include/dev/fbcon.h b/include/dev/fbcon.h
index 2a5abab..ae2bebf 100644
--- a/include/dev/fbcon.h
+++ b/include/dev/fbcon.h
@@ -2,7 +2,7 @@
  * Copyright (c) 2008, Google Inc.
  * All rights reserved.
  *
- * Copyright (c) 2009-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2015, 2019, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -104,11 +104,12 @@
 };
 
 void fbcon_setup(struct fbcon_config *cfg);
-void fbcon_putc(char c);
+void fbcon_putc(char c, int y_start);
 void fbcon_clear(void);
+void fbcon_clear_msg(unsigned y_start, unsigned y_end);
 struct fbcon_config* fbcon_display(void);
 void fbcon_extract_to_screen(logo_img_header *header, void* address);
-void fbcon_putc_factor(char c, int type, unsigned scale_factor);
+void fbcon_putc_factor(char c, int type, unsigned scale_factor, int y_start);
 void fbcon_draw_msg_background(unsigned y_start, unsigned y_end,
 	uint32_t paint, int update);
 void fbcon_draw_line(uint32_t type);
diff --git a/include/platform.h b/include/platform.h
index 6010a26..1452d0f 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -75,6 +75,7 @@
 int platform_is_sdm429();
 int platform_is_sdm439();
 int platform_is_sdm429w();
+int platform_is_sda429w();
 uint32_t platform_is_msm8976_v_1_1();
 uint32_t platform_get_tz_app_add();
 uint32_t platform_get_tz_app_size();
diff --git a/platform/msm8952/msm8952-clock.c b/platform/msm8952/msm8952-clock.c
index b7ced0b..85d5069 100644
--- a/platform/msm8952/msm8952-clock.c
+++ b/platform/msm8952/msm8952-clock.c
@@ -651,7 +651,7 @@
 	}
 
 	if (platform_is_msm8937() || platform_is_msm8917() ||
-		platform_is_sdm429() || platform_is_sdm429w() || platform_is_sdm439() ||
+		platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w() || platform_is_sdm439() ||
 		platform_is_qm215())
 		msm8937_clock_override();
 
diff --git a/platform/msm8952/platform.c b/platform/msm8952/platform.c
index a694a0a..325e103 100644
--- a/platform/msm8952/platform.c
+++ b/platform/msm8952/platform.c
@@ -331,6 +331,23 @@
 	return ret;
 }
 
+int platform_is_sda429w()
+{
+	uint32_t platform = board_platform_id();
+	uint32_t ret = 0;
+
+	switch(platform)
+	{
+	case SDA429W:
+		ret = 1;
+		break;
+	default:
+		ret = 0;
+	};
+
+	return ret;
+}
+
 int platform_is_msm8956()
 {
 	uint32_t platform = board_platform_id();
@@ -354,7 +371,7 @@
 uint32_t platform_get_tz_app_add()
 {
 	if(platform_is_msm8937() || platform_is_msm8917() ||
-		platform_is_sdm429() || platform_is_sdm429w() || platform_is_sdm439() ||
+		platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w() || platform_is_sdm439() ||
 		platform_is_qm215())
 		return APP_REGION_ADDR_8937;
 	else
@@ -364,7 +381,7 @@
 uint32_t platform_get_tz_app_size()
 {
 	if(platform_is_msm8937() || platform_is_msm8917() ||
-		platform_is_sdm429() || platform_is_sdm429w() || platform_is_sdm439() ||
+		platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w() || platform_is_sdm439() ||
 		platform_is_qm215())
 		return APP_REGION_SIZE_8937;
 	else
@@ -373,7 +390,7 @@
 
 uint32_t platform_get_apcs_ipc_base()
 {
-	if(platform_is_msm8917() || platform_is_sdm429() ||  platform_is_sdm429w() || platform_is_qm215())
+	if(platform_is_msm8917() || platform_is_sdm429() ||  platform_is_sdm429w() || platform_is_sda429w() || platform_is_qm215())
 		return APCS_ALIAS1_IPC_INTERRUPT_1;
 	else
 		return APCS_ALIAS0_IPC_INTERRUPT_2;
diff --git a/platform/msm_shared/avb/VerifiedBoot.c b/platform/msm_shared/avb/VerifiedBoot.c
index 7a06655..a322e5d 100644
--- a/platform/msm_shared/avb/VerifiedBoot.c
+++ b/platform/msm_shared/avb/VerifiedBoot.c
@@ -692,35 +692,38 @@
 	switch (Info->boot_state)
         {
 		case RED:
+#if FBCON_DISPLAY_MSG
 			display_bootverify_menu(DISPLAY_MENU_RED);
-			//if (Status != EFI_SUCCESS) {
-				dprintf(INFO, "Your device is corrupt. It can't be trusted and will not boot." \
-					"\nYour device will shutdown in 30s\n");
-			//}
+			wait_for_users_action();
+#else
+			dprintf(INFO, "Your device is corrupt. It can't be trusted and will not boot." \
+				"\nYour device will shutdown in 30s\n");
 			udelay(30000000);
 			shutdown_device();
+#endif
 			break;
 		case YELLOW:
+#if FBCON_DISPLAY_MSG
 			display_bootverify_menu(DISPLAY_MENU_YELLOW);
-			//if (Status == EFI_SUCCESS) {
+			wait_for_users_action();
 				wait_for_users_action();
-			//} else {
-				dprintf(INFO, "Your device has loaded a different operating system." \
-					"\nWait for 5 seconds before proceeding\n");
-				udelay(5000000);
-			//}
+#else
+			dprintf(INFO, "Your device has loaded a different operating system." \
+				"\nWait for 5 seconds before proceeding\n");
+			udelay(5000000);
+#endif
 			break;
 		case ORANGE:
 			if (ffbm_mode_string[0] != '\0' && !target_build_variant_user()) {
 				dprintf(DEBUG, "Device will boot into FFBM mode\n");
 			} else {
+#if FBCON_DISPLAY_MSG
 				display_bootverify_menu(DISPLAY_MENU_ORANGE);
-				if (Status == EFI_SUCCESS) {
-					wait_for_users_action();
-				} else {
-					dprintf(INFO, "Device is unlocked, Skipping boot verification\n");
-					udelay(5000000);
-				}
+				wait_for_users_action();
+#else
+				dprintf(INFO, "Device is unlocked, Skipping boot verification\n");
+				udelay(5000000);
+#endif
 			}
 			break;
 		default:
diff --git a/platform/msm_shared/debug.c b/platform/msm_shared/debug.c
index 8a28c4c..0138f11 100644
--- a/platform/msm_shared/debug.c
+++ b/platform/msm_shared/debug.c
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2009, Google Inc.
  * All rights reserved.
- * Copyright (c) 2009-2016, 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2016, 2018-2019, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -102,7 +102,7 @@
 {
 #if ENABLE_FBCON_LOGGING
 	while(*str != 0) {
-		fbcon_putc(*str++);
+		fbcon_putc(*str++, 0);
 	}
 #endif
 }
@@ -122,7 +122,7 @@
 	uart_putc(0, c);
 #endif
 #if WITH_DEBUG_FBCON && WITH_DEV_FBCON
-	fbcon_putc(c);
+	fbcon_putc(c, 0);
 #endif
 #if WITH_DEBUG_JTAG
 	jtag_dputc(c);
diff --git a/platform/msm_shared/display_menu.c b/platform/msm_shared/display_menu.c
index 5f4582f..9d85e9f 100644
--- a/platform/msm_shared/display_menu.c
+++ b/platform/msm_shared/display_menu.c
@@ -43,6 +43,8 @@
 #include <../../../app/aboot/devinfo.h>
 #include <../../../app/aboot/recovery.h>
 
+#define TITLE_MSG "<!>\n\n"
+
 static const char *unlock_menu_common_msg = "By unlocking the bootloader, you will be able to install "\
 				"custom operating system on this phone. "\
 				"A custom OS is not subject to the same level of testing "\
@@ -69,7 +71,9 @@
 #define YELLOW_WARNING_MSG	"Your device has loaded a different operating system\n\n "\
 				"Visit this link on another device:\n"
 
-#define ORANGE_WARNING_MSG	"Your device software can't be\n checked for corruption. Please lock the bootloader\n\n"\
+#define ORANGE_WARNING_MSG	"The boot loader is unlocked and software integrity cannot "\
+				"be guaranteed. Any data stored on the device may be available to attackers. "\
+				"Do not store any sensitive data on the device.\n\n"\
 				"Visit this link on another device:\n"
 
 #define RED_WARNING_MSG	"Your device is corrupt. It can't be\ntrusted and will not boot\n\n" \
@@ -81,9 +85,14 @@
 #define EIO_WARNING_MSG		"Your device is corrupt. It can't be\n trusted and may not work properly.\n\n"\
 				"Visit this link on another device:\n"
 
-#define URL_MSG "g.co/ABH\n"
+#define PAUSE_BOOT_MSG "PRESS POWER KEY TO PAUSE BOOT\n\n"
+
+#define CONTINUE_BOOT_MSG "PRESS POWER KEY TO CONTINUE\n\n"
+
+#define URL_MSG "g.co/ABH\n\n"
 
 #define DELAY_5SEC 5000
+#define DELAY_10SEC 10000
 #define DELAY_30SEC 30000
 
 static bool is_thread_start = false;
@@ -92,16 +101,18 @@
 #if VERIFIED_BOOT || VERIFIED_BOOT_2
 struct boot_verify_info {
 	int msg_type;
+	const char *title_msg;
 	const char *warning_msg;
 	const char *url_msg;
+	const char *notice_msg;
 };
 
 struct boot_verify_info boot_verify_info[] = {
-			[DISPLAY_MENU_RED] = {FBCON_RED_MSG, RED_WARNING_MSG, URL_MSG},
-			[DISPLAY_MENU_YELLOW] = {FBCON_YELLOW_MSG, YELLOW_WARNING_MSG, URL_MSG},
-			[DISPLAY_MENU_ORANGE] = {FBCON_ORANGE_MSG, ORANGE_WARNING_MSG, URL_MSG},
-			[DISPLAY_MENU_LOGGING] = {FBCON_RED_MSG, LOGGING_WARNING_MSG, NULL},
-			[DISPLAY_MENU_EIO] = {FBCON_RED_MSG, EIO_WARNING_MSG, URL_MSG}};
+			[DISPLAY_MENU_RED] = {FBCON_RED_MSG, TITLE_MSG, RED_WARNING_MSG, URL_MSG, NULL},
+			[DISPLAY_MENU_YELLOW] = {FBCON_YELLOW_MSG, TITLE_MSG, YELLOW_WARNING_MSG, URL_MSG, PAUSE_BOOT_MSG},
+			[DISPLAY_MENU_ORANGE] = {FBCON_ORANGE_MSG, TITLE_MSG, ORANGE_WARNING_MSG, URL_MSG, PAUSE_BOOT_MSG},
+			[DISPLAY_MENU_LOGGING] = {FBCON_RED_MSG, TITLE_MSG, LOGGING_WARNING_MSG, NULL, NULL},
+			[DISPLAY_MENU_EIO] = {FBCON_RED_MSG, TITLE_MSG, EIO_WARNING_MSG, URL_MSG, CONTINUE_BOOT_MSG}};
 #endif
 
 static char *verify_option_menu[] = {
@@ -199,11 +210,14 @@
 	}
 }
 
+/*  If y_start == 0, it will draw message from the current Y axis location,
+    otherwise it will start from the the value of y_start. */
 static void display_fbcon_menu_message(char *str, unsigned type,
-	unsigned scale_factor)
+	unsigned scale_factor, int y_start)
 {
 	while(*str != 0) {
-		fbcon_putc_factor(*str++, type, scale_factor);
+		fbcon_putc_factor(*str++, type, scale_factor, y_start);
+		y_start = 0;
 	}
 }
 
@@ -267,26 +281,26 @@
 	memset(&unlock_msg_info->info, 0, sizeof(struct menu_info));
 
 	display_fbcon_menu_message("<!>\n\n",
-		FBCON_UNLOCK_TITLE_MSG, big_factor);
+		FBCON_UNLOCK_TITLE_MSG, big_factor, 0);
 
 	if (status) {
 		display_fbcon_menu_message((char*)unlock_menu_common_msg,
-			FBCON_COMMON_MSG, common_factor);
+			FBCON_COMMON_MSG, common_factor, 0);
 	} else {
 		display_fbcon_menu_message((char*)lock_menu_common_msg,
-			FBCON_COMMON_MSG, common_factor);
+			FBCON_COMMON_MSG, common_factor, 0);
 	}
 
 	fbcon_draw_line(FBCON_COMMON_MSG);
 	unlock_msg_info->info.option_start[0] = fbcon_get_current_line();
 	display_fbcon_menu_message((char *)munlock_option_msg[status].ignore_msg,
-                               FBCON_COMMON_MSG, common_factor);
+                               FBCON_COMMON_MSG, common_factor, 0);
 	unlock_msg_info->info.option_bg[0] = fbcon_get_current_bg();
 	unlock_msg_info->info.option_end[0] = fbcon_get_current_line();
 	fbcon_draw_line(FBCON_COMMON_MSG);
 	unlock_msg_info->info.option_start[1] = fbcon_get_current_line();
 	display_fbcon_menu_message((char *)munlock_option_msg[status].comfirm_msg,
-                               FBCON_COMMON_MSG, common_factor);
+                               FBCON_COMMON_MSG, common_factor, 0);
 	unlock_msg_info->info.option_bg[1] = fbcon_get_current_bg();
 	unlock_msg_info->info.option_end[1] = fbcon_get_current_line();
 	fbcon_draw_line(FBCON_COMMON_MSG);
@@ -315,43 +329,35 @@
 	char fp_str_temp[EVP_MAX_MD_SIZE] = {'\0'};
 	char fp_str[EVP_MAX_MD_SIZE*2] = {'\0'};
 	char str_temp[8];
-
-	char str1[]= "Start >";
-	char str2[] = "Continue boot";
-	char *str3 = NULL;
-
-	char *str_target = NULL;
 	uint32 fp_size = 0;
 	unsigned int i = 0;
-	uint32_t timeout = DELAY_5SEC;
+	uint32_t timeout = DELAY_10SEC;
 
 	fbcon_clear();
 	memset(&msg_info->info, 0, sizeof(struct menu_info));
 
-	/* Align Right */
-	str_target = str_align_right(str1, big_factor);
-	if(str_target != NULL) {
-		display_fbcon_menu_message(str_target, FBCON_TITLE_MSG, big_factor);
-		free(str_target);
-	}
+	if(boot_verify_info[type].title_msg != NULL)
+		display_fbcon_menu_message((char*)boot_verify_info[type].title_msg,
+			boot_verify_info[type].msg_type, big_factor, 0);
 
-	str_target = str_align_right(str2, common_factor);
-	if(str_target != NULL) {
-		display_fbcon_menu_message(str_target, FBCON_TITLE_MSG, common_factor);
-		free(str_target);
-	}
-
-	display_fbcon_menu_message("\n< More options\n",
-		FBCON_COMMON_MSG, common_factor);
-	display_fbcon_menu_message("press VOLUME keys\n\n",
-		FBCON_SUBTITLE_MSG, common_factor);
 	if(boot_verify_info[type].warning_msg != NULL)
 		display_fbcon_menu_message((char*)boot_verify_info[type].warning_msg,
-			FBCON_COMMON_MSG, common_factor);
+			FBCON_COMMON_MSG, common_factor, 0);
 
-	if(boot_verify_info[type].url_msg != NULL)
+	if(boot_verify_info[type].url_msg != NULL) {
+		dprintf(INFO, "display_fbcon_menu_message: Location=%d\n", fbcon_get_current_line());
 		display_fbcon_menu_message((char*)boot_verify_info[type].url_msg,
-			boot_verify_info[type].msg_type, common_factor);
+			boot_verify_info[type].msg_type, common_factor, 0);
+		dprintf(INFO, "display_fbcon_menu_message: Location=%d\n", fbcon_get_current_line());
+	}
+
+	if(boot_verify_info[type].notice_msg != NULL) {
+		msg_info->info.option_start[0] = fbcon_get_current_line();
+		dprintf(INFO, "display_fbcon_menu_message: Location=%d\n", msg_info->info.option_start[0]);
+		display_fbcon_menu_message((char*)boot_verify_info[type].notice_msg,
+			FBCON_COMMON_MSG, common_factor, 0);
+		msg_info->info.option_end[0] = fbcon_get_current_line();
+	}
 
 	if (type == DISPLAY_MENU_YELLOW) {
 		fp_buf = get_boot_fingerprint(&fp_size);
@@ -366,27 +372,40 @@
 				strlcat(fp_str, str_temp, sizeof(fp_str));
 			}
 		}
-		display_fbcon_menu_message("ID:", FBCON_COMMON_MSG, common_factor);
-		display_fbcon_menu_message(fp_str, FBCON_COMMON_MSG, common_factor);
+		display_fbcon_menu_message("ID:", FBCON_COMMON_MSG, common_factor, 0);
+		display_fbcon_menu_message(fp_str, FBCON_COMMON_MSG, common_factor, 0);
 	}
 
-	str3 = "\n\nIf no key pressed:\n"\
-		"Your device will boot in 5  seconds\n\n";
+	switch (type) {
+		case DISPLAY_MENU_RED:
+			timeout = DELAY_30SEC;
+			break;
+		case DISPLAY_MENU_EIO:
 #if ENABLE_VB_ATTEST
-	if(type == DISPLAY_MENU_EIO)
-	{
-		str3 ="\n\nIf power key is not pressed:\n"\
-			"Your device will poweroff in 30 seconds\n\n";
-		timeout = DELAY_30SEC;
-	}
+			timeout = DELAY_30SEC;
 #endif
-	display_fbcon_menu_message(str3, FBCON_COMMON_MSG, common_factor);
+			break;
+		default:
+			timeout = DELAY_10SEC;
+			break;
+	}
 
 	msg_info->info.msg_type = type;
 
 	/* Initialize the time out time */
-	msg_info->info.timeout_time = timeout; //5s
+	msg_info->info.timeout_time = timeout;
 }
+
+void display_bootverify_menu_update (struct select_msg_info *msg_info)
+{
+	int location = msg_info->info.option_start[0];
+
+	/* clean the old msg */
+	fbcon_clear_msg (location, msg_info->info.option_end[0]);
+	display_fbcon_menu_message(CONTINUE_BOOT_MSG, FBCON_COMMON_MSG, common_factor, location);
+	msg_info->info.timeout_time = DELAY_30SEC;
+}
+
 #endif
 
 /* msg_lock need to be holded when call this function. */
@@ -400,15 +419,15 @@
 
 	len = ARRAY_SIZE(verify_option_menu);
 	display_fbcon_menu_message("Options menu:\n\n",
-		FBCON_COMMON_MSG, big_factor);
+		FBCON_COMMON_MSG, big_factor, 0);
 	display_fbcon_menu_message("Press volume key to select, and "\
-		"press power key to select\n\n", FBCON_COMMON_MSG, common_factor);
+		"press power key to select\n\n", FBCON_COMMON_MSG, common_factor, 0);
 
 	for (i = 0; i < len; i++) {
 		fbcon_draw_line(FBCON_COMMON_MSG);
 		msg_info->info.option_start[i] = fbcon_get_current_line();
 		display_fbcon_menu_message(verify_option_menu[i],
-			FBCON_COMMON_MSG, common_factor);
+			FBCON_COMMON_MSG, common_factor, 0);
 		msg_info->info.option_bg[i]= fbcon_get_current_bg();
 		msg_info->info.option_end[i]= fbcon_get_current_line();
 	}
@@ -453,47 +472,47 @@
 	}
 	fbcon_draw_line(msg_type);
 	display_fbcon_menu_message(fastboot_option_menu[option_index],
-		msg_type, big_factor);
+		msg_type, big_factor, 0);
 	fbcon_draw_line(msg_type);
 	display_fbcon_menu_message("\n\nPress volume key to select, and "\
-		"press power key to select\n\n", FBCON_COMMON_MSG, common_factor);
+		"press power key to select\n\n", FBCON_COMMON_MSG, common_factor, 0);
 
-	display_fbcon_menu_message("FASTBOOT MODE\n", FBCON_RED_MSG, common_factor);
+	display_fbcon_menu_message("FASTBOOT MODE\n", FBCON_RED_MSG, common_factor, 0);
 
 	get_product_name((unsigned char *) msg_buf);
 	snprintf(msg, sizeof(msg), "PRODUCT_NAME - %s\n", msg_buf);
-	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor);
+	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor, 0);
 
 	memset(msg_buf, 0, sizeof(msg_buf));
 	smem_get_hw_platform_name((unsigned char *) msg_buf, sizeof(msg_buf));
 	snprintf(msg, sizeof(msg), "VARIANT - %s %s\n",
 		msg_buf, target_is_emmc_boot()? "eMMC":"UFS");
-	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor);
+	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor, 0);
 
 	memset(msg_buf, 0, sizeof(msg_buf));
 	get_bootloader_version((unsigned char *) msg_buf);
 	snprintf(msg, sizeof(msg), "BOOTLOADER VERSION - %s\n",
 		msg_buf);
-	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor);
+	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor, 0);
 
 	memset(msg_buf, 0, sizeof(msg_buf));
 	get_baseband_version((unsigned char *) msg_buf);
 	snprintf(msg, sizeof(msg), "BASEBAND VERSION - %s\n",
 		msg_buf);
-	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor);
+	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor, 0);
 
 	memset(msg_buf, 0, sizeof(msg_buf));
 	target_serialno((unsigned char *) msg_buf);
 	snprintf(msg, sizeof(msg), "SERIAL NUMBER - %s\n", msg_buf);
-	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor);
+	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor, 0);
 
 	snprintf(msg, sizeof(msg), "SECURE BOOT - %s\n",
 		is_secure_boot_enable()? "enabled":"disabled");
-	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor);
+	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor, 0);
 
 	snprintf(msg, sizeof(msg), "DEVICE STATE - %s\n",
 		is_device_locked()? "locked":"unlocked");
-	display_fbcon_menu_message(msg, FBCON_RED_MSG, common_factor);
+	display_fbcon_menu_message(msg, FBCON_RED_MSG, common_factor, 0);
 
 	fastboot_msg_info->info.msg_type = DISPLAY_MENU_FASTBOOT;
 	fastboot_msg_info->info.option_num = len;
diff --git a/platform/msm_shared/include/display_menu.h b/platform/msm_shared/include/display_menu.h
index f063f03..4b4e433 100644
--- a/platform/msm_shared/include/display_menu.h
+++ b/platform/msm_shared/include/display_menu.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, 2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2016, 2018, 2019, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
@@ -80,6 +80,7 @@
 void reset_device_unlock_status (int type);
 void display_bootverify_menu_renew(struct select_msg_info *msg_info, int type);
 void display_bootverify_option_menu_renew(struct select_msg_info *msg_info);
+void display_bootverify_menu_update (struct select_msg_info *msg_info);
 void display_fastboot_menu_renew(struct select_msg_info *fastboot_msg_info);
 void display_bootverify_menu(int type);
 void display_fastboot_menu();
diff --git a/platform/msm_shared/menu_keys_detect.c b/platform/msm_shared/menu_keys_detect.c
index 6b552e8..d7a2beb 100644
--- a/platform/msm_shared/menu_keys_detect.c
+++ b/platform/msm_shared/menu_keys_detect.c
@@ -233,11 +233,22 @@
 static void power_key_func(struct select_msg_info* msg_info)
 {
 	int reason = -1;
+	static boolean isreflash;
 
 	switch (msg_info->info.msg_type) {
 		case DISPLAY_MENU_YELLOW:
 		case DISPLAY_MENU_ORANGE:
-		case DISPLAY_MENU_RED:
+			if (!isreflash) {
+			  /* If the power key is pressed for the first time:
+			   * Update the warning message and recalculate the timeout
+			   */
+			  before_time = current_time();
+			  display_bootverify_menu_update (msg_info);
+			  isreflash = TRUE;
+			} else {
+			  reason = CONTINUE;
+			}
+			break;
 		case DISPLAY_MENU_LOGGING:
 			reason = CONTINUE;
 			break;
@@ -305,18 +316,18 @@
 		power_key_func,
 	},
 	[DISPLAY_MENU_YELLOW] = {
-		boot_warning_volume_keys_func,
-		boot_warning_volume_keys_func,
+		NULL,
+		NULL,
 		power_key_func,
 	},
 	[DISPLAY_MENU_ORANGE] = {
-		boot_warning_volume_keys_func,
-		boot_warning_volume_keys_func,
+		NULL,
+		NULL,
 		power_key_func,
 	},
 	[DISPLAY_MENU_RED] = {
-		boot_warning_volume_keys_func,
-		boot_warning_volume_keys_func,
+		NULL,
+		NULL,
 		power_key_func,
 	},
 	[DISPLAY_MENU_LOGGING] = {
@@ -325,8 +336,8 @@
 		power_key_func,
 	},
 	[DISPLAY_MENU_EIO] = {
-		boot_warning_volume_keys_func,
-		boot_warning_volume_keys_func,
+		NULL,
+		NULL,
 		power_key_func,
 	},
 	[DISPLAY_MENU_MORE_OPTION] = {
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
old mode 100755
new mode 100644
index 109547c..f6d58d9
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -477,6 +477,7 @@
 	QM215 = 386,
 	QCM2150 = 436,
 	SDM429W = 416,
+	SDA429W = 437,
 };
 
 enum platform {
diff --git a/target/msm8952/init.c b/target/msm8952/init.c
old mode 100755
new mode 100644
index 8446481..65967fb
--- a/target/msm8952/init.c
+++ b/target/msm8952/init.c
@@ -112,7 +112,7 @@
 
 static int sdm429_pm660_target()
 {
-	if ((platform_is_sdm429() && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660)) || platform_is_sdm429w())
+	if ((platform_is_sdm429() && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660)) || platform_is_sdm429w() || platform_is_sda429w())
 		return 1;
 	else
 		return 0;
@@ -201,7 +201,7 @@
 	if(platform_is_msm8956())
 		vol_up_gpio = TLMM_VOL_UP_BTN_GPIO_8956;
 	else if(platform_is_msm8937() || platform_is_msm8917() ||
-		    platform_is_sdm429() || platform_is_sdm429w() || platform_is_sdm439() ||
+		    platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w() || platform_is_sdm439() ||
 		    platform_is_qm215())
 		vol_up_gpio = TLMM_VOL_UP_BTN_GPIO_8937;
 	else
@@ -307,7 +307,7 @@
 	if(target_is_pmi_enabled())
 	{
 		if(platform_is_msm8937() || platform_is_msm8917() ||
-		   platform_is_sdm429() || platform_is_sdm429w() || platform_is_sdm439())
+		   platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w() || platform_is_sdm439())
 		{
 			uint8_t pmi_rev = 0;
 			uint32_t pmi_type = 0;
@@ -341,7 +341,7 @@
 #if PON_VIB_SUPPORT
 	/* turn on vibrator to indicate that phone is booting up to end user */
 	if(target_is_pmi_enabled() || platform_is_qm215()
-			|| platform_is_sdm429w() || sdm429_pm660_target())
+			|| platform_is_sdm429w() || platform_is_sda429w() || sdm429_pm660_target())
 		vib_timed_turn_on(VIBRATE_TIME);
 #endif
 
@@ -438,6 +438,7 @@
 	case APQ8017:
 	case SDA429:
 	case SDA439:
+	case SDA429W:
 		board->baseband = BASEBAND_APQ;
 		break;
 	default:
@@ -520,7 +521,7 @@
 void target_uninit(void)
 {
 #if PON_VIB_SUPPORT
-	if(target_is_pmi_enabled() || platform_is_sdm429w() || sdm429_pm660_target())
+	if(target_is_pmi_enabled() || platform_is_sdm429w() || platform_is_sda429w() || sdm429_pm660_target())
 		turn_off_vib_early();
 #endif
 	mmc_put_card_to_sleep(dev);
@@ -715,7 +716,7 @@
 
 bool target_is_pmi_enabled(void)
 {
-	if (platform_is_qm215() || platform_is_sdm429w() || sdm429_pm660_target() ||
+	if (platform_is_qm215() || platform_is_sdm429w() || platform_is_sda429w() || sdm429_pm660_target() ||
 			(platform_is_msm8917() && (board_hardware_subtype() ==
 			HW_PLATFORM_SUBTYPE_SAP_NOPMI)))
 		return 0;
@@ -772,7 +773,7 @@
 		else
 			return PMIC_IS_PMI8950;
 	} else {
-		if (platform_is_qm215() || platform_is_sdm429w() || sdm429_pm660_target()) {
+		if (platform_is_qm215() || platform_is_sdm429w() || platform_is_sda429w() || sdm429_pm660_target()) {
 			pmi_type = board_pmic_target(0) & PMIC_TYPE_MASK;
 			return pmi_type;
 		}
diff --git a/target/msm8952/oem_panel.c b/target/msm8952/oem_panel.c
old mode 100755
new mode 100644
index 07eee04..0a20579
--- a/target/msm8952/oem_panel.c
+++ b/target/msm8952/oem_panel.c
@@ -1075,7 +1075,7 @@
 			panel_id = HX8399C_FHD_PLUSE_VIDEO_PANEL;
 		}
 
-		if (platform_is_sdm429() || platform_is_sdm429w()) {
+		if (platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w()) {
 			if (hw_subtype == HW_PLATFORM_SUBTYPE_429W_PM660) /* WTP 2700 DVT */
 			  panel_id = RM67162_QVGA_CMD_PANEL;
 			else if (hw_subtype == HW_PLATFORM_SUBTYPE_429W_PM660_WDP) /* WDP 2700 */
@@ -1118,7 +1118,7 @@
 	 * Update all data structures after 'panel_init' label. Only panel
 	 * selection is supposed to happen before that.
 	 */
-	if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w()) {
+	if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w()) {
 		phy_db->pll_type = DSI_PLL_TYPE_12NM;
 		pinfo->lane_config = mdss_dsi_lane_config;
 		goto end;
diff --git a/target/msm8952/regulator.c b/target/msm8952/regulator.c
old mode 100755
new mode 100644
index 873077f..4daf4ea
--- a/target/msm8952/regulator.c
+++ b/target/msm8952/regulator.c
@@ -178,7 +178,7 @@
 		if (enable & REG_LDO1)
 			rpm_send_data(&ldo1[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
 
-	} else if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w()) {
+	} else if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w()) {
 		if (enable & REG_LDO5)
 			rpm_send_data(&ldo5[GENERIC_ENABLE][0],
 				36, RPM_REQUEST_TYPE);
@@ -187,7 +187,7 @@
 			rpm_send_data(&ldo2[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
 	}
 
-	if ((platform_is_sdm429() && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660)) || platform_is_sdm429w()) {
+	if ((platform_is_sdm429() && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660)) || platform_is_sdm429w() || platform_is_sda429w()) {
 		if (enable & REG_LDO13)
 			rpm_send_data(&ldo13_pm660[GENERIC_ENABLE][0],
 				36, RPM_REQUEST_TYPE);
@@ -200,7 +200,7 @@
 		rpm_send_data(&ldo17[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
 
 	if (enable & REG_LDO6) {
-		if ((platform_is_sdm429() || platform_is_sdm429w()) && hw_subtype
+		if ((platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w()) && hw_subtype
 				== HW_PLATFORM_SUBTYPE_429W_PM660)
 			rpm_send_data(&ldo6_pm660[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
 		else
@@ -214,7 +214,7 @@
 		if (enable & REG_LDO1)
 			rpm_send_data(&ldo1[GENERIC_DISABLE][0], 36, RPM_REQUEST_TYPE);
 
-	} else if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w()) {
+	} else if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w()) {
 		if (enable & REG_LDO5)
 			rpm_send_data(&ldo5[GENERIC_DISABLE][0],
 				36, RPM_REQUEST_TYPE);
diff --git a/target/msm8952/target_display.c b/target/msm8952/target_display.c
old mode 100755
new mode 100644
index 0dc6834..af32186
--- a/target/msm8952/target_display.c
+++ b/target/msm8952/target_display.c
@@ -364,7 +364,7 @@
 		pll_data->is_center_spread = false;
 		pll_data->ssc_freq = 30000;
 		pll_data->ssc_ppm = 5000;
-	} else if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w()) {
+	} else if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w()) {
 		pll_data->ssc_en = true;
 		pll_data->is_center_spread = false;
 		pll_data->ssc_freq = 31500;
@@ -388,7 +388,7 @@
 
 		gcc_dsi_lp_clock_enable(flags);
 
-		if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w()) {
+		if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w()) {
 			mdss_dsi_auto_pll_12nm_config(pinfo);
 
 			/*
@@ -452,9 +452,9 @@
 		bkl_gpio.pin_id = 93;
 		enable_gpio.pin_id = 94;
 		pinfo->mipi.use_enable_gpio = 1;
-	} else if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w()) {
+	} else if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w()) {
 		reset_gpio.pin_id = 60;
-		if ((platform_is_sdm429() && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660)) || platform_is_sdm429w()) {
+		if ((platform_is_sdm429() && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660)) || platform_is_sdm429w() || platform_is_sda429w()) {
       if (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660_WDP) {
         reset_gpio.pin_id = 60;
         pinfo->mipi.use_enable_gpio = 0;
@@ -480,7 +480,7 @@
 			gpio_set_dir(enable_gpio.pin_id, 2);
 		}
 
-		if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w()) {
+		if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w()) {
 			/* enable PM GPIO-4 for backlight enable */
 			struct pm8x41_gpio gpio_param = {
 			.direction = PM_GPIO_DIR_OUT,
@@ -492,7 +492,7 @@
 			};
 
 			if (((board_target_id() & VARIANT_MAJOR_MASK)) &&
-				platform_is_sdm429w()) {
+				(platform_is_sda429w() || platform_is_sdm429w())) {
 				/* enable PM660 GPIO-12 for backlight enable */
 				bkl_en_gpio.pin_id = 12;
 				gpio_param.inv_int_pol = PM_GPIO_INVERT;
@@ -641,7 +641,7 @@
 
 int target_display_get_base_offset(uint32_t base)
 {
-	if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w()) {
+	if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w()) {
 		if (base == MIPI_DSI0_BASE)
 			return DSI0_BASE_ADJUST;
 		else if (base == DSI0_PHY_BASE)
@@ -674,12 +674,12 @@
 
 	if (platform_is_msm8956())
 		ldo_num |= REG_LDO1;
-	else if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w())
+	else if (platform_is_sdm439() || platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w())
 		ldo_num |= REG_LDO5; /* LDO23 is enable by default */
 	else
 		ldo_num |= REG_LDO2;
 
-	if ((platform_is_sdm429() && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660)) || platform_is_sdm429w()) {
+	if ((platform_is_sdm429() && (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_429W_PM660)) || platform_is_sdm429w() || platform_is_sda429w()) {
 			ldo_num &= ~(REG_LDO17 | REG_LDO5);
 			ldo_num |= REG_LDO13 | REG_LDO15;
 		}
@@ -710,7 +710,7 @@
 		 */
 		regulator_disable(REG_LDO17);
 
-		if ((platform_is_sdm429() || platform_is_sdm429w()) && hw_subtype
+		if ((platform_is_sdm429() || platform_is_sdm429w() || platform_is_sda429w()) && hw_subtype
 			== HW_PLATFORM_SUBTYPE_429W_PM660)
 			regulator_disable(REG_LDO13 | REG_LDO15);
 	}