surfaceflinger: add install orientation to DisplayDevice

Rather than querying it from SurfaceFlinger, initialize
DisplayDevice with the install orientation.

Bug: 113041375
Test: take screenshot, rotate screen, screencap
Change-Id: Ibffe47033276e938388af775749c56f170fe8c77
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 328724b..4ef66d5 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2438,14 +2438,18 @@
         nativeWindow->setSwapInterval(nativeWindow.get(), 0);
     }
 
+    const int displayInstallOrientation = state.type == DisplayDevice::DISPLAY_PRIMARY ?
+        primaryDisplayOrientation : DisplayState::eOrientationDefault;
+
     // virtual displays are always considered enabled
     auto initialPowerMode = state.isVirtual() ? HWC_POWER_MODE_NORMAL : HWC_POWER_MODE_OFF;
 
     sp<DisplayDevice> display =
             new DisplayDevice(this, state.type, displayId, state.isSecure, displayToken,
                               nativeWindow, dispSurface, std::move(renderSurface), displayWidth,
-                              displayHeight, hasWideColorGamut, hdrCapabilities,
-                              supportedPerFrameMetadata, hwcColorModes, initialPowerMode);
+                              displayHeight, displayInstallOrientation, hasWideColorGamut,
+                              hdrCapabilities, supportedPerFrameMetadata, hwcColorModes,
+                              initialPowerMode);
 
     if (maxFrameBufferAcquiredBuffers >= 3) {
         nativeWindowSurface->preallocateBuffers();
@@ -5093,7 +5097,7 @@
             reqHeight = uint32_t(display->getViewport().height());
         }
 
-        // XXX primaryDisplayOrientation is ignored
+        // XXX display->getInstallOrientation() is ignored
     }
 
     DisplayRenderArea renderArea(display, sourceCrop, reqWidth, reqHeight, renderAreaRotation);