[sf] use snapshots to update layer history
Avoid directly accessing layer drawing state from layer
history, instead provide a snapshot of the layer data
needed.
Test: atest android.graphics.cts.MatchContentFrameRateTest android.graphics.cts.SetFrameRateTest
Bug: 238781169
Change-Id: I120e89cca70beb9811a8ee9c5c3203f2a5cfabb4
diff --git a/services/surfaceflinger/FrontEnd/LayerLifecycleManager.cpp b/services/surfaceflinger/FrontEnd/LayerLifecycleManager.cpp
index 360a0a9..33cc429 100644
--- a/services/surfaceflinger/FrontEnd/LayerLifecycleManager.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerLifecycleManager.cpp
@@ -187,6 +187,10 @@
continue;
}
+ if (transaction.flags & ISurfaceComposer::eAnimation) {
+ layer->changes |= RequestedLayerState::Changes::Animation;
+ }
+
uint32_t oldParentId = layer->parentId;
uint32_t oldRelativeParentId = layer->relativeParentId;
uint32_t oldTouchCropId = layer->touchCropId;
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshot.h b/services/surfaceflinger/FrontEnd/LayerSnapshot.h
index e069a63..6fb2f57 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshot.h
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshot.h
@@ -90,6 +90,7 @@
scheduler::LayerInfo::FrameRate frameRate;
ui::Transform::RotationFlags fixedTransformHint;
bool handleSkipScreenshotFlag = false;
+ int32_t frameRateSelectionPriority;
LayerHierarchy::TraversalPath mirrorRootPath;
bool unreachable = true;
ChildState childState;
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
index 344dab4..3698943 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
@@ -773,6 +773,7 @@
snapshot.layerOpaqueFlagSet =
(requested.flags & layer_state_t::eLayerOpaque) == layer_state_t::eLayerOpaque;
snapshot.cachingHint = requested.cachingHint;
+ snapshot.frameRateSelectionPriority = requested.frameRateSelectionPriority;
}
if (forceUpdate || snapshot.changes.any(RequestedLayerState::Changes::Content)) {
diff --git a/services/surfaceflinger/FrontEnd/RequestedLayerState.h b/services/surfaceflinger/FrontEnd/RequestedLayerState.h
index 8b475a3..6f5485d 100644
--- a/services/surfaceflinger/FrontEnd/RequestedLayerState.h
+++ b/services/surfaceflinger/FrontEnd/RequestedLayerState.h
@@ -53,6 +53,7 @@
VisibleRegion = 1u << 14,
Buffer = 1u << 15,
SidebandStream = 1u << 16,
+ Animation = 1u << 17,
};
static Rect reduce(const Rect& win, const Region& exclude);
RequestedLayerState(const LayerCreationArgs&);