Loading libs/WindowManager/Shell/res/values/dimen.xml +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ <dimen name="pip_bottom_offset_buffer">1dp</dimen> <!-- The corner radius for PiP window. --> <dimen name="pip_corner_radius">8dp</dimen> <dimen name="pip_corner_radius">16dp</dimen> <!-- The bottom margin of the PIP drag to dismiss info text shown when moving a PIP. --> <dimen name="pip_dismiss_text_bottom_margin">24dp</dimen> Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java +15 −6 Original line number Diff line number Diff line Loading @@ -435,7 +435,8 @@ public class PipAnimationController { SurfaceControl.Transaction tx, float fraction) { final float alpha = getStartValue() * (1 - fraction) + getEndValue() * fraction; setCurrentValue(alpha); getSurfaceTransactionHelper().alpha(tx, leash, alpha); getSurfaceTransactionHelper().alpha(tx, leash, alpha) .round(tx, leash, shouldApplyCornerRadius()); tx.apply(); } Loading Loading @@ -526,16 +527,22 @@ public class PipAnimationController { float angle = (1.0f - fraction) * startingAngle; setCurrentValue(bounds); if (inScaleTransition() || sourceHintRect == null) { if (isOutPipDirection) { getSurfaceTransactionHelper().scale(tx, leash, end, bounds); } else { getSurfaceTransactionHelper().scale(tx, leash, base, bounds, angle); getSurfaceTransactionHelper().scale(tx, leash, base, bounds, angle) .round(tx, leash, base, bounds); } } else { final Rect insets = computeInsets(fraction); getSurfaceTransactionHelper().scaleAndCrop(tx, leash, initialSourceValue, bounds, insets); if (shouldApplyCornerRadius()) { final Rect destinationBounds = new Rect(bounds); destinationBounds.inset(insets); getSurfaceTransactionHelper().round(tx, leash, initialContainerRect, destinationBounds); } } if (!handlePipTransaction(leash, tx, bounds)) { tx.apply(); Loading Loading @@ -564,9 +571,11 @@ public class PipAnimationController { x = fraction * (end.left - start.left) + start.left; y = fraction * (end.bottom - start.top) + start.top; } getSurfaceTransactionHelper().rotateAndScaleWithCrop(tx, leash, initialContainerRect, bounds, insets, degree, x, y, isOutPipDirection, rotationDelta == ROTATION_270 /* clockwise */); getSurfaceTransactionHelper() .rotateAndScaleWithCrop(tx, leash, initialContainerRect, bounds, insets, degree, x, y, isOutPipDirection, rotationDelta == ROTATION_270 /* clockwise */) .round(tx, leash, initialContainerRect, bounds); tx.apply(); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipSurfaceTransactionHelper.java +12 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,18 @@ public class PipSurfaceTransactionHelper { return this; } /** * Operates the round corner radius on a given transaction and leash, scaled by bounds * @return same {@link PipSurfaceTransactionHelper} instance for method chaining */ public PipSurfaceTransactionHelper round(SurfaceControl.Transaction tx, SurfaceControl leash, Rect fromBounds, Rect toBounds) { final float scale = (float) (Math.hypot(fromBounds.width(), fromBounds.height()) / Math.hypot(toBounds.width(), toBounds.height())); tx.setCornerRadius(leash, mCornerRadius * scale); return this; } /** * Re-parents the snapshot to the parent's surface control and shows it. */ Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +5 −1 Original line number Diff line number Diff line Loading @@ -184,6 +184,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mTaskOrganizer.applyTransaction(wct); // The final task bounds will be applied by onFixedRotationFinished so that all // coordinates are in new rotation. mSurfaceTransactionHelper.round(tx, mLeash, isInPip()); mDeferredAnimEndTransaction = tx; return; } Loading Loading @@ -1046,7 +1047,9 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction(); mSurfaceTransactionHelper.scale(tx, mLeash, startBounds, toBounds, degrees); mSurfaceTransactionHelper .scale(tx, mLeash, startBounds, toBounds, degrees) .round(tx, mLeash, startBounds, toBounds); if (mPipMenuController.isMenuVisible()) { mPipMenuController.movePipMenu(mLeash, tx, toBounds); } else { Loading Loading @@ -1221,6 +1224,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, // Just a resize in PIP taskBounds = destinationBounds; } mSurfaceTransactionHelper.round(tx, mLeash, isInPip()); wct.setBounds(mToken, taskBounds); wct.setBoundsChangeTransaction(mToken, tx); Loading services/core/java/com/android/server/wm/PinnedTaskController.java +3 −1 Original line number Diff line number Diff line Loading @@ -268,7 +268,9 @@ class PinnedTaskController { matrix.postRotate(90); } matrix.postTranslate(dx, dy); t.setMatrix(pinnedTask.getSurfaceControl(), matrix, new float[9]); final SurfaceControl leash = pinnedTask.getSurfaceControl(); t.setMatrix(leash, matrix, new float[9]) .setCornerRadius(leash, pipTx.mCornerRadius); Slog.i(TAG, "Seamless rotation PiP tx=" + pipTx + " pos=" + dx + "," + dy); return; } Loading Loading
libs/WindowManager/Shell/res/values/dimen.xml +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ <dimen name="pip_bottom_offset_buffer">1dp</dimen> <!-- The corner radius for PiP window. --> <dimen name="pip_corner_radius">8dp</dimen> <dimen name="pip_corner_radius">16dp</dimen> <!-- The bottom margin of the PIP drag to dismiss info text shown when moving a PIP. --> <dimen name="pip_dismiss_text_bottom_margin">24dp</dimen> Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java +15 −6 Original line number Diff line number Diff line Loading @@ -435,7 +435,8 @@ public class PipAnimationController { SurfaceControl.Transaction tx, float fraction) { final float alpha = getStartValue() * (1 - fraction) + getEndValue() * fraction; setCurrentValue(alpha); getSurfaceTransactionHelper().alpha(tx, leash, alpha); getSurfaceTransactionHelper().alpha(tx, leash, alpha) .round(tx, leash, shouldApplyCornerRadius()); tx.apply(); } Loading Loading @@ -526,16 +527,22 @@ public class PipAnimationController { float angle = (1.0f - fraction) * startingAngle; setCurrentValue(bounds); if (inScaleTransition() || sourceHintRect == null) { if (isOutPipDirection) { getSurfaceTransactionHelper().scale(tx, leash, end, bounds); } else { getSurfaceTransactionHelper().scale(tx, leash, base, bounds, angle); getSurfaceTransactionHelper().scale(tx, leash, base, bounds, angle) .round(tx, leash, base, bounds); } } else { final Rect insets = computeInsets(fraction); getSurfaceTransactionHelper().scaleAndCrop(tx, leash, initialSourceValue, bounds, insets); if (shouldApplyCornerRadius()) { final Rect destinationBounds = new Rect(bounds); destinationBounds.inset(insets); getSurfaceTransactionHelper().round(tx, leash, initialContainerRect, destinationBounds); } } if (!handlePipTransaction(leash, tx, bounds)) { tx.apply(); Loading Loading @@ -564,9 +571,11 @@ public class PipAnimationController { x = fraction * (end.left - start.left) + start.left; y = fraction * (end.bottom - start.top) + start.top; } getSurfaceTransactionHelper().rotateAndScaleWithCrop(tx, leash, initialContainerRect, bounds, insets, degree, x, y, isOutPipDirection, rotationDelta == ROTATION_270 /* clockwise */); getSurfaceTransactionHelper() .rotateAndScaleWithCrop(tx, leash, initialContainerRect, bounds, insets, degree, x, y, isOutPipDirection, rotationDelta == ROTATION_270 /* clockwise */) .round(tx, leash, initialContainerRect, bounds); tx.apply(); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipSurfaceTransactionHelper.java +12 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,18 @@ public class PipSurfaceTransactionHelper { return this; } /** * Operates the round corner radius on a given transaction and leash, scaled by bounds * @return same {@link PipSurfaceTransactionHelper} instance for method chaining */ public PipSurfaceTransactionHelper round(SurfaceControl.Transaction tx, SurfaceControl leash, Rect fromBounds, Rect toBounds) { final float scale = (float) (Math.hypot(fromBounds.width(), fromBounds.height()) / Math.hypot(toBounds.width(), toBounds.height())); tx.setCornerRadius(leash, mCornerRadius * scale); return this; } /** * Re-parents the snapshot to the parent's surface control and shows it. */ Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +5 −1 Original line number Diff line number Diff line Loading @@ -184,6 +184,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mTaskOrganizer.applyTransaction(wct); // The final task bounds will be applied by onFixedRotationFinished so that all // coordinates are in new rotation. mSurfaceTransactionHelper.round(tx, mLeash, isInPip()); mDeferredAnimEndTransaction = tx; return; } Loading Loading @@ -1046,7 +1047,9 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction(); mSurfaceTransactionHelper.scale(tx, mLeash, startBounds, toBounds, degrees); mSurfaceTransactionHelper .scale(tx, mLeash, startBounds, toBounds, degrees) .round(tx, mLeash, startBounds, toBounds); if (mPipMenuController.isMenuVisible()) { mPipMenuController.movePipMenu(mLeash, tx, toBounds); } else { Loading Loading @@ -1221,6 +1224,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, // Just a resize in PIP taskBounds = destinationBounds; } mSurfaceTransactionHelper.round(tx, mLeash, isInPip()); wct.setBounds(mToken, taskBounds); wct.setBoundsChangeTransaction(mToken, tx); Loading
services/core/java/com/android/server/wm/PinnedTaskController.java +3 −1 Original line number Diff line number Diff line Loading @@ -268,7 +268,9 @@ class PinnedTaskController { matrix.postRotate(90); } matrix.postTranslate(dx, dy); t.setMatrix(pinnedTask.getSurfaceControl(), matrix, new float[9]); final SurfaceControl leash = pinnedTask.getSurfaceControl(); t.setMatrix(leash, matrix, new float[9]) .setCornerRadius(leash, pipTx.mCornerRadius); Slog.i(TAG, "Seamless rotation PiP tx=" + pipTx + " pos=" + dx + "," + dy); return; } Loading