From: Yorke Lee Date: Tue, 10 Jan 2017 15:58:59 +0000 (-0800) Subject: Don't clamp override config to screen area for freeform task X-Git-Tag: android-x86-8.1-r1~5564^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f54f9da2c22384448a201c72008e1e7bb751d874;p=android-x86%2Fframeworks-base.git Don't clamp override config to screen area for freeform task Bug: 34180907 Test: run cts --module CtsDpiTestCases Test: run cts --module CtsContentTestCases Change-Id: I07d979e33c7fb623ab495b08ae5ae35b5e768526 --- diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java index a17cf3b79cab..6cfb25f3a3bf 100644 --- a/services/core/java/com/android/server/am/TaskRecord.java +++ b/services/core/java/com/android/server/am/TaskRecord.java @@ -1610,23 +1610,28 @@ final class TaskRecord extends ConfigurationContainer { boolean overrideWidth, boolean overrideHeight) { mTmpNonDecorBounds.set(bounds); mTmpStableBounds.set(bounds); - subtractNonDecorInsets( - mTmpNonDecorBounds, insetBounds != null ? insetBounds : bounds, - overrideWidth, overrideHeight); - subtractStableInsets( - mTmpStableBounds, insetBounds != null ? insetBounds : bounds, - overrideWidth, overrideHeight); - - // For calculating screenWidthDp, screenHeightDp, we use the stable inset screen area, - // i.e. the screen area without the system bars. - // Additionally task dimensions should not be bigger than its parents dimensions. + final Configuration parentConfig = getParent().getConfiguration(); config.unset(); final float density = parentConfig.densityDpi * DisplayMetrics.DENSITY_DEFAULT_SCALE; - config.screenWidthDp = - Math.min((int)(mTmpStableBounds.width() / density), parentConfig.screenWidthDp); - config.screenHeightDp = - Math.min((int)(mTmpStableBounds.height() / density), parentConfig.screenHeightDp); + final boolean isFloatingTask = mStack != null && StackId.tasksAreFloating(mStack.mStackId); + if (isFloatingTask) { + // Floating tasks should not be resized to the screen's bounds. + config.screenWidthDp = (int) (mTmpStableBounds.width() / density); + config.screenHeightDp = (int) (mTmpStableBounds.height() / density); + } else { + // For calculating screenWidthDp, screenWidthDp, we use the stable inset screen area, + // i.e. the screen area without the system bars. + // Additionally task dimensions should not be bigger than its parents dimensions. + subtractNonDecorInsets(mTmpNonDecorBounds, insetBounds != null ? insetBounds : bounds, + overrideWidth, overrideHeight); + subtractStableInsets(mTmpStableBounds, insetBounds != null ? insetBounds : bounds, + overrideWidth, overrideHeight); + config.screenWidthDp = Math.min( + (int) (mTmpStableBounds.width() / density), parentConfig.screenWidthDp); + config.screenHeightDp = Math.min( + (int) (mTmpStableBounds.height() / density), parentConfig.screenHeightDp); + } // TODO: Orientation? config.orientation = (config.screenWidthDp <= config.screenHeightDp)