Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -296,15 +296,15 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin /** /** * Fade in the resize veil * Fade in the resize veil */ */ void showResizeVeil() { void showResizeVeil(Rect taskBounds) { mResizeVeil.showVeil(mTaskSurface); mResizeVeil.showVeil(mTaskSurface, taskBounds); } } /** /** * Set new bounds for the resize veil * Set new bounds for the resize veil */ */ void updateResizeVeil(Rect newBounds) { void updateResizeVeil(Rect newBounds) { mResizeVeil.relayout(newBounds); mResizeVeil.updateResizeVeil(newBounds); } } /** /** Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/ResizeVeil.java +17 −6 Original line number Original line Diff line number Diff line Loading @@ -104,7 +104,7 @@ public class ResizeVeil { /** /** * Animate veil's alpha to 1, fading it in. * Animate veil's alpha to 1, fading it in. */ */ public void showVeil(SurfaceControl parentSurface) { public void showVeil(SurfaceControl parentSurface, Rect taskBounds) { // Parent surface can change, ensure it is up to date. // Parent surface can change, ensure it is up to date. SurfaceControl.Transaction t = mSurfaceControlTransactionSupplier.get(); SurfaceControl.Transaction t = mSurfaceControlTransactionSupplier.get(); if (!parentSurface.equals(mParentSurface)) { if (!parentSurface.equals(mParentSurface)) { Loading @@ -115,8 +115,6 @@ public class ResizeVeil { int backgroundColorId = getBackgroundColorId(); int backgroundColorId = getBackgroundColorId(); mViewHost.getView().setBackgroundColor(mContext.getColor(backgroundColorId)); mViewHost.getView().setBackgroundColor(mContext.getColor(backgroundColorId)); t.show(mVeilSurface) .apply(); final ValueAnimator animator = new ValueAnimator(); final ValueAnimator animator = new ValueAnimator(); animator.setFloatValues(0f, 1f); animator.setFloatValues(0f, 1f); animator.setDuration(RESIZE_ALPHA_DURATION); animator.setDuration(RESIZE_ALPHA_DURATION); Loading @@ -124,19 +122,32 @@ public class ResizeVeil { t.setAlpha(mVeilSurface, animator.getAnimatedFraction()); t.setAlpha(mVeilSurface, animator.getAnimatedFraction()); t.apply(); t.apply(); }); }); animator.start(); relayout(taskBounds, t); t.show(mVeilSurface) .addTransactionCommittedListener(mContext.getMainExecutor(), () -> animator.start()) .setAlpha(mVeilSurface, 0); mViewHost.getView().getViewRootImpl().applyTransactionOnDraw(t); } } /** /** * Update veil bounds to match bounds changes. * Update veil bounds to match bounds changes. * @param newBounds bounds to update veil to. * @param newBounds bounds to update veil to. */ */ public void relayout(Rect newBounds) { private void relayout(Rect newBounds, SurfaceControl.Transaction t) { SurfaceControl.Transaction t = mSurfaceControlTransactionSupplier.get(); mViewHost.relayout(newBounds.width(), newBounds.height()); mViewHost.relayout(newBounds.width(), newBounds.height()); t.setWindowCrop(mVeilSurface, newBounds.width(), newBounds.height()); t.setWindowCrop(mVeilSurface, newBounds.width(), newBounds.height()); t.setPosition(mParentSurface, newBounds.left, newBounds.top); t.setPosition(mParentSurface, newBounds.left, newBounds.top); t.setWindowCrop(mParentSurface, newBounds.width(), newBounds.height()); t.setWindowCrop(mParentSurface, newBounds.width(), newBounds.height()); } /** * Calls relayout to update task and veil bounds. * @param newBounds bounds to update veil to. */ public void updateResizeVeil(Rect newBounds) { SurfaceControl.Transaction t = mSurfaceControlTransactionSupplier.get(); relayout(newBounds, t); mViewHost.getView().getViewRootImpl().applyTransactionOnDraw(t); mViewHost.getView().getViewRootImpl().applyTransactionOnDraw(t); } } Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -77,7 +77,7 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback { mDesktopWindowDecoration.mTaskInfo.configuration.windowConfiguration.getBounds()); mDesktopWindowDecoration.mTaskInfo.configuration.windowConfiguration.getBounds()); mRepositionStartPoint.set(x, y); mRepositionStartPoint.set(x, y); if (isResizing()) { if (isResizing()) { mDesktopWindowDecoration.showResizeVeil(); mDesktopWindowDecoration.showResizeVeil(mTaskBoundsAtDragStart); if (!mDesktopWindowDecoration.mTaskInfo.isFocused) { if (!mDesktopWindowDecoration.mTaskInfo.isFocused) { WindowContainerTransaction wct = new WindowContainerTransaction(); WindowContainerTransaction wct = new WindowContainerTransaction(); wct.reorder(mDesktopWindowDecoration.mTaskInfo.token, true); wct.reorder(mDesktopWindowDecoration.mTaskInfo.token, true); Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositionerTest.kt +3 −3 Original line number Original line Diff line number Diff line Loading @@ -123,7 +123,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() { STARTING_BOUNDS.left.toFloat(), STARTING_BOUNDS.left.toFloat(), STARTING_BOUNDS.top.toFloat() STARTING_BOUNDS.top.toFloat() ) ) verify(mockDesktopWindowDecoration).showResizeVeil() verify(mockDesktopWindowDecoration).showResizeVeil(STARTING_BOUNDS) taskPositioner.onDragPositioningEnd( taskPositioner.onDragPositioningEnd( STARTING_BOUNDS.left.toFloat(), STARTING_BOUNDS.left.toFloat(), Loading Loading @@ -180,7 +180,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() { STARTING_BOUNDS.right.toFloat(), STARTING_BOUNDS.right.toFloat(), STARTING_BOUNDS.top.toFloat() STARTING_BOUNDS.top.toFloat() ) ) verify(mockDesktopWindowDecoration).showResizeVeil() verify(mockDesktopWindowDecoration).showResizeVeil(STARTING_BOUNDS) taskPositioner.onDragPositioningMove( taskPositioner.onDragPositioningMove( STARTING_BOUNDS.right.toFloat() + 10, STARTING_BOUNDS.right.toFloat() + 10, Loading Loading @@ -224,7 +224,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() { STARTING_BOUNDS.left.toFloat(), STARTING_BOUNDS.left.toFloat(), STARTING_BOUNDS.top.toFloat() STARTING_BOUNDS.top.toFloat() ) ) verify(mockDesktopWindowDecoration).showResizeVeil() verify(mockDesktopWindowDecoration).showResizeVeil(STARTING_BOUNDS) taskPositioner.onDragPositioningMove( taskPositioner.onDragPositioningMove( STARTING_BOUNDS.left.toFloat(), STARTING_BOUNDS.left.toFloat(), Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -296,15 +296,15 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin /** /** * Fade in the resize veil * Fade in the resize veil */ */ void showResizeVeil() { void showResizeVeil(Rect taskBounds) { mResizeVeil.showVeil(mTaskSurface); mResizeVeil.showVeil(mTaskSurface, taskBounds); } } /** /** * Set new bounds for the resize veil * Set new bounds for the resize veil */ */ void updateResizeVeil(Rect newBounds) { void updateResizeVeil(Rect newBounds) { mResizeVeil.relayout(newBounds); mResizeVeil.updateResizeVeil(newBounds); } } /** /** Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/ResizeVeil.java +17 −6 Original line number Original line Diff line number Diff line Loading @@ -104,7 +104,7 @@ public class ResizeVeil { /** /** * Animate veil's alpha to 1, fading it in. * Animate veil's alpha to 1, fading it in. */ */ public void showVeil(SurfaceControl parentSurface) { public void showVeil(SurfaceControl parentSurface, Rect taskBounds) { // Parent surface can change, ensure it is up to date. // Parent surface can change, ensure it is up to date. SurfaceControl.Transaction t = mSurfaceControlTransactionSupplier.get(); SurfaceControl.Transaction t = mSurfaceControlTransactionSupplier.get(); if (!parentSurface.equals(mParentSurface)) { if (!parentSurface.equals(mParentSurface)) { Loading @@ -115,8 +115,6 @@ public class ResizeVeil { int backgroundColorId = getBackgroundColorId(); int backgroundColorId = getBackgroundColorId(); mViewHost.getView().setBackgroundColor(mContext.getColor(backgroundColorId)); mViewHost.getView().setBackgroundColor(mContext.getColor(backgroundColorId)); t.show(mVeilSurface) .apply(); final ValueAnimator animator = new ValueAnimator(); final ValueAnimator animator = new ValueAnimator(); animator.setFloatValues(0f, 1f); animator.setFloatValues(0f, 1f); animator.setDuration(RESIZE_ALPHA_DURATION); animator.setDuration(RESIZE_ALPHA_DURATION); Loading @@ -124,19 +122,32 @@ public class ResizeVeil { t.setAlpha(mVeilSurface, animator.getAnimatedFraction()); t.setAlpha(mVeilSurface, animator.getAnimatedFraction()); t.apply(); t.apply(); }); }); animator.start(); relayout(taskBounds, t); t.show(mVeilSurface) .addTransactionCommittedListener(mContext.getMainExecutor(), () -> animator.start()) .setAlpha(mVeilSurface, 0); mViewHost.getView().getViewRootImpl().applyTransactionOnDraw(t); } } /** /** * Update veil bounds to match bounds changes. * Update veil bounds to match bounds changes. * @param newBounds bounds to update veil to. * @param newBounds bounds to update veil to. */ */ public void relayout(Rect newBounds) { private void relayout(Rect newBounds, SurfaceControl.Transaction t) { SurfaceControl.Transaction t = mSurfaceControlTransactionSupplier.get(); mViewHost.relayout(newBounds.width(), newBounds.height()); mViewHost.relayout(newBounds.width(), newBounds.height()); t.setWindowCrop(mVeilSurface, newBounds.width(), newBounds.height()); t.setWindowCrop(mVeilSurface, newBounds.width(), newBounds.height()); t.setPosition(mParentSurface, newBounds.left, newBounds.top); t.setPosition(mParentSurface, newBounds.left, newBounds.top); t.setWindowCrop(mParentSurface, newBounds.width(), newBounds.height()); t.setWindowCrop(mParentSurface, newBounds.width(), newBounds.height()); } /** * Calls relayout to update task and veil bounds. * @param newBounds bounds to update veil to. */ public void updateResizeVeil(Rect newBounds) { SurfaceControl.Transaction t = mSurfaceControlTransactionSupplier.get(); relayout(newBounds, t); mViewHost.getView().getViewRootImpl().applyTransactionOnDraw(t); mViewHost.getView().getViewRootImpl().applyTransactionOnDraw(t); } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositioner.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -77,7 +77,7 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback { mDesktopWindowDecoration.mTaskInfo.configuration.windowConfiguration.getBounds()); mDesktopWindowDecoration.mTaskInfo.configuration.windowConfiguration.getBounds()); mRepositionStartPoint.set(x, y); mRepositionStartPoint.set(x, y); if (isResizing()) { if (isResizing()) { mDesktopWindowDecoration.showResizeVeil(); mDesktopWindowDecoration.showResizeVeil(mTaskBoundsAtDragStart); if (!mDesktopWindowDecoration.mTaskInfo.isFocused) { if (!mDesktopWindowDecoration.mTaskInfo.isFocused) { WindowContainerTransaction wct = new WindowContainerTransaction(); WindowContainerTransaction wct = new WindowContainerTransaction(); wct.reorder(mDesktopWindowDecoration.mTaskInfo.token, true); wct.reorder(mDesktopWindowDecoration.mTaskInfo.token, true); Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositionerTest.kt +3 −3 Original line number Original line Diff line number Diff line Loading @@ -123,7 +123,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() { STARTING_BOUNDS.left.toFloat(), STARTING_BOUNDS.left.toFloat(), STARTING_BOUNDS.top.toFloat() STARTING_BOUNDS.top.toFloat() ) ) verify(mockDesktopWindowDecoration).showResizeVeil() verify(mockDesktopWindowDecoration).showResizeVeil(STARTING_BOUNDS) taskPositioner.onDragPositioningEnd( taskPositioner.onDragPositioningEnd( STARTING_BOUNDS.left.toFloat(), STARTING_BOUNDS.left.toFloat(), Loading Loading @@ -180,7 +180,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() { STARTING_BOUNDS.right.toFloat(), STARTING_BOUNDS.right.toFloat(), STARTING_BOUNDS.top.toFloat() STARTING_BOUNDS.top.toFloat() ) ) verify(mockDesktopWindowDecoration).showResizeVeil() verify(mockDesktopWindowDecoration).showResizeVeil(STARTING_BOUNDS) taskPositioner.onDragPositioningMove( taskPositioner.onDragPositioningMove( STARTING_BOUNDS.right.toFloat() + 10, STARTING_BOUNDS.right.toFloat() + 10, Loading Loading @@ -224,7 +224,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() { STARTING_BOUNDS.left.toFloat(), STARTING_BOUNDS.left.toFloat(), STARTING_BOUNDS.top.toFloat() STARTING_BOUNDS.top.toFloat() ) ) verify(mockDesktopWindowDecoration).showResizeVeil() verify(mockDesktopWindowDecoration).showResizeVeil(STARTING_BOUNDS) taskPositioner.onDragPositioningMove( taskPositioner.onDragPositioningMove( STARTING_BOUNDS.left.toFloat(), STARTING_BOUNDS.left.toFloat(), Loading