SF: Refactor processDisplayChangesLocked()
This change introduces three new functions: * processAddedDisplay() * processRemovedDisplay() * processChangedDisplay() and refactors processDisplayChangesLocked(). Where code reuse is required the appropriate function is called. Context: SurfaceFlinger::processDisplayChangesLocked() is a 150 line function, which does a non-trivial iteration of mCurrentState and mDisplayState, detects added, removed and changed displays and executes the corresponding logic to handle the changes. Currently if the surface of a display is different in curr and drawing state the code is destroying and recreatig the display object. The logic for display (re)creation is reused by playing with the iterator (skipping i++) and modifying the iterated collection (mDrawingState). This makes the code unnecessary complex and unreadable. Bug: 143451809 Test: flash device and check it boots Test: atest libsurfaceflinger_unittest Change-Id: I03afda7c1807ab36f8e03e7a4e43c804b3199149 (cherry picked from commit ae685593)
Loading
Please register or sign in to comment