Fix display settings persistence with LRU cache.
Rotation and density settings for external or simulated displays were not being persisted across reboots. This was caused by an overly aggressive cleanup mechanism that would remove settings for displays that were only temporarily disconnected, such as during a device reboot. This change replaces the ArrayMap in DisplayWindowSettingsProvider with an LruCache to manage display settings. This aligns with the persistence strategy used by DisplayManager's DisplayTopologyXmlStore, ensuring that the settings for the 100 most recently used displays are retained. When the cache limit is reached, the least recently used setting is evicted. This prevents the settings file from growing indefinitely while correctly preserving settings for active and recently used displays across reboots. The previous removeStaleDisplaySettingsLocked method is now obsolete and has been removed. Bug: 397398590 Flag: EXEMPT bug fix Test: atest WmTests:DisplayWindowSettingsProviderTests Change-Id: I6bf2a0312403ebda10194bc76fe3e443d50f664b
Loading
Please register or sign in to comment