OSDN Git Service

vr_wm: Disable 2D mode until we can detect it correctly
authorAlbert Chaulk <achaulk@google.com>
Mon, 13 Mar 2017 21:03:29 +0000 (17:03 -0400)
committerAlbert Chaulk <achaulk@google.com>
Mon, 13 Mar 2017 22:29:01 +0000 (18:29 -0400)
Bug: 36036583
Test: Test w/ permissionsgen

Change-Id: Ie3ea8b162a0c40db8ee9cccb934a2a580a558937

services/vr/vr_window_manager/application.cpp
services/vr/vr_window_manager/shell_view.cpp
services/vr/vr_window_manager/surface_flinger_view.cpp

index 24087c9..dba797f 100644 (file)
@@ -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_);
   }
 }
index 10588b7..abe9c60 100644 (file)
@@ -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++) {
index 63bc143..2011967 100644 (file)
@@ -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) {