Add visibility queuing feature 32/223332/1
authorhyunho <hhstark.kang@samsung.com>
Wed, 29 Jan 2020 01:18:38 +0000 (10:18 +0900)
committerhyunho <hhstark.kang@samsung.com>
Wed, 29 Jan 2020 01:18:38 +0000 (10:18 +0900)
Visibility can be sent when surface is not ready.
In that case, we should save last state of visivility and
send it after surface ready.

Change-Id: I4eb8d6ba3868e2da9a17665acf7e1708d3581e1a
Signed-off-by: hyunho <hhstark.kang@samsung.com>
screen_connector_remote_surface/remote_surface.cc
screen_connector_remote_surface/remote_surface_implementation.h

index fb8e3c3..e0037c2 100644 (file)
@@ -170,6 +170,12 @@ void RemoteSurface::SendVisibility(bool visible) {
   if (impl_->freeze_)
     return;
 
+  if (impl_->surface_.get() == nullptr) {
+    LOGW("Surface is not ready. Queuing visibility");
+    impl_->queuing_visibility_ = std::unique_ptr<bool>(new bool(visible));
+    return;
+  }
+
   if (RemoteSurface::Impl::delayed_resuming_time_ == 0 ||
       GetType() == WATCH) {
     if (!visible)
@@ -229,6 +235,11 @@ void RemoteSurface::Impl::Redirect() {
 
   if (bind_surface_.get() != nullptr)
     RemoteSurfaceManager::GetInst().Bind(*surface_, *bind_surface_);
+
+  if (queuing_visibility_ != nullptr) {
+    parent_->SendVisibility(*queuing_visibility_);
+    queuing_visibility_ = nullptr;
+  }
 }
 
 void RemoteSurface::Bind(std::shared_ptr<WlSurface> surface) {
index 25e60a9..009c7c6 100644 (file)
@@ -81,6 +81,7 @@ class RemoteSurface::Impl : AulHandle::IEventListener, ITRS::IEventListener {
   static uint32_t delayed_resuming_time_;
   RemoteSurface* parent_;
   bool mock_;
+  std::unique_ptr<bool> queuing_visibility_;
 };
 
 }  // namespace screen_connector