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/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index cd86f81..9a35bca 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -218,6 +218,7 @@
std::unique_ptr<RE::Surface> renderSurface,
int displayWidth,
int displayHeight,
+ int displayInstallOrientation,
bool hasWideColorGamut,
const HdrCapabilities& hdrCapabilities,
const int32_t supportedPerFrameMetadata,
@@ -233,6 +234,7 @@
mSurface{std::move(renderSurface)},
mDisplayWidth(displayWidth),
mDisplayHeight(displayHeight),
+ mDisplayInstallOrientation(displayInstallOrientation),
mPageFlipCount(0),
mIsSecure(isSecure),
mLayerStack(NO_LAYER_STACK),
@@ -604,9 +606,8 @@
// need to take care of primary display rotation for mGlobalTransform
// for case if the panel is not installed aligned with device orientation
if (mType == DisplayType::DISPLAY_PRIMARY) {
- int primaryDisplayOrientation = SurfaceFlinger::primaryDisplayOrientation;
DisplayDevice::orientationToTransfrom(
- (orientation + primaryDisplayOrientation) % (DisplayState::eOrientation270 + 1),
+ (orientation + mDisplayInstallOrientation) % (DisplayState::eOrientation270 + 1),
w, h, &R);
}