Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78410012 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "vr_wm: Disable 2D mode until we can detect it correctly"

parents a82590a8 7b012531
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -294,9 +294,6 @@ 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_);
    OnVisibilityChanged(is_visible_);
  }
+16 −16
Original line number Diff line number Diff line
@@ -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)
    return ViewMode::Hidden;
  // TODO(achaulk): Figure out how to identify the current VR app for 2D app
  // detection.

  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;
  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 (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++) {
+1 −3
Original line number Diff line number Diff line
@@ -54,8 +54,6 @@ 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;
  }