diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java index 324f0296c5ddf..96811ef09ac47 100644 --- a/services/core/java/com/android/server/wm/TaskFragment.java +++ b/services/core/java/com/android/server/wm/TaskFragment.java @@ -2061,9 +2061,15 @@ class TaskFragment extends WindowContainer { final boolean inPipTransition = windowingMode == WINDOWING_MODE_PINNED && !mTmpFullBounds.isEmpty() && mTmpFullBounds.equals(parentBounds); if (WindowConfiguration.isFloating(windowingMode) && !inPipTransition) { - // For floating tasks, calculate the smallest width from the bounds of the task + // For floating tasks, calculate the smallest width from the bounds of the + // task, because they should not be affected by insets. inOutConfig.smallestScreenWidthDp = (int) ( Math.min(mTmpFullBounds.width(), mTmpFullBounds.height()) / density); + } else if (isEmbedded()) { + // For embedded TFs, the smallest width should be updated. Otherwise, inherit + // from the parent task would result in applications loaded wrong resource. + inOutConfig.smallestScreenWidthDp = + Math.min(inOutConfig.screenWidthDp, inOutConfig.screenHeightDp); } // otherwise, it will just inherit }