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
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 66d7018..af26045 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -847,6 +847,13 @@
*/
bool hasInputInfo() const;
+ // Sets the parent's gameMode for this layer and all its children. Parent's gameMode is applied
+ // only to layers that do not have the GAME_MODE_METADATA set by WMShell. Any layer(along with
+ // its children) that has the metadata set will use the gameMode from the metadata.
+ void setGameModeForTree(int parentGameMode);
+ void setGameMode(int gameMode) { mGameMode = gameMode; };
+ int getGameMode() const { return mGameMode; }
+
virtual uid_t getOwnerUid() const { return mOwnerUid; }
pid_t getOwnerPid() { return mOwnerPid; }
@@ -1089,6 +1096,10 @@
// shadow radius is the set shadow radius, otherwise its the parent's shadow radius.
float mEffectiveShadowRadius = 0.f;
+ // Game mode for the layer. Set by WindowManagerShell, game mode is used in
+ // metrics(SurfaceFlingerStats).
+ int mGameMode = 0;
+
// A list of regions on this layer that should have blurs.
const std::vector<BlurRegion> getBlurRegions() const;
};