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

Commit e839278d authored by Tiger Huang's avatar Tiger Huang Committed by Automerger Merge Worker
Browse files

Merge "Apply the requested insets sources if possible" into rvc-dev am:...

Merge "Apply the requested insets sources if possible" into rvc-dev am: 5d717b85 am: b31b0fbd am: 0e6077e9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12055450

Change-Id: I369ebdab4b2cd362cc6632ed3e71b186d1247c34
parents 535afd5b 0e6077e9
Loading
Loading
Loading
Loading
+13 −1
Original line number Original line Diff line number Diff line
@@ -40,6 +40,7 @@ import android.util.ArraySet;
import android.util.Slog;
import android.util.Slog;
import android.view.InsetsSource;
import android.view.InsetsSource;
import android.view.InsetsState;
import android.view.InsetsState;
import android.view.InsetsState.InternalInsetsType;
import android.view.SurfaceControl;
import android.view.SurfaceControl;
import android.view.ThreadedRenderer;
import android.view.ThreadedRenderer;
import android.view.WindowInsets;
import android.view.WindowInsets;
@@ -480,7 +481,9 @@ class TaskSnapshotController {
                task.getTaskDescription().getBackgroundColor(), 255);
                task.getTaskDescription().getBackgroundColor(), 255);
        final LayoutParams attrs = mainWindow.getAttrs();
        final LayoutParams attrs = mainWindow.getAttrs();
        final InsetsPolicy insetsPolicy = mainWindow.getDisplayContent().getInsetsPolicy();
        final InsetsPolicy insetsPolicy = mainWindow.getDisplayContent().getInsetsPolicy();
        final InsetsState insetsState = insetsPolicy.getInsetsForDispatch(mainWindow);
        final InsetsState insetsState =
                new InsetsState(insetsPolicy.getInsetsForDispatch(mainWindow));
        mergeInsetsSources(insetsState, mainWindow.getRequestedInsetsState());
        final Rect systemBarInsets = getSystemBarInsets(mainWindow.getFrameLw(), insetsState);
        final Rect systemBarInsets = getSystemBarInsets(mainWindow.getFrameLw(), insetsState);
        final SystemBarBackgroundPainter decorPainter = new SystemBarBackgroundPainter(attrs.flags,
        final SystemBarBackgroundPainter decorPainter = new SystemBarBackgroundPainter(attrs.flags,
                attrs.privateFlags, attrs.systemUiVisibility, task.getTaskDescription(),
                attrs.privateFlags, attrs.systemUiVisibility, task.getTaskDescription(),
@@ -600,6 +603,15 @@ class TaskSnapshotController {
        return 0;
        return 0;
    }
    }


    static void mergeInsetsSources(InsetsState base, InsetsState other) {
        for (@InternalInsetsType int type = 0; type < InsetsState.SIZE; type++) {
            final InsetsSource source = other.peekSource(type);
            if (source != null) {
                base.addSource(source);
            }
        }
    }

    static Rect getSystemBarInsets(Rect frame, InsetsState state) {
    static Rect getSystemBarInsets(Rect frame, InsetsState state) {
        return state.calculateInsets(frame, null /* ignoringVisibilityState */,
        return state.calculateInsets(frame, null /* ignoringVisibilityState */,
                false /* isScreenRound */, false /* alwaysConsumeSystemBars */,
                false /* isScreenRound */, false /* alwaysConsumeSystemBars */,
+4 −1
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@ import static com.android.internal.policy.DecorView.STATUS_BAR_COLOR_VIEW_ATTRIB
import static com.android.internal.policy.DecorView.getNavigationBarRect;
import static com.android.internal.policy.DecorView.getNavigationBarRect;
import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_STARTING_WINDOW;
import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_STARTING_WINDOW;
import static com.android.server.wm.TaskSnapshotController.getSystemBarInsets;
import static com.android.server.wm.TaskSnapshotController.getSystemBarInsets;
import static com.android.server.wm.TaskSnapshotController.mergeInsetsSources;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;


@@ -243,7 +244,9 @@ class TaskSnapshotSurface implements StartingSurface {


            final InsetsPolicy insetsPolicy = topFullscreenOpaqueWindow.getDisplayContent()
            final InsetsPolicy insetsPolicy = topFullscreenOpaqueWindow.getDisplayContent()
                    .getInsetsPolicy();
                    .getInsetsPolicy();
            insetsState = insetsPolicy.getInsetsForDispatch(topFullscreenOpaqueWindow);
            insetsState =
                    new InsetsState(insetsPolicy.getInsetsForDispatch(topFullscreenOpaqueWindow));
            mergeInsetsSources(insetsState, topFullscreenOpaqueWindow.getRequestedInsetsState());
        }
        }
        try {
        try {
            final int res = session.addToDisplay(window, window.mSeq, layoutParams,
            final int res = session.addToDisplay(window, window.mSeq, layoutParams,