diff options
| author | 2022-11-10 19:28:59 +0000 | |
|---|---|---|
| committer | 2022-11-10 19:28:59 +0000 | |
| commit | 425d49fe25801ee87999277dfefabe93f99f6acf (patch) | |
| tree | f6446c9a5c413c5200cf207b373433d68cdbfd18 | |
| parent | 88ca3e242b0659a137ecb35338ee2b78181462e3 (diff) | |
| parent | 3f1d87579565ed34d71e27a614b4ba44c933e25d (diff) | |
Merge "Improve Split portrait gesture animation" into tm-qpr-dev am: 3f1d875795
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20365288
Change-Id: Iaa04fc0a2cf9311fd3dab23fe42bfd51084f8210
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2 files changed, 31 insertions, 13 deletions
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/PreviewPositionHelper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/PreviewPositionHelper.java index 40c8774d4f34..a790d89ac1ae 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/PreviewPositionHelper.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/PreviewPositionHelper.java @@ -61,26 +61,42 @@ public class PreviewPositionHelper { * Updates the matrix based on the provided parameters */ public void updateThumbnailMatrix(Rect thumbnailBounds, ThumbnailData thumbnailData, - int canvasWidth, int canvasHeight, int screenWidthPx, int taskbarSize, boolean isTablet, + int canvasWidth, int canvasHeight, int screenWidthPx, int screenHeightPx, + int taskbarSize, boolean isTablet, int currentRotation, boolean isRtl) { boolean isRotated = false; boolean isOrientationDifferent; - float fullscreenTaskWidth = screenWidthPx; - if (mSplitBounds != null && !mSplitBounds.appsStackedVertically) { - // For landscape, scale the width - float taskPercent = mDesiredStagePosition == STAGE_POSITION_TOP_OR_LEFT - ? mSplitBounds.leftTaskPercent - : (1 - (mSplitBounds.leftTaskPercent + mSplitBounds.dividerWidthPercent)); - // Scale landscape width to that of actual screen - fullscreenTaskWidth = screenWidthPx * taskPercent; - } int thumbnailRotation = thumbnailData.rotation; int deltaRotate = getRotationDelta(currentRotation, thumbnailRotation); RectF thumbnailClipHint = new RectF(); - float canvasScreenRatio = canvasWidth / fullscreenTaskWidth; - float scaledTaskbarSize = taskbarSize * canvasScreenRatio; - thumbnailClipHint.bottom = isTablet ? scaledTaskbarSize : 0; + + float scaledTaskbarSize = 0; + if (mSplitBounds != null) { + float fullscreenTaskWidth; + float fullscreenTaskHeight; + float canvasScreenRatio; + + float taskPercent; + if (!mSplitBounds.appsStackedVertically) { + // For landscape, scale the width + taskPercent = mDesiredStagePosition == STAGE_POSITION_TOP_OR_LEFT + ? mSplitBounds.leftTaskPercent + : (1 - (mSplitBounds.leftTaskPercent + mSplitBounds.dividerWidthPercent)); + // Scale landscape width to that of actual screen + fullscreenTaskWidth = screenWidthPx * taskPercent; + canvasScreenRatio = canvasWidth / fullscreenTaskWidth; + } else { + taskPercent = mDesiredStagePosition != STAGE_POSITION_TOP_OR_LEFT + ? mSplitBounds.leftTaskPercent + : (1 - (mSplitBounds.leftTaskPercent + mSplitBounds.dividerWidthPercent)); + // Scale landscape width to that of actual screen + fullscreenTaskHeight = screenHeightPx * taskPercent; + canvasScreenRatio = canvasHeight / fullscreenTaskHeight; + } + scaledTaskbarSize = taskbarSize * canvasScreenRatio; + thumbnailClipHint.bottom = isTablet ? scaledTaskbarSize : 0; + } float scale = thumbnailData.scale; final float thumbnailScale; diff --git a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionTaskView.kt b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionTaskView.kt index b682bd172837..d4991f90a86b 100644 --- a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionTaskView.kt +++ b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionTaskView.kt @@ -148,6 +148,7 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 val currentRotation: Int = display.rotation val displayWidthPx = windowMetrics.bounds.width() + val displayHeightPx = windowMetrics.bounds.height() val isRtl = layoutDirection == LAYOUT_DIRECTION_RTL val isTablet = isTablet(context) val taskbarSize = @@ -163,6 +164,7 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 measuredWidth, measuredHeight, displayWidthPx, + displayHeightPx, taskbarSize, isTablet, currentRotation, |