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

Commit 08a30491 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Make sure display config is updated when cutout is changed

1. LocalDisplayAdapter.LocalDisplayDevice#updateDeviceInfoLocked
   posts to display thread when receiving onOverlayChanged. So
   the operation depends on it should run sequentially.

2. After updating latest display info, the cutout may affect
   the height of status bar, then it still needs to compute
   display config again after that for screenHeightDp.

Bug: 222572231
Test: Toggle different types of cutout in developer options,
      Either: rotate the display, there won't be a blank area
      or switch to another activity, there won't have another
      display config change CONFIG_SCREEN_SIZE.
Change-Id: I8bb53d846656c76666074c0dee0e3c1c8627e24b
parent 525ddc37
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -1814,10 +1814,14 @@ public class DisplayPolicy {
    /**
    /**
     * Called when the resource overlays change.
     * Called when the resource overlays change.
     */
     */
    public void onOverlayChangedLw() {
    void onOverlayChanged() {
        updateCurrentUserResources();
        updateCurrentUserResources();
        // Update the latest display size, cutout.
        mDisplayContent.updateDisplayInfo();
        // The height of status bar needs to update in case display cutout is changed.
        onConfigurationChanged();
        onConfigurationChanged();
        mSystemGestures.onConfigurationChanged();
        // The height of status bar can affect screen size configuration.
        mDisplayContent.reconfigureDisplayLocked();
    }
    }


    /**
    /**
+11 −7
Original line number Original line Diff line number Diff line
@@ -6967,14 +6967,18 @@ public class WindowManagerService extends IWindowManager.Stub
    }
    }


    public void onOverlayChanged() {
    public void onOverlayChanged() {
        // Post to display thread so it can get the latest display info.
        mH.post(() -> {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
            mRoot.forAllDisplays(displayContent -> {
                mAtmService.deferWindowLayout();
                displayContent.getDisplayPolicy().onOverlayChangedLw();
                try {
                displayContent.updateDisplayInfo();
                    mRoot.forAllDisplays(dc -> dc.getDisplayPolicy().onOverlayChanged());
            });
                } finally {
            requestTraversal();
                    mAtmService.continueWindowLayout();
                }
                }
            }
            }
        });
    }


    @Override
    @Override
    public Object getWindowManagerLock() {
    public Object getWindowManagerLock() {