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

Commit d7988534 authored by Matthew Ng's avatar Matthew Ng
Browse files

Added missing lock and clean up locked function that wasn't locked

There was a missing lock that systemui would call to register a docked
stack listener. Since it was missing, it is assumed that two threads
went into a race condition which caused it to crash when handling begin
before finish broadcasts for the same DockedStackDividerController.
Also moved getDefaultDisplayContentLocked call that was not locked to a
locked area.

Change-Id: I3c7ef805024aaf0f5f7c4ab68fc779797114a038
Fixes: 62104210
Test: go/wm-smoke
parent 4c6a49ed
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -3816,20 +3816,22 @@ public class WindowManagerService extends IWindowManager.Stub
        long origId = Binder.clearCallingIdentity();

        try {
            final boolean rotationChanged;
            // TODO(multi-display): Update rotation for different displays separately.
            final DisplayContent displayContent = getDefaultDisplayContentLocked();
            final boolean rotationChanged;
            final int displayId;
            synchronized (mWindowMap) {
                final DisplayContent displayContent = getDefaultDisplayContentLocked();
                rotationChanged = displayContent.updateRotationUnchecked(
                        false /* inTransaction */);
                if (!rotationChanged || forceRelayout) {
                    getDefaultDisplayContentLocked().setLayoutNeeded();
                    displayContent.setLayoutNeeded();
                    mWindowPlacerLocked.performSurfacePlacement();
                }
                displayId = displayContent.getDisplayId();
            }

            if (rotationChanged || alwaysSendConfiguration) {
                sendNewConfiguration(displayContent.getDisplayId());
                sendNewConfiguration(displayId);
            }
        } finally {
            Binder.restoreCallingIdentity(origId);
@@ -6890,10 +6892,12 @@ public class WindowManagerService extends IWindowManager.Stub
                "registerDockedStackListener()")) {
            return;
        }
        synchronized (mWindowMap) {
            // TODO(multi-display): The listener is registered on the default display only.
            getDefaultDisplayContentLocked().mDividerControllerLocked.registerDockedStackListener(
                    listener);
        }
    }

    @Override
    public void registerPinnedStackListener(int displayId, IPinnedStackListener listener) {