From 7b0125317340e345f5c8815560ca4e32b09697d8 Mon Sep 17 00:00:00 2001 From: Albert Chaulk Date: Mon, 13 Mar 2017 17:03:29 -0400 Subject: [PATCH] vr_wm: Disable 2D mode until we can detect it correctly Bug: 36036583 Test: Test w/ permissionsgen Change-Id: Ie3ea8b162a0c40db8ee9cccb934a2a580a558937 --- services/vr/vr_window_manager/application.cpp | 5 +--- services/vr/vr_window_manager/shell_view.cpp | 32 +++++++++++----------- .../vr/vr_window_manager/surface_flinger_view.cpp | 4 +-- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/services/vr/vr_window_manager/application.cpp b/services/vr/vr_window_manager/application.cpp index 24087c9b31..dba797f38a 100644 --- a/services/vr/vr_window_manager/application.cpp +++ b/services/vr/vr_window_manager/application.cpp @@ -294,10 +294,7 @@ void Application::SetVisibility(bool visible) { bool changed = is_visible_ != visible; if (changed) { is_visible_ = visible; - // TODO (alexst): b/36036583 Disable vr_wm visibility until we figure out - // why it's always on top. Still make it visible in debug mode. - if (debug_mode_) - dvrGraphicsSurfaceSetVisible(graphics_context_, is_visible_); + dvrGraphicsSurfaceSetVisible(graphics_context_, is_visible_); OnVisibilityChanged(is_visible_); } } diff --git a/services/vr/vr_window_manager/shell_view.cpp b/services/vr/vr_window_manager/shell_view.cpp index 10588b7ddd..abe9c60ebd 100644 --- a/services/vr/vr_window_manager/shell_view.cpp +++ b/services/vr/vr_window_manager/shell_view.cpp @@ -195,27 +195,27 @@ ViewMode CalculateVisibilityFromLayerConfig(const HwcCallback::Frame& frame, uint32_t vr_app) { auto& layers = frame.layers(); - // We assume the first two layers are the VR app. In the case of a 2D app, - // there will be the app + at least one system layer so this is still safe. - if (layers.size() < kVRAppLayerCount) + // TODO(achaulk): Figure out how to identify the current VR app for 2D app + // detection. + + size_t index; + // Skip all layers that we don't know about. + for (index = 0; index < layers.size(); index++) { + if (layers[index].type != 0xFFFFFFFF && layers[index].type != 0) + break; + } + + if (index == layers.size()) return ViewMode::Hidden; - if (vr_app != layers[0].appid || layers[0].appid == 0 || - layers[1].appid != layers[0].appid) { - if (layers[1].appid != layers[0].appid && layers[0].appid) { - // This might be a 2D app. - // If a dim layer exists afterwards it is much more likely that this is - // actually an app launch artifact. - for (size_t i = 2; i < layers.size(); i++) { - if (layers[i].is_extra_layer()) - return ViewMode::Hidden; - } - return ViewMode::App; - } + if (layers[index].type != 1) { + // We don't have a VR app layer? Abort. return ViewMode::Hidden; } - size_t index = kVRAppLayerCount; + // This is the VR app, ignore it. + index++; + // Now, find a dim layer if it exists. // If it does, ignore any layers behind it for visibility determination. for (size_t i = index; i < layers.size(); i++) { diff --git a/services/vr/vr_window_manager/surface_flinger_view.cpp b/services/vr/vr_window_manager/surface_flinger_view.cpp index 63bc14395f..2011967fd5 100644 --- a/services/vr/vr_window_manager/surface_flinger_view.cpp +++ b/services/vr/vr_window_manager/surface_flinger_view.cpp @@ -54,9 +54,7 @@ bool SurfaceFlingerView::GetTextures(const HwcCallback::Frame& frame, size_t start = 0; // Skip the second layer if it is from the VR app. if (!debug && skip_first_layer) { - start = 1; - if (layers[0].appid && layers[0].appid == layers[1].appid) - start = 2; + start = 2; } for (size_t i = start; i < layers.size(); ++i) { -- 2.11.0