libsurfaceflinger: fix screenshot permission check am: fc0b911090
am: 88f99396fd

Change-Id: I41c256f2b96bf0adbe7e7aa05828c3e4e1725ff5
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 4154d6a..609b15b 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4447,7 +4447,7 @@
     bool secureLayerIsVisible = false;
     for (const auto& layer : mDrawingState.layersSortedByZ) {
         const Layer::State& state(layer->getDrawingState());
-        if (layer->belongsToDisplay(hw->getLayerStack(), false) ||
+        if (!layer->belongsToDisplay(hw->getLayerStack(), false) ||
                 (state.z < minLayerZ || state.z > maxLayerZ)) {
             continue;
         }