Merge "app: aboot: Exit keys' detection thread after fastboot continue" into lk.lnx.1.0-dev.1.0
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index e12754b..a51d3eb 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -3042,7 +3042,8 @@
if (target_is_emmc_boot())
{
#if FBCON_DISPLAY_MSG
- keys_detect_init();
+ /* Exit keys' detection thread firstly */
+ exit_menu_keys_detection();
#endif
boot_linux_from_mmc();
}
diff --git a/platform/msm_shared/display_menu.c b/platform/msm_shared/display_menu.c
index abc7fac..8daef15 100644
--- a/platform/msm_shared/display_menu.c
+++ b/platform/msm_shared/display_menu.c
@@ -95,23 +95,44 @@
static int big_factor = 2;
static int common_factor = 1;
-void wait_for_users_action()
+static void wait_for_exit()
{
struct select_msg_info *select_msg;
select_msg = &msg_info;
mutex_acquire(&select_msg->msg_lock);
- while(!select_msg->info.is_timeout == true) {
+ while(!select_msg->info.rel_exit == true) {
mutex_release(&select_msg->msg_lock);
thread_sleep(10);
mutex_acquire(&select_msg->msg_lock);
}
mutex_release(&select_msg->msg_lock);
+ is_thread_start = false;
fbcon_clear();
display_image_on_screen();
}
+void wait_for_users_action()
+{
+ /* Waiting for exit menu keys detection if there is no any usr action
+ * otherwise it will do the action base on the keys detection thread
+ */
+ wait_for_exit();
+}
+
+void exit_menu_keys_detection()
+{
+ struct select_msg_info *select_msg;
+ select_msg = &msg_info;
+
+ mutex_acquire(&select_msg->msg_lock);
+ select_msg->info.is_exit = true;
+ mutex_release(&select_msg->msg_lock);
+
+ wait_for_exit();
+}
+
static void set_message_factor()
{
uint32_t tmp_factor = 0;
diff --git a/platform/msm_shared/include/display_menu.h b/platform/msm_shared/include/display_menu.h
index 93a1f2b..432e649 100644
--- a/platform/msm_shared/include/display_menu.h
+++ b/platform/msm_shared/include/display_menu.h
@@ -52,7 +52,8 @@
uint32_t option_index;
uint32_t msg_type;
uint32_t timeout_time;
- bool is_timeout;
+ bool is_exit;
+ bool rel_exit;
};
struct select_msg_info {
@@ -70,4 +71,5 @@
void display_fastboot_menu();
void display_unlock_menu(int type);
void msg_lock_init();
+void exit_menu_keys_detection();
#endif /* __PLATFORM_MSM_SHARED_DISPLAY_MENU_H */
diff --git a/platform/msm_shared/menu_keys_detect.c b/platform/msm_shared/menu_keys_detect.c
index 8173133..6fb56ab 100644
--- a/platform/msm_shared/menu_keys_detect.c
+++ b/platform/msm_shared/menu_keys_detect.c
@@ -143,7 +143,7 @@
display_image_on_screen();
/* Continue boot, no need to detect the keys'status */
- msg_info->info.is_timeout = true;
+ msg_info->info.is_exit = true;
break;
case BACK:
display_bootverify_menu_renew(msg_info, msg_info->last_msg_type);
@@ -363,19 +363,17 @@
mutex_release(&msg_info->msg_lock);
}
- /* Never time out if the timeout_time is 0 */
mutex_acquire(&msg_info->msg_lock);
+ /* Never time out if the timeout_time is 0 */
if(msg_info->info.timeout_time) {
- if (msg_info->info.is_timeout) {
- mutex_release(&msg_info->msg_lock);
- return 0;
- }
+ if ((current_time() - before_time) > msg_info->info.timeout_time)
+ msg_info->info.is_exit = true;
+ }
- if ((current_time() - before_time) > msg_info->info.timeout_time) {
- msg_info->info.is_timeout = true;
- mutex_release(&msg_info->msg_lock);
- return 0;
- }
+ if (msg_info->info.is_exit) {
+ msg_info->info.rel_exit = true;
+ mutex_release(&msg_info->msg_lock);
+ break;
}
mutex_release(&msg_info->msg_lock);
thread_sleep(KEY_DETECT_FREQUENCY);