Skip to content

Commit 4640bfb

Browse files
Tiger Huangandroid-build-merge-worker-robot
authored andcommitted
Merge "Apply the requested insets sources if possible" into rvc-dev am: 5d717b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12055450 Change-Id: Iab526e2c30ec0dea3872f18a7123615d0d0e9c62
2 parents e2829e9 + 5d717b8 commit 4640bfb

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

services/core/java/com/android/server/wm/TaskSnapshotController.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import android.util.Slog;
4141
import android.view.InsetsSource;
4242
import android.view.InsetsState;
43+
import android.view.InsetsState.InternalInsetsType;
4344
import android.view.SurfaceControl;
4445
import android.view.ThreadedRenderer;
4546
import android.view.WindowInsets;
@@ -480,7 +481,9 @@ private TaskSnapshot drawAppThemeSnapshot(Task task) {
480481
task.getTaskDescription().getBackgroundColor(), 255);
481482
final LayoutParams attrs = mainWindow.getAttrs();
482483
final InsetsPolicy insetsPolicy = mainWindow.getDisplayContent().getInsetsPolicy();
483-
final InsetsState insetsState = insetsPolicy.getInsetsForDispatch(mainWindow);
484+
final InsetsState insetsState =
485+
new InsetsState(insetsPolicy.getInsetsForDispatch(mainWindow));
486+
mergeInsetsSources(insetsState, mainWindow.getRequestedInsetsState());
484487
final Rect systemBarInsets = getSystemBarInsets(mainWindow.getFrameLw(), insetsState);
485488
final SystemBarBackgroundPainter decorPainter = new SystemBarBackgroundPainter(attrs.flags,
486489
attrs.privateFlags, attrs.systemUiVisibility, task.getTaskDescription(),
@@ -600,6 +603,15 @@ private int getSystemUiVisibility(Task task) {
600603
return 0;
601604
}
602605

606+
static void mergeInsetsSources(InsetsState base, InsetsState other) {
607+
for (@InternalInsetsType int type = 0; type < InsetsState.SIZE; type++) {
608+
final InsetsSource source = other.peekSource(type);
609+
if (source != null) {
610+
base.addSource(source);
611+
}
612+
}
613+
}
614+
603615
static Rect getSystemBarInsets(Rect frame, InsetsState state) {
604616
return state.calculateInsets(frame, null /* ignoringVisibilityState */,
605617
false /* isScreenRound */, false /* alwaysConsumeSystemBars */,

services/core/java/com/android/server/wm/TaskSnapshotSurface.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import static com.android.internal.policy.DecorView.getNavigationBarRect;
4343
import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_STARTING_WINDOW;
4444
import static com.android.server.wm.TaskSnapshotController.getSystemBarInsets;
45+
import static com.android.server.wm.TaskSnapshotController.mergeInsetsSources;
4546
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
4647
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
4748

@@ -243,7 +244,9 @@ static TaskSnapshotSurface create(WindowManagerService service, ActivityRecord a
243244

244245
final InsetsPolicy insetsPolicy = topFullscreenOpaqueWindow.getDisplayContent()
245246
.getInsetsPolicy();
246-
insetsState = insetsPolicy.getInsetsForDispatch(topFullscreenOpaqueWindow);
247+
insetsState =
248+
new InsetsState(insetsPolicy.getInsetsForDispatch(topFullscreenOpaqueWindow));
249+
mergeInsetsSources(insetsState, topFullscreenOpaqueWindow.getRequestedInsetsState());
247250
}
248251
try {
249252
final int res = session.addToDisplay(window, window.mSeq, layoutParams,

0 commit comments

Comments
 (0)