Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 786c2606 authored by Lingyu Feng's avatar Lingyu Feng
Browse files

Send topology update to DM when WM registers DisplayListener

When WindowManagerService is initialized after DisplayManagerService
sends onDisplayAdded(), the topology update for non-default displays
will not be sent from WM to DM when those displays are added. This CL
fixed this issue by sending the topology update for a non-default
display when WM register DisplayListener.

Bug: 413523112
Test: manaually
Flag: com.android.server.display.feature.flags.enable_display_content_mode_management
Change-Id: I7efccc272b726eb45439daa5551e2df9c033f61d
parent a62492e9
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -1203,6 +1203,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            addChild(displayContent, POSITION_BOTTOM);
            if (displayContent.mDisplayId == DEFAULT_DISPLAY) {
                mDefaultDisplay = displayContent;
            } else {
                setShouldShowSystemDecorationsForNewDisplay(displayContent);
            }
        }

@@ -2775,14 +2777,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                return;
            }

            if (ENABLE_DISPLAY_CONTENT_MODE_MANAGEMENT.isTrue()) {
                display.updateShouldShowSystemDecorations();

                final boolean inTopology = mWindowManager.mDisplayWindowSettings
                        .shouldShowSystemDecorsLocked(display);
                mWmService.mDisplayManagerInternal.onDisplayBelongToTopologyChanged(displayId,
                        inTopology);
            }
            setShouldShowSystemDecorationsForNewDisplay(display);

            startSystemDecorations(display, "displayAdded");

@@ -2792,6 +2787,16 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        }
    }

    private void setShouldShowSystemDecorationsForNewDisplay(DisplayContent displayContent) {
        if (ENABLE_DISPLAY_CONTENT_MODE_MANAGEMENT.isTrue()) {
            displayContent.updateShouldShowSystemDecorations();
            final boolean inTopology = mWindowManager.mDisplayWindowSettings
                    .shouldShowSystemDecorsLocked(displayContent);
            mWmService.mDisplayManagerInternal.onDisplayBelongToTopologyChanged(
                    displayContent.mDisplayId, inTopology);
        }
    }

    void startSystemDecorations(final DisplayContent displayContent, String reason) {
        // Do not start home before booting, or it may accidentally finish booting before it
        // starts. Instead, we expect home activities to be launched when the system is ready