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

Commit 3f38f263 authored by Tiger Huang's avatar Tiger Huang
Browse files

Call layoutAndAssignWindowLayersIfNeeded while holding mGlobalLock

This method should be protected by the lock because itself or its
downstream methods access fields which need to be protected by
mGlobalLock.

Bug: 118118435
Test: 1. Replace the pending transaction in WindowContainer with
         LockDebuggingTransaction in ag/9944628.
      2. Switch to the new insets mode.
      3. Let an app to control the system bars and see if system
         crashes.

Change-Id: I08b0fb88d6ceb51139d24f161269017312c0cd5f
parent 355062a8
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import static android.view.ViewRootImpl.NEW_INSETS_MODE_IME;
import static android.view.ViewRootImpl.NEW_INSETS_MODE_NONE;
import static android.view.ViewRootImpl.sNewInsetsMode;

import static com.android.server.wm.WindowManagerService.H.LAYOUT_AND_ASSIGN_WINDOW_LAYERS_IF_NEEDED;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.graphics.Point;
@@ -36,7 +38,6 @@ import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;

import com.android.internal.util.function.TriConsumer;
import com.android.internal.util.function.pooled.PooledLambda;
import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback;

import java.io.PrintWriter;
@@ -222,8 +223,8 @@ class InsetsSourceProvider {
            return;
        }
        mClientVisible = clientVisible;
        mDisplayContent.mWmService.mH.sendMessage(PooledLambda.obtainMessage(
                DisplayContent::layoutAndAssignWindowLayersIfNeeded, mDisplayContent));
        mDisplayContent.mWmService.mH.obtainMessage(
                LAYOUT_AND_ASSIGN_WINDOW_LAYERS_IF_NEEDED, mDisplayContent).sendToTarget();
        updateVisibility();
    }

+8 −0
Original line number Diff line number Diff line
@@ -4511,6 +4511,7 @@ public class WindowManagerService extends IWindowManager.Stub
        public static final int ANIMATION_FAILSAFE = 60;
        public static final int RECOMPUTE_FOCUS = 61;
        public static final int ON_POINTER_DOWN_OUTSIDE_FOCUS = 62;
        public static final int LAYOUT_AND_ASSIGN_WINDOW_LAYERS_IF_NEEDED = 63;

        /**
         * Used to denote that an integer field in a message will not be used.
@@ -4885,6 +4886,13 @@ public class WindowManagerService extends IWindowManager.Stub
                    }
                    break;
                }
                case LAYOUT_AND_ASSIGN_WINDOW_LAYERS_IF_NEEDED: {
                    synchronized (mGlobalLock) {
                        final DisplayContent displayContent = (DisplayContent) msg.obj;
                        displayContent.layoutAndAssignWindowLayersIfNeeded();
                    }
                    break;
                }
            }
            if (DEBUG_WINDOW_TRACE) {
                Slog.v(TAG_WM, "handleMessage: exit");