Merge "platform: mdm9640,msm_shared: Rename target sdxhedgehog to sdx20"
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 227b2fc..2738c68 100755
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -105,6 +105,7 @@
 void write_device_info_flash(device_info *dev);
 static int aboot_save_boot_hash_mmc(uint32_t image_addr, uint32_t image_size);
 static int aboot_frp_unlock(char *pname, void *data, unsigned sz);
+bool pwr_key_is_pressed = false;
 
 /* fastboot command function pointer */
 typedef void (*fastboot_cmd_fn) (const char *, void *, unsigned);
@@ -818,6 +819,9 @@
 #if FBCON_DISPLAY_MSG
 #if ENABLE_VB_ATTEST
 		display_bootverify_menu(DISPLAY_MENU_EIO);
+		wait_for_users_action();
+		if(!pwr_key_is_pressed)
+			shutdown_device();
 #else
 		display_bootverify_menu(DISPLAY_MENU_LOGGING);
 #endif
diff --git a/platform/msm_shared/display_menu.c b/platform/msm_shared/display_menu.c
index 1d1be46..8ee11ff 100644
--- a/platform/msm_shared/display_menu.c
+++ b/platform/msm_shared/display_menu.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, 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
@@ -70,6 +70,9 @@
 #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 g.co/ABH"
 
+#define DELAY_5SEC 5000
+#define DELAY_30SEC 30000
+
 static bool is_thread_start = false;
 static struct select_msg_info msg_info;
 
@@ -252,9 +255,12 @@
 
 	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;
 
 	fbcon_clear();
 	memset(&msg_info->info, 0, sizeof(struct menu_info));
@@ -300,13 +306,22 @@
 		display_fbcon_menu_message(fp_str, FBCON_COMMON_MSG, common_factor);
 	}
 
-	display_fbcon_menu_message("\n\nIf no key pressed:\n"\
-		"Your device will boot in 5 seconds\n\n", FBCON_COMMON_MSG, common_factor);
+	str3 = "\n\nIf no key pressed:\n"\
+		"Your device will boot in 5  seconds\n\n";
+#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;
+	}
+#endif
+	display_fbcon_menu_message(str3, FBCON_COMMON_MSG, common_factor);
 
 	msg_info->info.msg_type = type;
 
 	/* Initialize the time out time */
-	msg_info->info.timeout_time = 5000; //5s
+	msg_info->info.timeout_time = timeout; //5s
 }
 #endif
 
diff --git a/platform/msm_shared/menu_keys_detect.c b/platform/msm_shared/menu_keys_detect.c
index efea07e..8ffbacb 100644
--- a/platform/msm_shared/menu_keys_detect.c
+++ b/platform/msm_shared/menu_keys_detect.c
@@ -50,6 +50,7 @@
 
 static time_t before_time;
 
+extern bool pwr_key_is_pressed;
 extern int target_volume_up();
 extern uint32_t target_volume_down();
 extern void reboot_device(unsigned reboot_reason);
@@ -251,7 +252,10 @@
 		case DISPLAY_MENU_ORANGE:
 		case DISPLAY_MENU_RED:
 		case DISPLAY_MENU_LOGGING:
+			reason = CONTINUE;
+			break;
 		case DISPLAY_MENU_EIO:
+			pwr_key_is_pressed = true;
 			reason = CONTINUE;
 			break;
 		case DISPLAY_MENU_MORE_OPTION: