summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author chaviw <chaviw@google.com> 2020-08-03 11:33:30 -0700
committer chaviw <chaviw@google.com> 2020-08-07 10:56:58 -0700
commitc6ad8afa768607852a1ad2c937b4687e947d6fca (patch)
treeae0b6724af9b5c12818594c836fe3be1e606ccb8
parent63dd5e25c9ab1935199d08215f167114f1ff6f84 (diff)
Remove rotation and use flag useIdentityTransform for screenshots.
There's a lot of confusing logic where 90 and 270 rotation values need to be flipped to ensure the screenshot is taken the correct orientation. There's also confusion what useIdentityTransform means, especially if a non 0 rotation value is sent. The cases screenshot cares about is the following: 1. Take screenshot in current display orientation 2. Take screenshot with 0 rotation so the caller can handle rotating the screenshot themselves. With these two cases in mind, remove the rotation value passed in for screenshots. If useIdentityTransform is true, it will rotate the screenshot so it's in the 0 orientation. If useIdentityTransform is false, it will use the current display rotation. This simplifies the logic in DisplayRenderArea since it only needs to compute the rotation when useIdentityTransform is set. It also simplifies the caller logic since they no longer have to find the current display rotation to ensure the screenshot is taken in the current rotation. The callers can just request the screenshot with useIdentityTransform set to false. Test: adb shell screencap Test: Power + volume screenshot Test: Screen rotation Test: SurfaceFlinger_test Test: libsurfaceflinger_unittest Fixes: 135942984 Change-Id: I1da025c7340a11a719d4630da2469b281bddc6e9
-rw-r--r--libs/gui/LayerState.cpp10
-rw-r--r--libs/gui/include/gui/LayerState.h1
-rw-r--r--services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h6
-rw-r--r--services/surfaceflinger/CompositionEngine/src/Output.cpp2
-rw-r--r--services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp21
-rw-r--r--services/surfaceflinger/DisplayRenderArea.cpp70
-rw-r--r--services/surfaceflinger/DisplayRenderArea.h4
-rw-r--r--services/surfaceflinger/Layer.cpp8
-rw-r--r--services/surfaceflinger/RegionSamplingThread.cpp3
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp53
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h11
-rw-r--r--services/surfaceflinger/tests/LayerState_test.cpp2
-rw-r--r--services/surfaceflinger/tests/unittests/CompositionTest.cpp3
-rw-r--r--services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h9
14 files changed, 41 insertions, 162 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index b215756d56..9c0ad9d4e5 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -530,23 +530,17 @@ status_t DisplayCaptureArgs::write(Parcel& output) const {
status |= output.writeStrongBinder(displayToken) ?:
output.writeUint32(width) ?:
output.writeUint32(height) ?:
- output.writeBool(useIdentityTransform) ?:
- output.writeInt32(static_cast<int32_t>(rotation));
+ output.writeBool(useIdentityTransform);
return status;
}
status_t DisplayCaptureArgs::read(const Parcel& input) {
status_t status = CaptureArgs::read(input);
- int32_t rotationInt = 0;
-
status |= input.readStrongBinder(&displayToken) ?:
input.readUint32(&width) ?:
input.readUint32(&height) ?:
- input.readBool(&useIdentityTransform) ?:
- input.readInt32(&rotationInt);
-
- rotation = ui::toRotation(rotationInt);
+ input.readBool(&useIdentityTransform);
return status;
}
diff --git a/libs/gui/include/gui/LayerState.h b/libs/gui/include/gui/LayerState.h
index 5e1066ba68..bbf827f0cd 100644
--- a/libs/gui/include/gui/LayerState.h
+++ b/libs/gui/include/gui/LayerState.h
@@ -330,7 +330,6 @@ struct DisplayCaptureArgs : CaptureArgs {
uint32_t width{0};
uint32_t height{0};
bool useIdentityTransform{false};
- ui::Rotation rotation{ui::ROTATION_0};
status_t write(Parcel& output) const override;
status_t read(const Parcel& input) override;
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h
index 6cc90cb3ee..5c7f12dd3d 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h
@@ -80,10 +80,6 @@ public:
// The clip region, or visible region that is being rendered to
const Region& clip;
- // If true, the layer should use an identity transform for its position
- // transform. Used only by the captureScreen API call.
- const bool useIdentityTransform;
-
// If set to true, the layer should enable filtering when rendering.
const bool needsFiltering;
@@ -148,7 +144,6 @@ using LayerFESet = std::unordered_set<sp<LayerFE>, LayerFESpHash>;
static inline bool operator==(const LayerFE::ClientCompositionTargetSettings& lhs,
const LayerFE::ClientCompositionTargetSettings& rhs) {
return lhs.clip.hasSameRects(rhs.clip) &&
- lhs.useIdentityTransform == rhs.useIdentityTransform &&
lhs.needsFiltering == rhs.needsFiltering && lhs.isSecure == rhs.isSecure &&
lhs.supportsProtectedContent == rhs.supportsProtectedContent &&
lhs.clearRegion.hasSameRects(rhs.clearRegion) && lhs.viewport == rhs.viewport &&
@@ -170,7 +165,6 @@ static inline void PrintTo(const LayerFE::ClientCompositionTargetSettings& setti
*os << "ClientCompositionTargetSettings{";
*os << "\n .clip = \n";
PrintTo(settings.clip, os);
- *os << "\n .useIdentityTransform = " << settings.useIdentityTransform;
*os << "\n .needsFiltering = " << settings.needsFiltering;
*os << "\n .isSecure = " << settings.isSecure;
*os << "\n .supportsProtectedContent = " << settings.supportsProtectedContent;
diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp
index 09b3dd7053..670b969e17 100644
--- a/services/surfaceflinger/CompositionEngine/src/Output.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp
@@ -946,7 +946,6 @@ std::vector<LayerFE::LayerSettings> Output::generateClientCompositionRequests(
const auto& outputState = getState();
const Region viewportRegion(outputState.viewport);
- const bool useIdentityTransform = false;
bool firstLayer = true;
// Used when a layer clears part of the buffer.
Region stubRegion;
@@ -984,7 +983,6 @@ std::vector<LayerFE::LayerSettings> Output::generateClientCompositionRequests(
if (clientComposition || clearClientComposition) {
compositionengine::LayerFE::ClientCompositionTargetSettings targetSettings{
clip,
- useIdentityTransform,
layer->needsFiltering() || outputState.needsFiltering,
outputState.isSecure,
supportsProtectedContent,
diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
index 6ba06a632c..fdaf907e8a 100644
--- a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
@@ -3579,7 +3579,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers, clearsHWCLayersIfOpaqu
compositionengine::LayerFE::ClientCompositionTargetSettings layer1TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
false, /* needs filtering */
false, /* secure */
false, /* supports protected content */
@@ -3591,7 +3590,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers, clearsHWCLayersIfOpaqu
};
compositionengine::LayerFE::ClientCompositionTargetSettings layer2TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
false, /* needs filtering */
false, /* secure */
false, /* supports protected content */
@@ -3635,7 +3633,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
compositionengine::LayerFE::ClientCompositionTargetSettings layer0TargetSettings{
Region(Rect(10, 10, 20, 20)),
- false, /* identity transform */
false, /* needs filtering */
false, /* secure */
false, /* supports protected content */
@@ -3647,7 +3644,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
};
compositionengine::LayerFE::ClientCompositionTargetSettings layer1TargetSettings{
Region(Rect(0, 0, 30, 30)),
- false, /* identity transform */
false, /* needs filtering */
false, /* secure */
false, /* supports protected content */
@@ -3659,7 +3655,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
};
compositionengine::LayerFE::ClientCompositionTargetSettings layer2TargetSettings{
Region(Rect(0, 0, 40, 201)),
- false, /* identity transform */
false, /* needs filtering */
false, /* secure */
false, /* supports protected content */
@@ -3691,7 +3686,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
compositionengine::LayerFE::ClientCompositionTargetSettings layer0TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
true, /* needs filtering */
false, /* secure */
false, /* supports protected content */
@@ -3703,7 +3697,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
};
compositionengine::LayerFE::ClientCompositionTargetSettings layer1TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
false, /* needs filtering */
false, /* secure */
false, /* supports protected content */
@@ -3715,7 +3708,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
};
compositionengine::LayerFE::ClientCompositionTargetSettings layer2TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
false, /* needs filtering */
false, /* secure */
false, /* supports protected content */
@@ -3747,7 +3739,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
compositionengine::LayerFE::ClientCompositionTargetSettings layer0TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
true, /* needs filtering */
false, /* secure */
false, /* supports protected content */
@@ -3760,7 +3751,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
};
compositionengine::LayerFE::ClientCompositionTargetSettings layer1TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
true, /* needs filtering */
false, /* secure */
false, /* supports protected content */
@@ -3772,7 +3762,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
};
compositionengine::LayerFE::ClientCompositionTargetSettings layer2TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
true, /* needs filtering */
false, /* secure */
false, /* supports protected content */
@@ -3803,7 +3792,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
compositionengine::LayerFE::ClientCompositionTargetSettings layer0TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
false, /* needs filtering */
true, /* secure */
false, /* supports protected content */
@@ -3815,7 +3803,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
};
compositionengine::LayerFE::ClientCompositionTargetSettings layer1TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
false, /* needs filtering */
true, /* secure */
false, /* supports protected content */
@@ -3827,7 +3814,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
};
compositionengine::LayerFE::ClientCompositionTargetSettings layer2TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
false, /* needs filtering */
true, /* secure */
false, /* supports protected content */
@@ -3856,7 +3842,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
compositionengine::LayerFE::ClientCompositionTargetSettings layer0TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
false, /* needs filtering */
false, /* secure */
true, /* supports protected content */
@@ -3868,7 +3853,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
};
compositionengine::LayerFE::ClientCompositionTargetSettings layer1TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
false, /* needs filtering */
false, /* secure */
true, /* supports protected content */
@@ -3880,7 +3864,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
};
compositionengine::LayerFE::ClientCompositionTargetSettings layer2TargetSettings{
Region(kDisplayFrame),
- false, /* identity transform */
false, /* needs filtering */
false, /* secure */
true, /* supports protected content */
@@ -3972,7 +3955,6 @@ TEST_F(GenerateClientCompositionRequestsTest, handlesLandscapeModeSplitScreenReq
compositionengine::LayerFE::ClientCompositionTargetSettings leftLayerSettings{
Region(Rect(0, 0, 1000, 1000)),
- false, /* identity transform */
false, /* needs filtering */
true, /* secure */
true, /* supports protected content */
@@ -3990,7 +3972,6 @@ TEST_F(GenerateClientCompositionRequestsTest, handlesLandscapeModeSplitScreenReq
compositionengine::LayerFE::ClientCompositionTargetSettings rightLayerSettings{
Region(Rect(1000, 0, 2000, 1000)),
- false, /* identity transform */
false, /* needs filtering */
true, /* secure */
true, /* supports protected content */
@@ -4024,7 +4005,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
Region accumClearRegion(Rect(10, 11, 12, 13));
compositionengine::LayerFE::ClientCompositionTargetSettings layer2Settings{
Region(Rect(60, 40, 70, 80)).merge(Rect(40, 80, 70, 90)), /* visible region */
- false, /* identity transform */
false, /* needs filtering */
false, /* secure */
false, /* supports protected content */
@@ -4070,7 +4050,6 @@ TEST_F(GenerateClientCompositionRequestsTest_ThreeLayers,
Region accumClearRegion(Rect(10, 11, 12, 13));
compositionengine::LayerFE::ClientCompositionTargetSettings layer2Settings{
Region(Rect(50, 40, 70, 80)).merge(Rect(40, 80, 70, 90)), /* visible region */
- false, /* identity transform */
false, /* needs filtering */
false, /* secure */
false, /* supports protected content */
diff --git a/services/surfaceflinger/DisplayRenderArea.cpp b/services/surfaceflinger/DisplayRenderArea.cpp
index 4bae669d7c..d7157b1607 100644
--- a/services/surfaceflinger/DisplayRenderArea.cpp
+++ b/services/surfaceflinger/DisplayRenderArea.cpp
@@ -20,49 +20,14 @@
namespace android {
namespace {
-RenderArea::RotationFlags applyDeviceOrientation(RenderArea::RotationFlags rotation,
+RenderArea::RotationFlags applyDeviceOrientation(bool useIdentityTransform,
const DisplayDevice& display) {
- uint32_t inverseRotate90 = 0;
- uint32_t inverseReflect = 0;
-
- // Reverse the logical orientation.
- ui::Rotation logicalOrientation = display.getOrientation();
- if (logicalOrientation == ui::Rotation::Rotation90) {
- logicalOrientation = ui::Rotation::Rotation270;
- } else if (logicalOrientation == ui::Rotation::Rotation270) {
- logicalOrientation = ui::Rotation::Rotation90;
+ if (!useIdentityTransform) {
+ return RenderArea::RotationFlags::ROT_0;
}
- const ui::Rotation orientation = display.getPhysicalOrientation() + logicalOrientation;
-
- switch (orientation) {
- case ui::ROTATION_0:
- return rotation;
-
- case ui::ROTATION_90:
- inverseRotate90 = ui::Transform::ROT_90;
- inverseReflect = ui::Transform::ROT_180;
- break;
-
- case ui::ROTATION_180:
- inverseReflect = ui::Transform::ROT_180;
- break;
-
- case ui::ROTATION_270:
- inverseRotate90 = ui::Transform::ROT_90;
- break;
- }
-
- const uint32_t rotate90 = rotation & ui::Transform::ROT_90;
- uint32_t reflect = rotation & ui::Transform::ROT_180;
-
- // Apply reflection for double rotation.
- if (rotate90 & inverseRotate90) {
- reflect = ~reflect & ui::Transform::ROT_180;
- }
-
- return static_cast<RenderArea::RotationFlags>((rotate90 ^ inverseRotate90) |
- (reflect ^ inverseReflect));
+ const ui::Rotation orientation = display.getPhysicalOrientation() + display.getOrientation();
+ return ui::Transform::toRotationFlags(orientation);
}
} // namespace
@@ -70,22 +35,22 @@ RenderArea::RotationFlags applyDeviceOrientation(RenderArea::RotationFlags rotat
std::unique_ptr<RenderArea> DisplayRenderArea::create(wp<const DisplayDevice> displayWeak,
const Rect& sourceCrop, ui::Size reqSize,
ui::Dataspace reqDataSpace,
- RotationFlags rotation,
+ bool useIdentityTransform,
bool allowSecureLayers) {
if (auto display = displayWeak.promote()) {
// Using new to access a private constructor.
return std::unique_ptr<DisplayRenderArea>(
new DisplayRenderArea(std::move(display), sourceCrop, reqSize, reqDataSpace,
- rotation, allowSecureLayers));
+ useIdentityTransform, allowSecureLayers));
}
return nullptr;
}
DisplayRenderArea::DisplayRenderArea(sp<const DisplayDevice> display, const Rect& sourceCrop,
ui::Size reqSize, ui::Dataspace reqDataSpace,
- RotationFlags rotation, bool allowSecureLayers)
+ bool useIdentityTransform, bool allowSecureLayers)
: RenderArea(reqSize, CaptureFill::OPAQUE, reqDataSpace, display->getViewport(),
- allowSecureLayers, applyDeviceOrientation(rotation, *display)),
+ allowSecureLayers, applyDeviceOrientation(useIdentityTransform, *display)),
mDisplay(std::move(display)),
mSourceCrop(sourceCrop) {}
@@ -131,18 +96,11 @@ Rect DisplayRenderArea::getSourceCrop() const {
return mDisplay->getViewport();
}
- // If there is a source crop provided then it is assumed that the device
- // was in portrait orientation. This may not logically be true, so
- // correct for the orientation error by undoing the rotation
-
- ui::Rotation logicalOrientation = mDisplay->getOrientation();
- if (logicalOrientation == ui::Rotation::Rotation90) {
- logicalOrientation = ui::Rotation::Rotation270;
- } else if (logicalOrientation == ui::Rotation::Rotation270) {
- logicalOrientation = ui::Rotation::Rotation90;
- }
-
- const auto flags = ui::Transform::toRotationFlags(logicalOrientation);
+ // Correct for the orientation when the screen capture request contained
+ // useIdentityTransform. This will cause the rotation flag to be non 0 since
+ // it needs to rotate based on the screen orientation to allow the screenshot
+ // to be taken in the ROT_0 orientation
+ const auto flags = getRotationFlags();
int width = mDisplay->getViewport().getWidth();
int height = mDisplay->getViewport().getHeight();
ui::Transform rotation;
diff --git a/services/surfaceflinger/DisplayRenderArea.h b/services/surfaceflinger/DisplayRenderArea.h
index 8840973a5a..3478fc16c4 100644
--- a/services/surfaceflinger/DisplayRenderArea.h
+++ b/services/surfaceflinger/DisplayRenderArea.h
@@ -29,7 +29,7 @@ class DisplayRenderArea : public RenderArea {
public:
static std::unique_ptr<RenderArea> create(wp<const DisplayDevice>, const Rect& sourceCrop,
ui::Size reqSize, ui::Dataspace,
- RotationFlags rotation,
+ bool useIdentityTransform,
bool allowSecureLayers = true);
const ui::Transform& getTransform() const override;
@@ -43,7 +43,7 @@ public:
private:
DisplayRenderArea(sp<const DisplayDevice>, const Rect& sourceCrop, ui::Size reqSize,
- ui::Dataspace, RotationFlags rotation, bool allowSecureLayers = true);
+ ui::Dataspace, bool useIdentityTransform, bool allowSecureLayers = true);
const sp<const DisplayDevice> mDisplay;
const Rect mSourceCrop;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 89c95d2846..001eab7f96 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -611,7 +611,7 @@ const char* Layer::getDebugName() const {
// ---------------------------------------------------------------------------
std::optional<compositionengine::LayerFE::LayerSettings> Layer::prepareClientComposition(
- compositionengine::LayerFE::ClientCompositionTargetSettings& targetSettings) {
+ compositionengine::LayerFE::ClientCompositionTargetSettings& /* targetSettings */) {
if (!getCompositionState()) {
return {};
}
@@ -621,11 +621,7 @@ std::optional<compositionengine::LayerFE::LayerSettings> Layer::prepareClientCom
compositionengine::LayerFE::LayerSettings layerSettings;
layerSettings.geometry.boundaries = bounds;
- if (targetSettings.useIdentityTransform) {
- layerSettings.geometry.positionTransform = mat4();
- } else {
- layerSettings.geometry.positionTransform = getTransform().asMatrix4();
- }
+ layerSettings.geometry.positionTransform = getTransform().asMatrix4();
if (hasColorTransform()) {
layerSettings.colorTransform = getColorTransform();
diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp
index 17daadba02..255a1f2450 100644
--- a/services/surfaceflinger/RegionSamplingThread.cpp
+++ b/services/surfaceflinger/RegionSamplingThread.cpp
@@ -444,8 +444,7 @@ void RegionSamplingThread::captureSample() {
ScreenCaptureResults captureResults;
mFlinger.captureScreenCommon(std::move(renderAreaFuture), traverseLayers, buffer,
- false /* identityTransform */, true /* regionSampling */,
- captureResults);
+ true /* regionSampling */, captureResults);
std::vector<Descriptor> activeDescriptors;
for (const auto& descriptor : descriptors) {
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 9d9a4cfdb0..9ff57df572 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -5440,12 +5440,6 @@ status_t SurfaceFlinger::captureDisplay(const DisplayCaptureArgs& args,
if (!args.displayToken) return BAD_VALUE;
- auto renderAreaRotation = ui::Transform::toRotationFlags(args.rotation);
- if (renderAreaRotation == ui::Transform::ROT_INVALID) {
- ALOGE("%s: Invalid rotation: %s", __FUNCTION__, toCString(args.rotation));
- renderAreaRotation = ui::Transform::ROT_0;
- }
-
wp<DisplayDevice> displayWeak;
ui::LayerStack layerStack;
ui::Size reqSize(args.width, args.height);
@@ -5469,14 +5463,14 @@ status_t SurfaceFlinger::captureDisplay(const DisplayCaptureArgs& args,
RenderAreaFuture renderAreaFuture = promise::defer([=] {
return DisplayRenderArea::create(displayWeak, args.sourceCrop, reqSize, dataspace,
- renderAreaRotation, args.captureSecureLayers);
+ args.useIdentityTransform, args.captureSecureLayers);
});
auto traverseLayers = [this, layerStack](const LayerVector::Visitor& visitor) {
traverseLayersInLayerStack(layerStack, visitor);
};
return captureScreenCommon(std::move(renderAreaFuture), traverseLayers, reqSize,
- args.pixelFormat, args.useIdentityTransform, captureResults);
+ args.pixelFormat, captureResults);
}
status_t SurfaceFlinger::setSchedFifo(bool enabled) {
@@ -5523,7 +5517,6 @@ status_t SurfaceFlinger::captureDisplay(uint64_t displayOrLayerStack,
ui::LayerStack layerStack;
wp<DisplayDevice> displayWeak;
ui::Size size;
- ui::Transform::RotationFlags captureOrientation;
ui::Dataspace dataspace;
{
Mutex::Autolock lock(mStateLock);
@@ -5536,33 +5529,14 @@ status_t SurfaceFlinger::captureDisplay(uint64_t displayOrLayerStack,
size = display->getViewport().getSize();
- const auto orientation = display->getOrientation();
- captureOrientation = ui::Transform::toRotationFlags(orientation);
-
- switch (captureOrientation) {
- case ui::Transform::ROT_90:
- captureOrientation = ui::Transform::ROT_270;
- break;
-
- case ui::Transform::ROT_270:
- captureOrientation = ui::Transform::ROT_90;
- break;
-
- case ui::Transform::ROT_INVALID:
- ALOGE("%s: Invalid orientation: %s", __FUNCTION__, toCString(orientation));
- captureOrientation = ui::Transform::ROT_0;
- break;
-
- default:
- break;
- }
dataspace =
pickDataspaceFromColorMode(display->getCompositionDisplay()->getState().colorMode);
}
RenderAreaFuture renderAreaFuture = promise::defer([=] {
return DisplayRenderArea::create(displayWeak, Rect(), size,
- captureResults.capturedDataspace, captureOrientation,
+ captureResults.capturedDataspace,
+ false /* useIdentityTransform */,
false /* captureSecureLayers */);
});
@@ -5571,8 +5545,7 @@ status_t SurfaceFlinger::captureDisplay(uint64_t displayOrLayerStack,
};
return captureScreenCommon(std::move(renderAreaFuture), traverseLayers, size,
- ui::PixelFormat::RGBA_8888, false /* useIdentityTransform */,
- captureResults);
+ ui::PixelFormat::RGBA_8888, captureResults);
}
status_t SurfaceFlinger::captureLayers(const LayerCaptureArgs& args,
@@ -5681,13 +5654,12 @@ status_t SurfaceFlinger::captureLayers(const LayerCaptureArgs& args,
};
return captureScreenCommon(std::move(renderAreaFuture), traverseLayers, reqSize,
- args.pixelFormat, false, captureResults);
+ args.pixelFormat, captureResults);
}
status_t SurfaceFlinger::captureScreenCommon(RenderAreaFuture renderAreaFuture,
TraverseLayersFunction traverseLayers,
ui::Size bufferSize, ui::PixelFormat reqPixelFormat,
- bool useIdentityTransform,
ScreenCaptureResults& captureResults) {
ATRACE_CALL();
@@ -5700,13 +5672,12 @@ status_t SurfaceFlinger::captureScreenCommon(RenderAreaFuture renderAreaFuture,
1 /* layerCount */, usage, "screenshot");
return captureScreenCommon(std::move(renderAreaFuture), traverseLayers, buffer,
- useIdentityTransform, false /* regionSampling */, captureResults);
+ false /* regionSampling */, captureResults);
}
status_t SurfaceFlinger::captureScreenCommon(RenderAreaFuture renderAreaFuture,
TraverseLayersFunction traverseLayers,
- const sp<GraphicBuffer>& buffer,
- bool useIdentityTransform, bool regionSampling,
+ const sp<GraphicBuffer>& buffer, bool regionSampling,
ScreenCaptureResults& captureResults) {
const int uid = IPCThreadState::self()->getCallingUid();
const bool forSystem = uid == AID_GRAPHICS || uid == AID_SYSTEM;
@@ -5733,8 +5704,8 @@ status_t SurfaceFlinger::captureScreenCommon(RenderAreaFuture renderAreaFuture,
Mutex::Autolock lock(mStateLock);
renderArea->render([&] {
result = renderScreenImplLocked(*renderArea, traverseLayers, buffer.get(),
- useIdentityTransform, forSystem, &fd,
- regionSampling, captureResults);
+ forSystem, &fd, regionSampling,
+ captureResults);
});
return {result, fd};
@@ -5751,8 +5722,7 @@ status_t SurfaceFlinger::captureScreenCommon(RenderAreaFuture renderAreaFuture,
status_t SurfaceFlinger::renderScreenImplLocked(const RenderArea& renderArea,
TraverseLayersFunction traverseLayers,
- const sp<GraphicBuffer>& buffer,
- bool useIdentityTransform, bool forSystem,
+ const sp<GraphicBuffer>& buffer, bool forSystem,
int* outSyncFd, bool regionSampling,
ScreenCaptureResults& captureResults) {
ATRACE_CALL();
@@ -5810,7 +5780,6 @@ status_t SurfaceFlinger::renderScreenImplLocked(const RenderArea& renderArea,
Region clip(renderArea.getBounds());
compositionengine::LayerFE::ClientCompositionTargetSettings targetSettings{
clip,
- useIdentityTransform,
layer->needsFilteringForScreenshots(display.get(), transform) ||
renderArea.needsFiltering(),
renderArea.isSecure(),
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 6c00931941..2e85c1b85b 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -719,15 +719,12 @@ private:
status_t renderScreenImplLocked(const RenderArea& renderArea,
TraverseLayersFunction traverseLayers,
- const sp<GraphicBuffer>& buffer, bool useIdentityTransform,
- bool forSystem, int* outSyncFd, bool regionSampling,
- ScreenCaptureResults& captureResults);
+ const sp<GraphicBuffer>& buffer, bool forSystem, int* outSyncFd,
+ bool regionSampling, ScreenCaptureResults& captureResults);
status_t captureScreenCommon(RenderAreaFuture, TraverseLayersFunction, ui::Size bufferSize,
- ui::PixelFormat, bool useIdentityTransform,
- ScreenCaptureResults& captureResults);
+ ui::PixelFormat, ScreenCaptureResults& captureResults);
status_t captureScreenCommon(RenderAreaFuture, TraverseLayersFunction, const sp<GraphicBuffer>&,
- bool useIdentityTransform, bool regionSampling,
- ScreenCaptureResults& captureResults);
+ bool regionSampling, ScreenCaptureResults& captureResults);
sp<DisplayDevice> getDisplayByIdOrLayerStack(uint64_t displayOrLayerStack) REQUIRES(mStateLock);
sp<DisplayDevice> getDisplayByLayerStack(uint64_t layerStack) REQUIRES(mStateLock);
diff --git a/services/surfaceflinger/tests/LayerState_test.cpp b/services/surfaceflinger/tests/LayerState_test.cpp
index 8a49e77848..785c2c3bc9 100644
--- a/services/surfaceflinger/tests/LayerState_test.cpp
+++ b/services/surfaceflinger/tests/LayerState_test.cpp
@@ -34,7 +34,6 @@ TEST(LayerStateTest, ParcellingDisplayCaptureArgs) {
args.width = 10;
args.height = 20;
args.useIdentityTransform = true;
- args.rotation = ui::ROTATION_90;
Parcel p;
args.write(p);
@@ -51,7 +50,6 @@ TEST(LayerStateTest, ParcellingDisplayCaptureArgs) {
ASSERT_EQ(args.width, args2.width);
ASSERT_EQ(args.height, args2.height);
ASSERT_EQ(args.useIdentityTransform, args2.useIdentityTransform);
- ASSERT_EQ(args.rotation, args2.rotation);
}
TEST(LayerStateTest, ParcellingLayerCaptureArgs) {
diff --git a/services/surfaceflinger/tests/unittests/CompositionTest.cpp b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
index 48c4e18c62..6472428c55 100644
--- a/services/surfaceflinger/tests/unittests/CompositionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
@@ -233,7 +233,6 @@ void CompositionTest::captureScreenComposition() {
LayerCase::setupForScreenCapture(this);
const Rect sourceCrop(0, 0, DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT);
- constexpr bool useIdentityTransform = true;
constexpr bool forSystem = true;
constexpr bool regionSampling = false;
@@ -253,7 +252,7 @@ void CompositionTest::captureScreenComposition() {
int fd = -1;
status_t result =
mFlinger.renderScreenImplLocked(*renderArea, traverseLayers, mCaptureScreenBuffer.get(),
- useIdentityTransform, forSystem, &fd, regionSampling);
+ forSystem, &fd, regionSampling);
if (fd >= 0) {
close(fd);
}
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index 3941d4218f..345577d387 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -335,12 +335,11 @@ public:
auto renderScreenImplLocked(const RenderArea& renderArea,
SurfaceFlinger::TraverseLayersFunction traverseLayers,
- const sp<GraphicBuffer>& buffer, bool useIdentityTransform,
- bool forSystem, int* outSyncFd, bool regionSampling) {
+ const sp<GraphicBuffer>& buffer, bool forSystem, int* outSyncFd,
+ bool regionSampling) {
ScreenCaptureResults captureResults;
- return mFlinger->renderScreenImplLocked(renderArea, traverseLayers, buffer,
- useIdentityTransform, forSystem, outSyncFd,
- regionSampling, captureResults);
+ return mFlinger->renderScreenImplLocked(renderArea, traverseLayers, buffer, forSystem,
+ outSyncFd, regionSampling, captureResults);
}
auto traverseLayersInLayerStack(ui::LayerStack layerStack,