From 73774c269d01fa9d552c497fcca8328b83ea1d15 Mon Sep 17 00:00:00 2001 From: Louis Chang Date: Thu, 26 May 2022 14:21:46 +0800 Subject: [PATCH] Restrict the smallest screen width dp of an embedded TF Or the smallest screen width dp could be the same as the display size. Bug: 230035382 Test: verify sw config of an embedded activity Change-Id: Ic085c6ed134c2787a26fd2b02b4345b04fb693e6 Merged-In: Ic085c6ed134c2787a26fd2b02b4345b04fb693e6 (cherry picked from commit 9cee26e261ca8506e96e0f02a94245f2b054e6d0) --- .../core/java/com/android/server/wm/TaskFragment.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java index 22df8b06e398b..3d2d9f5318fc9 100644 --- a/services/core/java/com/android/server/wm/TaskFragment.java +++ b/services/core/java/com/android/server/wm/TaskFragment.java @@ -2062,9 +2062,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 }