summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/SurfaceFlinger.cpp
diff options
context:
space:
mode:
author Adithya Srinivasan <adsrini@google.com> 2021-05-21 22:50:56 +0000
committer Adithya Srinivasan <adsrini@google.com> 2021-06-02 17:38:39 +0000
commitac977e6de0cdebddebc2db0efd8cbec94c2bc996 (patch)
tree3a89d4d71ada965e0d7f758d0d7e4179412e7785 /services/surfaceflinger/SurfaceFlinger.cpp
parentf1804968780f975fa8fe361c480a15e8dd85d131 (diff)
SF - plumbing game mode for metrics (Part 1)
This change adds a game mode in the Layer metadata that gets updated every time a game app comes to the foreground. The gameMode is then set on the Layer based on the metadata and reparenting. The game mode will then be updated in TimeStats as a dimension (Part 2, in a separate CL later). Bug: 186025682 Test: libsurfaceflinger_unittest:GameModeTest Change-Id: I09deffc01d1b318cc08d0475611289dec055c190
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 881ee5b8f4..3f75af2908 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4018,6 +4018,13 @@ uint32_t SurfaceFlinger::setClientStateLocked(
std::optional<nsecs_t> dequeueBufferTimestamp;
if (what & layer_state_t::eMetadataChanged) {
dequeueBufferTimestamp = s.metadata.getInt64(METADATA_DEQUEUE_TIME);
+ auto gameMode = s.metadata.getInt32(METADATA_GAME_MODE, -1);
+ if (gameMode != -1) {
+ // The transaction will be received on the Task layer and needs to be applied to all
+ // child layers. Child layers that are added at a later point will obtain the game mode
+ // info through addChild().
+ layer->setGameModeForTree(gameMode);
+ }
if (layer->setMetadata(s.metadata)) flags |= eTraversalNeeded;
}
if (what & layer_state_t::eColorSpaceAgnosticChanged) {