Fix an incorrect display lock state
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 13 Dec 2023 04:40:53 +0000 (13:40 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 13 Dec 2023 04:50:04 +0000 (13:50 +0900)
When calling Unlock within the timer callback, the timer value was not
initialized to 0. This causes the following issue where the lock remains locked
after being unlocked.
If there is no app using the boot sequence, display lock is not called.

Change-Id: Ia53e4aa5fd5e69f507285895ebd647e732328ee3
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/boot_sequencer/boot_sequencer.cc
src/lib/common/display_state_manager.cc

index 2afe0550db7e0eb1d61ea2fe2bce85f78ff857e0..bbe08148829627de49f54832fbf638cafbebd812 100644 (file)
@@ -151,6 +151,11 @@ void BootSequencer::Start(uid_t uid) {
   if (source_ != 0)
     return;
 
+  if (QueueEmpty()) {
+    _W("Queue is empty");
+    return;
+  }
+
   DisplayStateManager::GetInst().Lock();
   source_ = g_timeout_add(100, OnRun, this);
 }
index 06544cf41d3b62df9aec4ce3d32bb0b465ef6c26..4adef4f89f5c28d942b17c91336852f00e07fac3 100644 (file)
@@ -50,7 +50,9 @@ void DisplayStateManager::RegisterUnlockTimer() {
 
   timer_ = g_timeout_add(
       5000, [](gpointer user_data) {
-        static_cast<DisplayStateManager*>(user_data)->Unlock();
+        auto* handle = static_cast<DisplayStateManager*>(user_data);
+        handle->Unlock();
+        handle->timer_ = 0;
         return G_SOURCE_REMOVE;
       }, this);
 }