[sf] Avoid rounded corners without EGL_EXT_protected_content with new frontend
Override the rounded corner state in the layer snapshots if the device
doesn't support EGL_EXT_protected_content. This is passed in via a new
arg to LayerSnapshotBuilder.
Test: libsurfaceflinger_unittest
Fixes: 196271643
Change-Id: I8cbe6ea2818305c93494177df239381b0d02b464
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
index 23cfe928..f7b685d 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
@@ -854,8 +854,9 @@
}
if (forceUpdate || snapshot.clientChanges & layer_state_t::eCornerRadiusChanged ||
- snapshot.changes.any(RequestedLayerState::Changes::Geometry)) {
- updateRoundedCorner(snapshot, requested, parentSnapshot);
+ snapshot.changes.any(RequestedLayerState::Changes::Geometry |
+ RequestedLayerState::Changes::BufferUsageFlags)) {
+ updateRoundedCorner(snapshot, requested, parentSnapshot, args);
}
if (forceUpdate || snapshot.clientChanges & layer_state_t::eShadowRadiusChanged ||
@@ -886,7 +887,12 @@
void LayerSnapshotBuilder::updateRoundedCorner(LayerSnapshot& snapshot,
const RequestedLayerState& requested,
- const LayerSnapshot& parentSnapshot) {
+ const LayerSnapshot& parentSnapshot,
+ const Args& args) {
+ if (args.skipRoundCornersWhenProtected && requested.isProtected()) {
+ snapshot.roundedCorner = RoundedCornerState();
+ return;
+ }
snapshot.roundedCorner = RoundedCornerState();
RoundedCornerState parentRoundedCorner;
if (parentSnapshot.roundedCorner.hasRoundedCorners()) {