[SurfaceFlinger] Fix screenshot orientation in landscape
Change I0f7db422399985a1ff17da3faa946ff0943e58f7 defined a reverse
mapping for use by screenshots, e.g. a 90 degree rotation would be
passed down to SurfaceFlinger as 270 degrees. Change
I644bff547bed7d24284b8a6e7899a567d1f4cddf accidentally removed this
mapping, so adding it back into SurfaceFlinger.
Bug: 133849373
Test: adb screencap when phone is in landscape
Change-Id: I9d12551587307fa9f8028e78649545064051b46e
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index dd75868..928bbb5 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -5606,6 +5606,11 @@
captureOrientation = fromSurfaceComposerRotation(
static_cast<ISurfaceComposer::Rotation>(display->getOrientation()));
+ if (captureOrientation == ui::Transform::orientation_flags::ROT_90) {
+ captureOrientation = ui::Transform::orientation_flags::ROT_270;
+ } else if (captureOrientation == ui::Transform::orientation_flags::ROT_270) {
+ captureOrientation = ui::Transform::orientation_flags::ROT_90;
+ }
*outDataspace =
pickDataspaceFromColorMode(display->getCompositionDisplay()->getState().colorMode);
}