SF: Remove manual enum stringification
Upgrade to scoped enums where applicable. Pull GameMode from TimeStats
into libgui to plumb it as an enum rather than int32_t.
Bug: 185536303
Test: libsurfaceflinger_unittest
Change-Id: I81fdd24805757ef953484055ee867684eb94fecf
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 041b439..47885a4 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -328,7 +328,6 @@
static bool isLayerFocusedBasedOnPriority(int32_t priority);
static void miniDumpHeader(std::string& result);
- static std::string frameRateCompatibilityString(FrameRateCompatibility compatibility);
// Provide unique string for each class type in the Layer hierarchy
virtual const char* getType() const = 0;
@@ -854,12 +853,12 @@
*/
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(int32_t parentGameMode);
- void setGameMode(int32_t gameMode) { mGameMode = gameMode; };
- int32_t getGameMode() const { return mGameMode; }
+ // Sets the GameMode for the tree rooted at this layer. A layer in the tree inherits this
+ // GameMode unless it (or an ancestor) has GAME_MODE_METADATA.
+ void setGameModeForTree(GameMode);
+
+ void setGameMode(GameMode gameMode) { mGameMode = gameMode; }
+ GameMode getGameMode() const { return mGameMode; }
virtual uid_t getOwnerUid() const { return mOwnerUid; }
@@ -1110,9 +1109,8 @@
// 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).
- int32_t mGameMode = 0;
+ // Game mode for the layer. Set by WindowManagerShell and recorded by SurfaceFlingerStats.
+ GameMode mGameMode = GameMode::Unsupported;
// A list of regions on this layer that should have blurs.
const std::vector<BlurRegion> getBlurRegions() const;