Merge "Fix TaskView cropping for transient taskbar" into tm-qpr-dev
This commit is contained in:
@@ -33,8 +33,6 @@ public class PreviewPositionHelper {
|
||||
*/
|
||||
public static final int STAGE_POSITION_BOTTOM_OR_RIGHT = 1;
|
||||
|
||||
// Contains the portion of the thumbnail that is unclipped when fullscreen progress = 1.
|
||||
private final RectF mClippedInsets = new RectF();
|
||||
private final Matrix mMatrix = new Matrix();
|
||||
private boolean mIsOrientationChanged;
|
||||
private SplitBounds mSplitBounds;
|
||||
@@ -70,33 +68,6 @@ public class PreviewPositionHelper {
|
||||
int thumbnailRotation = thumbnailData.rotation;
|
||||
int deltaRotate = getRotationDelta(currentRotation, thumbnailRotation);
|
||||
RectF thumbnailClipHint = new RectF();
|
||||
|
||||
float scaledTaskbarSize;
|
||||
float canvasScreenRatio;
|
||||
if (mSplitBounds != null) {
|
||||
if (mSplitBounds.appsStackedVertically) {
|
||||
if (mDesiredStagePosition == STAGE_POSITION_TOP_OR_LEFT) {
|
||||
// Top app isn't cropped at all by taskbar
|
||||
canvasScreenRatio = 0;
|
||||
} else {
|
||||
// Same as fullscreen ratio
|
||||
canvasScreenRatio = (float) canvasWidth / screenWidthPx;
|
||||
}
|
||||
} else {
|
||||
// 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
|
||||
float fullscreenTaskWidth = screenWidthPx * taskPercent;
|
||||
canvasScreenRatio = canvasWidth / fullscreenTaskWidth;
|
||||
}
|
||||
} else {
|
||||
canvasScreenRatio = (float) canvasWidth / screenWidthPx;
|
||||
}
|
||||
scaledTaskbarSize = taskbarSize * canvasScreenRatio;
|
||||
thumbnailClipHint.bottom = isLargeScreen ? scaledTaskbarSize : 0;
|
||||
|
||||
float scale = thumbnailData.scale;
|
||||
final float thumbnailScale;
|
||||
|
||||
@@ -116,10 +87,8 @@ public class PreviewPositionHelper {
|
||||
|
||||
float surfaceWidth = thumbnailBounds.width() / scale;
|
||||
float surfaceHeight = thumbnailBounds.height() / scale;
|
||||
float availableWidth = surfaceWidth
|
||||
- (thumbnailClipHint.left + thumbnailClipHint.right);
|
||||
float availableHeight = surfaceHeight
|
||||
- (thumbnailClipHint.top + thumbnailClipHint.bottom);
|
||||
float availableWidth = surfaceWidth;
|
||||
float availableHeight = surfaceHeight;
|
||||
|
||||
float canvasAspect = canvasWidth / (float) canvasHeight;
|
||||
float availableAspect = isRotated
|
||||
@@ -210,8 +179,6 @@ public class PreviewPositionHelper {
|
||||
setThumbnailRotation(deltaRotate, thumbnailBounds);
|
||||
}
|
||||
|
||||
mClippedInsets.set(0, 0, 0, scaledTaskbarSize);
|
||||
|
||||
mMatrix.postScale(thumbnailScale, thumbnailScale);
|
||||
mIsOrientationChanged = isOrientationDifferent;
|
||||
}
|
||||
@@ -250,8 +217,4 @@ public class PreviewPositionHelper {
|
||||
}
|
||||
mMatrix.postTranslate(translateX, translateY);
|
||||
}
|
||||
|
||||
public RectF getClippedInsets() {
|
||||
return mClippedInsets;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.android.internal.R as AndroidR
|
||||
import com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorScope
|
||||
import com.android.systemui.mediaprojection.appselector.view.TaskPreviewSizeProvider.TaskPreviewSizeListener
|
||||
import com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen
|
||||
import com.android.systemui.shared.system.QuickStepContract
|
||||
import com.android.systemui.statusbar.policy.CallbackController
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener
|
||||
@@ -61,8 +62,15 @@ constructor(
|
||||
val width = windowMetrics.bounds.width()
|
||||
var height = maximumWindowHeight
|
||||
|
||||
// TODO(b/271410803): Read isTransientTaskbar from Launcher
|
||||
val isLargeScreen = isLargeScreen(context)
|
||||
if (isLargeScreen) {
|
||||
val isTransientTaskbar =
|
||||
QuickStepContract.isGesturalMode(
|
||||
context.resources.getInteger(
|
||||
com.android.internal.R.integer.config_navBarInteractionMode
|
||||
)
|
||||
)
|
||||
if (isLargeScreen && !isTransientTaskbar) {
|
||||
val taskbarSize =
|
||||
context.resources.getDimensionPixelSize(AndroidR.dimen.taskbar_frame_height)
|
||||
height -= taskbarSize
|
||||
|
||||
Reference in New Issue
Block a user