composer: Move Refresh call out of Seq Scope Lock to avoid deadlock

Change-Id: I2bb21bbc4a6a8affd3c3afee3b8c40f0e11c146c
diff --git a/composer/hwc_session.cpp b/composer/hwc_session.cpp
index 870c1b5..0e65788 100644
--- a/composer/hwc_session.cpp
+++ b/composer/hwc_session.cpp
@@ -4270,10 +4270,10 @@
 int HWCSession::WaitForCommitDone(hwc2_display_t display, int client_id) {
   shared_ptr<Fence> retire_fence = nullptr;
   int timeout_ms = -1;
+  callbacks_.Refresh(display);
   {
     SEQUENCE_WAIT_SCOPE_LOCK(locker_[display]);
     DLOGI("Acquired lock for client %d display %" PRIu64, client_id, display);
-    callbacks_.Refresh(display);
     clients_waiting_for_commit_[display].set(client_id);
     locker_[display].Wait();
     if (commit_error_[display] != 0) {
@@ -4454,7 +4454,6 @@
       DLOGW("Target display %d is not ready", disp_id);
       return -ENODEV;
     }
-    tui_state_transition_[disp_id] = true;
   }
 
   return 0;
@@ -4474,11 +4473,6 @@
     return -ENOTSUP;
   }
 
-  if (!tui_state_transition_[disp_id]) {
-    DLOGE("Display %d tui transition state is not valid.", disp_id);
-    return -EINVAL;
-  }
-
   {
     SEQUENCE_WAIT_SCOPE_LOCK(locker_[target_display]);
     hwc_display_[target_display]->SetIdleTimeoutMs(idle_time_active_ms_, idle_time_inactive_ms_);
@@ -4513,7 +4507,6 @@
       DLOGW("Target display %d is not ready", disp_id);
       return -ENODEV;
     }
-    tui_state_transition_[disp_id] = false;
   }
 
   return TUITransitionUnPrepare(disp_id);
diff --git a/composer/hwc_session.h b/composer/hwc_session.h
index bfd72e8..658ef21 100644
--- a/composer/hwc_session.h
+++ b/composer/hwc_session.h
@@ -720,7 +720,6 @@
   bool async_power_mode_triggered_ = false;
   bool async_vds_creation_ = false;
   bool power_state_transition_[HWCCallbacks::kNumDisplays] = {};
-  bool tui_state_transition_[HWCCallbacks::kNumDisplays] = {};
   std::bitset<HWCCallbacks::kNumDisplays> display_ready_;
   bool secure_session_active_ = false;
   bool is_client_up_ = false;