Loading services/core/java/com/android/server/wm/ActivityRecord.java +13 −61 Original line number Diff line number Diff line Loading @@ -339,7 +339,6 @@ import android.service.contentcapture.ActivityEvent; import android.service.dreams.DreamActivity; import android.service.voice.IVoiceInteractionSession; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.EventLog; import android.util.Log; import android.util.MergedConfiguration; Loading Loading @@ -2123,14 +2122,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (mWmService.mFlags.mInsetsDecoupledConfiguration) { // When the stable configuration is the default behavior, override for the legacy apps // without forward override flag. mResolveConfigHint.mUseOverrideInsetsForStableBounds = mResolveConfigHint.mUseOverrideInsetsForConfig = !info.isChangeEnabled(INSETS_DECOUPLED_CONFIGURATION_ENFORCED) && !info.isChangeEnabled( OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION); } else { // When the stable configuration is not the default behavior, forward overriding the // listed apps. mResolveConfigHint.mUseOverrideInsetsForStableBounds = mResolveConfigHint.mUseOverrideInsetsForConfig = info.isChangeEnabled(OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION); } Loading Loading @@ -8490,7 +8489,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mCompatDisplayInsets = new CompatDisplayInsets( mDisplayContent, this, letterboxedContainerBounds, mResolveConfigHint.mUseOverrideInsetsForStableBounds); mResolveConfigHint.mUseOverrideInsetsForConfig); } private void clearSizeCompatModeAttributes() { Loading Loading @@ -8570,8 +8569,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final int parentWindowingMode = newParentConfiguration.windowConfiguration.getWindowingMode(); applySizeOverrideIfNeeded(newParentConfiguration, parentWindowingMode, resolvedConfig); // Bubble activities should always fill their parent and should not be letterboxed. final boolean isFixedOrientationLetterboxAllowed = !getLaunchedFromBubble() && (parentWindowingMode == WINDOWING_MODE_MULTI_WINDOW Loading Loading @@ -8671,6 +8668,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A resolvedConfig.windowConfiguration.setMaxBounds(mTmpBounds); } applySizeOverrideIfNeeded(newParentConfiguration, parentWindowingMode, resolvedConfig); logAppCompatState(); } Loading @@ -8689,14 +8688,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (mDisplayContent == null) { return; } final Rect parentBounds = newParentConfiguration.windowConfiguration.getBounds(); int rotation = newParentConfiguration.windowConfiguration.getRotation(); if (rotation == ROTATION_UNDEFINED && !isFixedRotationTransforming()) { rotation = mDisplayContent.getRotation(); } if (!mResolveConfigHint.mUseOverrideInsetsForStableBounds || getCompatDisplayInsets() != null || isFloating(parentWindowingMode) || rotation == ROTATION_UNDEFINED) { if (!mResolveConfigHint.mUseOverrideInsetsForConfig || getCompatDisplayInsets() != null || shouldCreateCompatDisplayInsets() || isFloating(parentWindowingMode) || rotation == ROTATION_UNDEFINED) { // If the insets configuration decoupled logic is not enabled for the app, or the app // already has a compat override, or the context doesn't contain enough info to // calculate the override, skip the override. Loading @@ -8713,53 +8711,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } // Override starts here. final boolean rotated = (rotation == ROTATION_90 || rotation == ROTATION_270); final int dw = rotated ? mDisplayContent.mBaseDisplayHeight : mDisplayContent.mBaseDisplayWidth; final int dh = rotated ? mDisplayContent.mBaseDisplayWidth : mDisplayContent.mBaseDisplayHeight; final Rect nonDecorInsets = mDisplayContent.getDisplayPolicy() .getDecorInsetsInfo(rotation, dw, dh).mOverrideNonDecorInsets; // This should be the only place override the configuration for ActivityRecord. Override // the value if not calculated yet. Rect outAppBounds = inOutConfig.windowConfiguration.getAppBounds(); if (outAppBounds == null || outAppBounds.isEmpty()) { inOutConfig.windowConfiguration.setAppBounds(parentBounds); outAppBounds = inOutConfig.windowConfiguration.getAppBounds(); outAppBounds.inset(nonDecorInsets); } float density = inOutConfig.densityDpi; if (density == Configuration.DENSITY_DPI_UNDEFINED) { density = newParentConfiguration.densityDpi; } density *= DisplayMetrics.DENSITY_DEFAULT_SCALE; if (inOutConfig.screenWidthDp == Configuration.SCREEN_WIDTH_DP_UNDEFINED) { final int overrideScreenWidthDp = (int) (outAppBounds.width() / density + 0.5f); inOutConfig.screenWidthDp = overrideScreenWidthDp; } if (inOutConfig.screenHeightDp == Configuration.SCREEN_HEIGHT_DP_UNDEFINED) { final int overrideScreenHeightDp = (int) (outAppBounds.height() / density + 0.5f); inOutConfig.screenHeightDp = overrideScreenHeightDp; } if (inOutConfig.smallestScreenWidthDp == Configuration.SMALLEST_SCREEN_WIDTH_DP_UNDEFINED && parentWindowingMode == WINDOWING_MODE_FULLSCREEN) { // For the case of PIP transition and multi-window environment, the // smallestScreenWidthDp is handled already. Override only if the app is in // fullscreen. final DisplayInfo info = new DisplayInfo(mDisplayContent.getDisplayInfo()); mDisplayContent.computeSizeRanges(info, rotated, dw, dh, mDisplayContent.getDisplayMetrics().density, inOutConfig, true /* overrideConfig */); } // It's possible that screen size will be considered in different orientation with or // without considering the system bar insets. Override orientation as well. if (inOutConfig.orientation == ORIENTATION_UNDEFINED) { inOutConfig.orientation = (inOutConfig.screenWidthDp <= inOutConfig.screenHeightDp) ? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE; } computeConfigByResolveHint(inOutConfig, newParentConfiguration); } private void computeConfigByResolveHint(@NonNull Configuration resolvedConfig, Loading Loading @@ -9015,7 +8967,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (mDisplayContent == null) { return true; } if (!mResolveConfigHint.mUseOverrideInsetsForStableBounds) { if (!mResolveConfigHint.mUseOverrideInsetsForConfig) { // No insets should be considered any more. return true; } Loading @@ -9034,7 +8986,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final Task task = getTask(); task.calculateInsetFrames(outNonDecorBounds /* outNonDecorBounds */, outStableBounds /* outStableBounds */, parentBounds /* bounds */, di, mResolveConfigHint.mUseOverrideInsetsForStableBounds); mResolveConfigHint.mUseOverrideInsetsForConfig); final int orientationWithInsets = outStableBounds.height() >= outStableBounds.width() ? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE; // If orientation does not match the orientation with insets applied, then a Loading Loading @@ -9091,7 +9043,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A getResolvedOverrideConfiguration().windowConfiguration.getBounds(); final int stableBoundsOrientation = stableBounds.width() > stableBounds.height() ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT; final int parentOrientation = mResolveConfigHint.mUseOverrideInsetsForStableBounds final int parentOrientation = mResolveConfigHint.mUseOverrideInsetsForConfig ? stableBoundsOrientation : newParentConfig.orientation; // If the activity requires a different orientation (either by override or activityInfo), Loading @@ -9116,7 +9068,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return; } final Rect parentAppBounds = mResolveConfigHint.mUseOverrideInsetsForStableBounds final Rect parentAppBounds = mResolveConfigHint.mUseOverrideInsetsForConfig ? outNonDecorBounds : newParentConfig.windowConfiguration.getAppBounds(); // TODO(b/182268157): Explore using only one type of parentBoundsWithInsets, either app // bounds or stable bounds to unify aspect ratio logic. Loading services/core/java/com/android/server/wm/TaskFragment.java +26 −5 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ import static android.os.Process.INVALID_UID; import static android.os.Process.SYSTEM_UID; import static android.os.UserHandle.USER_NULL; import static android.view.Display.INVALID_DISPLAY; import static android.view.Surface.ROTATION_270; import static android.view.Surface.ROTATION_90; import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_FLAG_OPEN_BEHIND; Loading Loading @@ -2222,7 +2224,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { static class ConfigOverrideHint { @Nullable DisplayInfo mTmpOverrideDisplayInfo; @Nullable ActivityRecord.CompatDisplayInsets mTmpCompatInsets; boolean mUseOverrideInsetsForStableBounds; boolean mUseOverrideInsetsForConfig; } void computeConfigResourceOverrides(@NonNull Configuration inOutConfig, Loading Loading @@ -2255,11 +2257,11 @@ class TaskFragment extends WindowContainer<WindowContainer> { @NonNull Configuration parentConfig, @Nullable ConfigOverrideHint overrideHint) { DisplayInfo overrideDisplayInfo = null; ActivityRecord.CompatDisplayInsets compatInsets = null; boolean useOverrideInsetsForStableBounds = false; boolean useOverrideInsetsForConfig = false; if (overrideHint != null) { overrideDisplayInfo = overrideHint.mTmpOverrideDisplayInfo; compatInsets = overrideHint.mTmpCompatInsets; useOverrideInsetsForStableBounds = overrideHint.mUseOverrideInsetsForStableBounds; useOverrideInsetsForConfig = overrideHint.mUseOverrideInsetsForConfig; if (overrideDisplayInfo != null) { // Make sure the screen related configs can be computed by the provided // display info. Loading Loading @@ -2323,6 +2325,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { } } boolean insetsOverrideApplied = false; if (inOutConfig.screenWidthDp == Configuration.SCREEN_WIDTH_DP_UNDEFINED || inOutConfig.screenHeightDp == Configuration.SCREEN_HEIGHT_DP_UNDEFINED) { if (!customContainerPolicy && WindowConfiguration.isFloating(windowingMode)) { Loading @@ -2339,7 +2342,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { // The non decor inset are areas that could never be removed in Honeycomb. See // {@link WindowManagerPolicy#getNonDecorInsetsLw}. calculateInsetFrames(mTmpNonDecorBounds, mTmpStableBounds, mTmpFullBounds, di, useOverrideInsetsForStableBounds); useOverrideInsetsForConfig); } else { // Apply the given non-decor and stable insets to calculate the corresponding bounds // for screen size of configuration. Loading @@ -2356,8 +2359,21 @@ class TaskFragment extends WindowContainer<WindowContainer> { intersectWithInsetsIfFits(mTmpStableBounds, mTmpBounds, compatInsets.mStableInsets[rotation]); outAppBounds.set(mTmpNonDecorBounds); } else if (useOverrideInsetsForConfig) { final boolean rotated = (rotation == ROTATION_90 || rotation == ROTATION_270); final int dw = rotated ? mDisplayContent.mBaseDisplayHeight : mDisplayContent.mBaseDisplayWidth; final int dh = rotated ? mDisplayContent.mBaseDisplayWidth : mDisplayContent.mBaseDisplayHeight; final DisplayPolicy.DecorInsets.Info decorInsets = mDisplayContent .getDisplayPolicy().getDecorInsetsInfo(rotation, dw, dh); mTmpStableBounds.set(outAppBounds); mTmpStableBounds.inset(decorInsets.mOverrideConfigInsets); outAppBounds.inset(decorInsets.mOverrideNonDecorInsets); mTmpNonDecorBounds.set(outAppBounds); // Record the override apply to avoid duplicated check. insetsOverrideApplied = true; } else { // Set to app bounds because it excludes decor insets. mTmpNonDecorBounds.set(outAppBounds); mTmpStableBounds.set(outAppBounds); } Loading Loading @@ -2399,6 +2415,11 @@ class TaskFragment extends WindowContainer<WindowContainer> { // from the parent task would result in applications loaded wrong resource. inOutConfig.smallestScreenWidthDp = Math.min(inOutConfig.screenWidthDp, inOutConfig.screenHeightDp); } else if (insetsOverrideApplied) { // The smallest width should also consider insets. If the insets are overridden, // use the overridden value. inOutConfig.smallestScreenWidthDp = Math.min(inOutConfig.screenWidthDp, inOutConfig.screenHeightDp); } // otherwise, it will just inherit } Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +13 −61 Original line number Diff line number Diff line Loading @@ -339,7 +339,6 @@ import android.service.contentcapture.ActivityEvent; import android.service.dreams.DreamActivity; import android.service.voice.IVoiceInteractionSession; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.EventLog; import android.util.Log; import android.util.MergedConfiguration; Loading Loading @@ -2123,14 +2122,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (mWmService.mFlags.mInsetsDecoupledConfiguration) { // When the stable configuration is the default behavior, override for the legacy apps // without forward override flag. mResolveConfigHint.mUseOverrideInsetsForStableBounds = mResolveConfigHint.mUseOverrideInsetsForConfig = !info.isChangeEnabled(INSETS_DECOUPLED_CONFIGURATION_ENFORCED) && !info.isChangeEnabled( OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION); } else { // When the stable configuration is not the default behavior, forward overriding the // listed apps. mResolveConfigHint.mUseOverrideInsetsForStableBounds = mResolveConfigHint.mUseOverrideInsetsForConfig = info.isChangeEnabled(OVERRIDE_ENABLE_INSETS_DECOUPLED_CONFIGURATION); } Loading Loading @@ -8490,7 +8489,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mCompatDisplayInsets = new CompatDisplayInsets( mDisplayContent, this, letterboxedContainerBounds, mResolveConfigHint.mUseOverrideInsetsForStableBounds); mResolveConfigHint.mUseOverrideInsetsForConfig); } private void clearSizeCompatModeAttributes() { Loading Loading @@ -8570,8 +8569,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final int parentWindowingMode = newParentConfiguration.windowConfiguration.getWindowingMode(); applySizeOverrideIfNeeded(newParentConfiguration, parentWindowingMode, resolvedConfig); // Bubble activities should always fill their parent and should not be letterboxed. final boolean isFixedOrientationLetterboxAllowed = !getLaunchedFromBubble() && (parentWindowingMode == WINDOWING_MODE_MULTI_WINDOW Loading Loading @@ -8671,6 +8668,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A resolvedConfig.windowConfiguration.setMaxBounds(mTmpBounds); } applySizeOverrideIfNeeded(newParentConfiguration, parentWindowingMode, resolvedConfig); logAppCompatState(); } Loading @@ -8689,14 +8688,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (mDisplayContent == null) { return; } final Rect parentBounds = newParentConfiguration.windowConfiguration.getBounds(); int rotation = newParentConfiguration.windowConfiguration.getRotation(); if (rotation == ROTATION_UNDEFINED && !isFixedRotationTransforming()) { rotation = mDisplayContent.getRotation(); } if (!mResolveConfigHint.mUseOverrideInsetsForStableBounds || getCompatDisplayInsets() != null || isFloating(parentWindowingMode) || rotation == ROTATION_UNDEFINED) { if (!mResolveConfigHint.mUseOverrideInsetsForConfig || getCompatDisplayInsets() != null || shouldCreateCompatDisplayInsets() || isFloating(parentWindowingMode) || rotation == ROTATION_UNDEFINED) { // If the insets configuration decoupled logic is not enabled for the app, or the app // already has a compat override, or the context doesn't contain enough info to // calculate the override, skip the override. Loading @@ -8713,53 +8711,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } // Override starts here. final boolean rotated = (rotation == ROTATION_90 || rotation == ROTATION_270); final int dw = rotated ? mDisplayContent.mBaseDisplayHeight : mDisplayContent.mBaseDisplayWidth; final int dh = rotated ? mDisplayContent.mBaseDisplayWidth : mDisplayContent.mBaseDisplayHeight; final Rect nonDecorInsets = mDisplayContent.getDisplayPolicy() .getDecorInsetsInfo(rotation, dw, dh).mOverrideNonDecorInsets; // This should be the only place override the configuration for ActivityRecord. Override // the value if not calculated yet. Rect outAppBounds = inOutConfig.windowConfiguration.getAppBounds(); if (outAppBounds == null || outAppBounds.isEmpty()) { inOutConfig.windowConfiguration.setAppBounds(parentBounds); outAppBounds = inOutConfig.windowConfiguration.getAppBounds(); outAppBounds.inset(nonDecorInsets); } float density = inOutConfig.densityDpi; if (density == Configuration.DENSITY_DPI_UNDEFINED) { density = newParentConfiguration.densityDpi; } density *= DisplayMetrics.DENSITY_DEFAULT_SCALE; if (inOutConfig.screenWidthDp == Configuration.SCREEN_WIDTH_DP_UNDEFINED) { final int overrideScreenWidthDp = (int) (outAppBounds.width() / density + 0.5f); inOutConfig.screenWidthDp = overrideScreenWidthDp; } if (inOutConfig.screenHeightDp == Configuration.SCREEN_HEIGHT_DP_UNDEFINED) { final int overrideScreenHeightDp = (int) (outAppBounds.height() / density + 0.5f); inOutConfig.screenHeightDp = overrideScreenHeightDp; } if (inOutConfig.smallestScreenWidthDp == Configuration.SMALLEST_SCREEN_WIDTH_DP_UNDEFINED && parentWindowingMode == WINDOWING_MODE_FULLSCREEN) { // For the case of PIP transition and multi-window environment, the // smallestScreenWidthDp is handled already. Override only if the app is in // fullscreen. final DisplayInfo info = new DisplayInfo(mDisplayContent.getDisplayInfo()); mDisplayContent.computeSizeRanges(info, rotated, dw, dh, mDisplayContent.getDisplayMetrics().density, inOutConfig, true /* overrideConfig */); } // It's possible that screen size will be considered in different orientation with or // without considering the system bar insets. Override orientation as well. if (inOutConfig.orientation == ORIENTATION_UNDEFINED) { inOutConfig.orientation = (inOutConfig.screenWidthDp <= inOutConfig.screenHeightDp) ? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE; } computeConfigByResolveHint(inOutConfig, newParentConfiguration); } private void computeConfigByResolveHint(@NonNull Configuration resolvedConfig, Loading Loading @@ -9015,7 +8967,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (mDisplayContent == null) { return true; } if (!mResolveConfigHint.mUseOverrideInsetsForStableBounds) { if (!mResolveConfigHint.mUseOverrideInsetsForConfig) { // No insets should be considered any more. return true; } Loading @@ -9034,7 +8986,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final Task task = getTask(); task.calculateInsetFrames(outNonDecorBounds /* outNonDecorBounds */, outStableBounds /* outStableBounds */, parentBounds /* bounds */, di, mResolveConfigHint.mUseOverrideInsetsForStableBounds); mResolveConfigHint.mUseOverrideInsetsForConfig); final int orientationWithInsets = outStableBounds.height() >= outStableBounds.width() ? ORIENTATION_PORTRAIT : ORIENTATION_LANDSCAPE; // If orientation does not match the orientation with insets applied, then a Loading Loading @@ -9091,7 +9043,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A getResolvedOverrideConfiguration().windowConfiguration.getBounds(); final int stableBoundsOrientation = stableBounds.width() > stableBounds.height() ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT; final int parentOrientation = mResolveConfigHint.mUseOverrideInsetsForStableBounds final int parentOrientation = mResolveConfigHint.mUseOverrideInsetsForConfig ? stableBoundsOrientation : newParentConfig.orientation; // If the activity requires a different orientation (either by override or activityInfo), Loading @@ -9116,7 +9068,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return; } final Rect parentAppBounds = mResolveConfigHint.mUseOverrideInsetsForStableBounds final Rect parentAppBounds = mResolveConfigHint.mUseOverrideInsetsForConfig ? outNonDecorBounds : newParentConfig.windowConfiguration.getAppBounds(); // TODO(b/182268157): Explore using only one type of parentBoundsWithInsets, either app // bounds or stable bounds to unify aspect ratio logic. Loading
services/core/java/com/android/server/wm/TaskFragment.java +26 −5 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ import static android.os.Process.INVALID_UID; import static android.os.Process.SYSTEM_UID; import static android.os.UserHandle.USER_NULL; import static android.view.Display.INVALID_DISPLAY; import static android.view.Surface.ROTATION_270; import static android.view.Surface.ROTATION_90; import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_FLAG_OPEN_BEHIND; Loading Loading @@ -2222,7 +2224,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { static class ConfigOverrideHint { @Nullable DisplayInfo mTmpOverrideDisplayInfo; @Nullable ActivityRecord.CompatDisplayInsets mTmpCompatInsets; boolean mUseOverrideInsetsForStableBounds; boolean mUseOverrideInsetsForConfig; } void computeConfigResourceOverrides(@NonNull Configuration inOutConfig, Loading Loading @@ -2255,11 +2257,11 @@ class TaskFragment extends WindowContainer<WindowContainer> { @NonNull Configuration parentConfig, @Nullable ConfigOverrideHint overrideHint) { DisplayInfo overrideDisplayInfo = null; ActivityRecord.CompatDisplayInsets compatInsets = null; boolean useOverrideInsetsForStableBounds = false; boolean useOverrideInsetsForConfig = false; if (overrideHint != null) { overrideDisplayInfo = overrideHint.mTmpOverrideDisplayInfo; compatInsets = overrideHint.mTmpCompatInsets; useOverrideInsetsForStableBounds = overrideHint.mUseOverrideInsetsForStableBounds; useOverrideInsetsForConfig = overrideHint.mUseOverrideInsetsForConfig; if (overrideDisplayInfo != null) { // Make sure the screen related configs can be computed by the provided // display info. Loading Loading @@ -2323,6 +2325,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { } } boolean insetsOverrideApplied = false; if (inOutConfig.screenWidthDp == Configuration.SCREEN_WIDTH_DP_UNDEFINED || inOutConfig.screenHeightDp == Configuration.SCREEN_HEIGHT_DP_UNDEFINED) { if (!customContainerPolicy && WindowConfiguration.isFloating(windowingMode)) { Loading @@ -2339,7 +2342,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { // The non decor inset are areas that could never be removed in Honeycomb. See // {@link WindowManagerPolicy#getNonDecorInsetsLw}. calculateInsetFrames(mTmpNonDecorBounds, mTmpStableBounds, mTmpFullBounds, di, useOverrideInsetsForStableBounds); useOverrideInsetsForConfig); } else { // Apply the given non-decor and stable insets to calculate the corresponding bounds // for screen size of configuration. Loading @@ -2356,8 +2359,21 @@ class TaskFragment extends WindowContainer<WindowContainer> { intersectWithInsetsIfFits(mTmpStableBounds, mTmpBounds, compatInsets.mStableInsets[rotation]); outAppBounds.set(mTmpNonDecorBounds); } else if (useOverrideInsetsForConfig) { final boolean rotated = (rotation == ROTATION_90 || rotation == ROTATION_270); final int dw = rotated ? mDisplayContent.mBaseDisplayHeight : mDisplayContent.mBaseDisplayWidth; final int dh = rotated ? mDisplayContent.mBaseDisplayWidth : mDisplayContent.mBaseDisplayHeight; final DisplayPolicy.DecorInsets.Info decorInsets = mDisplayContent .getDisplayPolicy().getDecorInsetsInfo(rotation, dw, dh); mTmpStableBounds.set(outAppBounds); mTmpStableBounds.inset(decorInsets.mOverrideConfigInsets); outAppBounds.inset(decorInsets.mOverrideNonDecorInsets); mTmpNonDecorBounds.set(outAppBounds); // Record the override apply to avoid duplicated check. insetsOverrideApplied = true; } else { // Set to app bounds because it excludes decor insets. mTmpNonDecorBounds.set(outAppBounds); mTmpStableBounds.set(outAppBounds); } Loading Loading @@ -2399,6 +2415,11 @@ class TaskFragment extends WindowContainer<WindowContainer> { // from the parent task would result in applications loaded wrong resource. inOutConfig.smallestScreenWidthDp = Math.min(inOutConfig.screenWidthDp, inOutConfig.screenHeightDp); } else if (insetsOverrideApplied) { // The smallest width should also consider insets. If the insets are overridden, // use the overridden value. inOutConfig.smallestScreenWidthDp = Math.min(inOutConfig.screenWidthDp, inOutConfig.screenHeightDp); } // otherwise, it will just inherit } Loading