Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransitionController.java +1 −3 Original line number Diff line number Diff line Loading @@ -368,10 +368,8 @@ public abstract class PipTransitionController implements Transitions.TransitionH /** * Finish the current transition if possible. * * @param tx transaction to be applied with a potentially new draw after finishing. */ public void finishTransition(@Nullable SurfaceControl.Transaction tx) { public void finishTransition() { } /** Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/animation/PipEnterAnimator.java +1 −16 Original line number Diff line number Diff line Loading @@ -192,22 +192,7 @@ public class PipEnterAnimator extends ValueAnimator * calculated differently from generic transitions. * @param pipChange PiP change received as a transition target. */ public void setEnterStartState(@NonNull TransitionInfo.Change pipChange, @NonNull TransitionInfo.Change pipActivityChange) { PipUtils.calcEndTransform(pipActivityChange, pipChange, mInitActivityScale, mInitActivityPos); if (mStartTransaction != null && pipActivityChange.getLeash() != null) { mStartTransaction.setCrop(pipActivityChange.getLeash(), null); mStartTransaction.setScale(pipActivityChange.getLeash(), mInitActivityScale.x, mInitActivityScale.y); mStartTransaction.setPosition(pipActivityChange.getLeash(), mInitActivityPos.x, mInitActivityPos.y); mFinishTransaction.setCrop(pipActivityChange.getLeash(), null); mFinishTransaction.setScale(pipActivityChange.getLeash(), mInitActivityScale.x, mInitActivityScale.y); mFinishTransaction.setPosition(pipActivityChange.getLeash(), mInitActivityPos.x, mInitActivityPos.y); } public void setEnterStartState(@NonNull TransitionInfo.Change pipChange) { PipUtils.calcStartTransform(pipChange, mInitScale, mInitPos, mInitCrop); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipMotionHelper.java +6 −9 Original line number Diff line number Diff line Loading @@ -752,11 +752,11 @@ public class PipMotionHelper implements PipAppOpsListener.Callback, PipTransition.BOUNDS_CHANGE_JUMPCUT_DURATION)); break; case PipTransitionState.CHANGING_PIP_BOUNDS: SurfaceControl.Transaction startTx = extra.getParcelable( final SurfaceControl.Transaction startTx = extra.getParcelable( PipTransition.PIP_START_TX, SurfaceControl.Transaction.class); SurfaceControl.Transaction finishTx = extra.getParcelable( final SurfaceControl.Transaction finishTx = extra.getParcelable( PipTransition.PIP_FINISH_TX, SurfaceControl.Transaction.class); Rect destinationBounds = extra.getParcelable( final Rect destinationBounds = extra.getParcelable( PipTransition.PIP_DESTINATION_BOUNDS, Rect.class); final int duration = extra.getInt(ANIMATING_BOUNDS_CHANGE_DURATION, PipTransition.BOUNDS_CHANGE_JUMPCUT_DURATION); Loading Loading @@ -794,7 +794,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback, cleanUpHighPerfSessionMaybe(); // Signal that the transition is done - should update transition state by default. mPipScheduler.scheduleFinishResizePip(destinationBounds, false /* configAtEnd */); mPipScheduler.scheduleFinishResizePip(destinationBounds); } private void startResizeAnimation(SurfaceControl.Transaction startTx, Loading @@ -803,11 +803,8 @@ public class PipMotionHelper implements PipAppOpsListener.Callback, Preconditions.checkState(pipLeash != null, "No leash cached by mPipTransitionState=" + mPipTransitionState); startTx.setWindowCrop(pipLeash, mPipBoundsState.getBounds().width(), mPipBoundsState.getBounds().height()); PipResizeAnimator animator = new PipResizeAnimator(mContext, pipLeash, startTx, finishTx, mPipBoundsState.getBounds(), mPipBoundsState.getBounds(), startTx, finishTx, destinationBounds, mPipBoundsState.getBounds(), destinationBounds, duration, 0f /* angle */); animator.setAnimationEndCallback(() -> { // In case an ongoing drag/fling was present before a deterministic resize transition Loading @@ -818,7 +815,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback, cleanUpHighPerfSessionMaybe(); // Signal that we are done with resize transition mPipScheduler.scheduleFinishResizePip(destinationBounds, true /* configAtEnd */); mPipScheduler.scheduleFinishResizePip(destinationBounds); }); animator.start(); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipResizeGestureHandler.java +8 −10 Original line number Diff line number Diff line Loading @@ -535,28 +535,26 @@ public class PipResizeGestureHandler implements Preconditions.checkState(pipLeash != null, "No leash cached by mPipTransitionState=" + mPipTransitionState); SurfaceControl.Transaction startTx = extra.getParcelable( final SurfaceControl.Transaction startTx = extra.getParcelable( PipTransition.PIP_START_TX, SurfaceControl.Transaction.class); SurfaceControl.Transaction finishTx = extra.getParcelable( final SurfaceControl.Transaction finishTx = extra.getParcelable( PipTransition.PIP_FINISH_TX, SurfaceControl.Transaction.class); final Rect destinationBounds = extra.getParcelable( PipTransition.PIP_DESTINATION_BOUNDS, Rect.class); final int duration = extra.getInt(ANIMATING_BOUNDS_CHANGE_DURATION, PipTransition.BOUNDS_CHANGE_JUMPCUT_DURATION); startTx.setWindowCrop(pipLeash, mPipBoundsState.getBounds().width(), mPipBoundsState.getBounds().height()); PipResizeAnimator animator = new PipResizeAnimator(mContext, pipLeash, startTx, finishTx, mPipBoundsState.getBounds(), mStartBoundsAfterRelease, mLastResizeBounds, duration, mAngle); startTx, finishTx, destinationBounds, mStartBoundsAfterRelease, destinationBounds, duration, mAngle); animator.setAnimationEndCallback(() -> { // All motion operations have actually finished, so make bounds cache updates. mUserResizeBounds.set(mLastResizeBounds); mUserResizeBounds.set(destinationBounds); resetState(); cleanUpHighPerfSessionMaybe(); // Signal that we are done with resize transition mPipScheduler.scheduleFinishResizePip( mLastResizeBounds, true /* configAtEnd */); mPipScheduler.scheduleFinishResizePip(destinationBounds); }); animator.start(); break; Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipScheduler.java +4 −14 Original line number Diff line number Diff line Loading @@ -175,22 +175,12 @@ public class PipScheduler { * Note that we do not allow any actual WM Core changes at this point. * * @param toBounds destination bounds used only for internal state updates - not sent to Core. * @param configAtEnd true if we are waiting for config updates at the end of the transition. */ public void scheduleFinishResizePip(Rect toBounds, boolean configAtEnd) { // Make updates to the internal state to reflect new bounds public void scheduleFinishResizePip(Rect toBounds) { // Make updates to the internal state to reflect new bounds before updating any transitions // related state; transition state updates can trigger callbacks that use the cached bounds. onFinishingPipResize(toBounds); SurfaceControl.Transaction tx = null; if (configAtEnd) { tx = new SurfaceControl.Transaction(); tx.addTransactionCommittedListener(mMainExecutor, () -> { mPipTransitionState.setState(PipTransitionState.CHANGED_PIP_BOUNDS); }); } else { mPipTransitionState.setState(PipTransitionState.CHANGED_PIP_BOUNDS); } mPipTransitionController.finishTransition(tx); mPipTransitionController.finishTransition(); } /** Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransitionController.java +1 −3 Original line number Diff line number Diff line Loading @@ -368,10 +368,8 @@ public abstract class PipTransitionController implements Transitions.TransitionH /** * Finish the current transition if possible. * * @param tx transaction to be applied with a potentially new draw after finishing. */ public void finishTransition(@Nullable SurfaceControl.Transaction tx) { public void finishTransition() { } /** Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/animation/PipEnterAnimator.java +1 −16 Original line number Diff line number Diff line Loading @@ -192,22 +192,7 @@ public class PipEnterAnimator extends ValueAnimator * calculated differently from generic transitions. * @param pipChange PiP change received as a transition target. */ public void setEnterStartState(@NonNull TransitionInfo.Change pipChange, @NonNull TransitionInfo.Change pipActivityChange) { PipUtils.calcEndTransform(pipActivityChange, pipChange, mInitActivityScale, mInitActivityPos); if (mStartTransaction != null && pipActivityChange.getLeash() != null) { mStartTransaction.setCrop(pipActivityChange.getLeash(), null); mStartTransaction.setScale(pipActivityChange.getLeash(), mInitActivityScale.x, mInitActivityScale.y); mStartTransaction.setPosition(pipActivityChange.getLeash(), mInitActivityPos.x, mInitActivityPos.y); mFinishTransaction.setCrop(pipActivityChange.getLeash(), null); mFinishTransaction.setScale(pipActivityChange.getLeash(), mInitActivityScale.x, mInitActivityScale.y); mFinishTransaction.setPosition(pipActivityChange.getLeash(), mInitActivityPos.x, mInitActivityPos.y); } public void setEnterStartState(@NonNull TransitionInfo.Change pipChange) { PipUtils.calcStartTransform(pipChange, mInitScale, mInitPos, mInitCrop); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipMotionHelper.java +6 −9 Original line number Diff line number Diff line Loading @@ -752,11 +752,11 @@ public class PipMotionHelper implements PipAppOpsListener.Callback, PipTransition.BOUNDS_CHANGE_JUMPCUT_DURATION)); break; case PipTransitionState.CHANGING_PIP_BOUNDS: SurfaceControl.Transaction startTx = extra.getParcelable( final SurfaceControl.Transaction startTx = extra.getParcelable( PipTransition.PIP_START_TX, SurfaceControl.Transaction.class); SurfaceControl.Transaction finishTx = extra.getParcelable( final SurfaceControl.Transaction finishTx = extra.getParcelable( PipTransition.PIP_FINISH_TX, SurfaceControl.Transaction.class); Rect destinationBounds = extra.getParcelable( final Rect destinationBounds = extra.getParcelable( PipTransition.PIP_DESTINATION_BOUNDS, Rect.class); final int duration = extra.getInt(ANIMATING_BOUNDS_CHANGE_DURATION, PipTransition.BOUNDS_CHANGE_JUMPCUT_DURATION); Loading Loading @@ -794,7 +794,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback, cleanUpHighPerfSessionMaybe(); // Signal that the transition is done - should update transition state by default. mPipScheduler.scheduleFinishResizePip(destinationBounds, false /* configAtEnd */); mPipScheduler.scheduleFinishResizePip(destinationBounds); } private void startResizeAnimation(SurfaceControl.Transaction startTx, Loading @@ -803,11 +803,8 @@ public class PipMotionHelper implements PipAppOpsListener.Callback, Preconditions.checkState(pipLeash != null, "No leash cached by mPipTransitionState=" + mPipTransitionState); startTx.setWindowCrop(pipLeash, mPipBoundsState.getBounds().width(), mPipBoundsState.getBounds().height()); PipResizeAnimator animator = new PipResizeAnimator(mContext, pipLeash, startTx, finishTx, mPipBoundsState.getBounds(), mPipBoundsState.getBounds(), startTx, finishTx, destinationBounds, mPipBoundsState.getBounds(), destinationBounds, duration, 0f /* angle */); animator.setAnimationEndCallback(() -> { // In case an ongoing drag/fling was present before a deterministic resize transition Loading @@ -818,7 +815,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback, cleanUpHighPerfSessionMaybe(); // Signal that we are done with resize transition mPipScheduler.scheduleFinishResizePip(destinationBounds, true /* configAtEnd */); mPipScheduler.scheduleFinishResizePip(destinationBounds); }); animator.start(); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipResizeGestureHandler.java +8 −10 Original line number Diff line number Diff line Loading @@ -535,28 +535,26 @@ public class PipResizeGestureHandler implements Preconditions.checkState(pipLeash != null, "No leash cached by mPipTransitionState=" + mPipTransitionState); SurfaceControl.Transaction startTx = extra.getParcelable( final SurfaceControl.Transaction startTx = extra.getParcelable( PipTransition.PIP_START_TX, SurfaceControl.Transaction.class); SurfaceControl.Transaction finishTx = extra.getParcelable( final SurfaceControl.Transaction finishTx = extra.getParcelable( PipTransition.PIP_FINISH_TX, SurfaceControl.Transaction.class); final Rect destinationBounds = extra.getParcelable( PipTransition.PIP_DESTINATION_BOUNDS, Rect.class); final int duration = extra.getInt(ANIMATING_BOUNDS_CHANGE_DURATION, PipTransition.BOUNDS_CHANGE_JUMPCUT_DURATION); startTx.setWindowCrop(pipLeash, mPipBoundsState.getBounds().width(), mPipBoundsState.getBounds().height()); PipResizeAnimator animator = new PipResizeAnimator(mContext, pipLeash, startTx, finishTx, mPipBoundsState.getBounds(), mStartBoundsAfterRelease, mLastResizeBounds, duration, mAngle); startTx, finishTx, destinationBounds, mStartBoundsAfterRelease, destinationBounds, duration, mAngle); animator.setAnimationEndCallback(() -> { // All motion operations have actually finished, so make bounds cache updates. mUserResizeBounds.set(mLastResizeBounds); mUserResizeBounds.set(destinationBounds); resetState(); cleanUpHighPerfSessionMaybe(); // Signal that we are done with resize transition mPipScheduler.scheduleFinishResizePip( mLastResizeBounds, true /* configAtEnd */); mPipScheduler.scheduleFinishResizePip(destinationBounds); }); animator.start(); break; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipScheduler.java +4 −14 Original line number Diff line number Diff line Loading @@ -175,22 +175,12 @@ public class PipScheduler { * Note that we do not allow any actual WM Core changes at this point. * * @param toBounds destination bounds used only for internal state updates - not sent to Core. * @param configAtEnd true if we are waiting for config updates at the end of the transition. */ public void scheduleFinishResizePip(Rect toBounds, boolean configAtEnd) { // Make updates to the internal state to reflect new bounds public void scheduleFinishResizePip(Rect toBounds) { // Make updates to the internal state to reflect new bounds before updating any transitions // related state; transition state updates can trigger callbacks that use the cached bounds. onFinishingPipResize(toBounds); SurfaceControl.Transaction tx = null; if (configAtEnd) { tx = new SurfaceControl.Transaction(); tx.addTransactionCommittedListener(mMainExecutor, () -> { mPipTransitionState.setState(PipTransitionState.CHANGED_PIP_BOUNDS); }); } else { mPipTransitionState.setState(PipTransitionState.CHANGED_PIP_BOUNDS); } mPipTransitionController.finishTransition(tx); mPipTransitionController.finishTransition(); } /** Loading