[flexiglass] Overrides some SysUiState flags.
SysUiState is a central holder of state flags for a lot of System UI, it models state as a collection of "flags" where each flag has a unique integer ID and either a true or false value. The internal modeling uses bitwise operations to keep that state, likely for legacy performance reasons that have since become more Cargo Cult than reality. While it's true that Flexiglass' SceneContainerStartable already actively hydrated SysUiState flags related to current scene and scene switching (for example: shade visible, bouncher showing, etc.), there are other non-Flexiglass classes who also write values for the same flags and, since those classes don't read their own state from Flexiglass, they often provide incorrect state to SysUiState, leading to the current bug related to back navigation from the bouncer. While the full long-term approach is to eliminate SysUiState and convert its state to a collection of repositories and interactors, such a change would be large and risky. This is captured in b/322510930. Instead, a shorter-term approach is used by this CL. We introduce a "plugin" class that knows about Flexiglass and provides "overrides" for flag values. When any other class in the codebase attempts to write values for certain flags in SysUiState, the plugin is consulted to check if Flexiglass has a different value and, if so, the different value is maintained. Test: manually verified, together with the followup CL on this chain, that the bouncer scene's back gesture and button (in 3-button nav mode) actually works as intended - before this CL, there was no back affordance at all. Test: unit tests updated. Bug: 322518343 Bug: 303131743 Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT Change-Id: I3bf55f10f98fe61dfac689959b6655fecc3c3c62
Loading
Please register or sign in to comment