fix dumpsys Layer name when using multiple displays

Bug: 7288401
Change-Id: I14beeef58fac5270cef3b611e18c163060efe6c3
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 1103175..8367417 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2333,7 +2333,7 @@
             hwc.initCheck()==NO_ERROR ? "present" : "not present",
                     (mDebugDisableHWC || mDebugRegion) ? "disabled" : "enabled");
     result.append(buffer);
-    hwc.dump(result, buffer, SIZE, hw->getVisibleLayersSortedByZ());
+    hwc.dump(result, buffer, SIZE);
 
     /*
      * Dump gralloc state
@@ -2342,6 +2342,11 @@
     alloc.dump(result);
 }
 
+const Vector< sp<LayerBase> >&
+SurfaceFlinger::getLayerSortedByZForHwcDisplay(int disp) {
+    return getDisplayDevice( getBuiltInDisplay(disp) )->getVisibleLayersSortedByZ();
+}
+
 bool SurfaceFlinger::startDdmConnection()
 {
     void* libddmconnection_dso =