Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransitionController.java +6 −0 Original line number Diff line number Diff line Loading @@ -398,6 +398,12 @@ public abstract class PipTransitionController implements Transitions.TransitionH public void finishTransition() { } /** * Callback when the transition is aborted. */ public void onTransitionAborted() { } /** * End the currently-playing PiP animation. * Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java +24 −1 Original line number Diff line number Diff line Loading @@ -281,7 +281,11 @@ public class PipTransition extends PipTransitionController implements @Override public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted, @Nullable SurfaceControl.Transaction finishT) {} @Nullable SurfaceControl.Transaction finishT) { if (transition == mBoundsChangeTransition && aborted) { onTransitionAborted(); } } @Override public boolean startAnimation(@NonNull IBinder transition, Loading Loading @@ -1032,6 +1036,25 @@ public class PipTransition extends PipTransitionController implements } } @Override public void onTransitionAborted() { final int currentState = mPipTransitionState.getState(); int nextState = PipTransitionState.UNDEFINED; switch (currentState) { case PipTransitionState.SCHEDULED_BOUNDS_CHANGE: nextState = PipTransitionState.CHANGED_PIP_BOUNDS; break; } if (nextState == PipTransitionState.UNDEFINED) { Log.wtf(TAG, String.format(""" PipTransitionState resolved to an undefined state in abortTransition(). callers=%s""", Debug.getCallers(4))); } mPipTransitionState.setState(nextState); } @Override public void onPipTransitionStateChanged(@PipTransitionState.TransitionState int oldState, @PipTransitionState.TransitionState int newState, @Nullable Bundle extra) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransitionState.java +4 −1 Original line number Diff line number Diff line Loading @@ -203,6 +203,9 @@ public class PipTransitionState { * @param extra a bundle passed to the subscribed listeners to resolve/cache extra info. */ public void setState(@TransitionState int state, @Nullable Bundle extra) { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s setState from=%s to=%s", TAG, stateToString(mState), stateToString(state)); if (state == ENTERING_PIP || state == SWIPING_TO_PIP || state == SCHEDULED_BOUNDS_CHANGE || state == CHANGING_PIP_BOUNDS) { // States listed above require extra bundles to be provided. Loading Loading @@ -425,8 +428,8 @@ public class PipTransitionState { case CHANGED_PIP_BOUNDS: return "changed-bounds"; case EXITING_PIP: return "exiting-pip"; case EXITED_PIP: return "exited-pip"; default: return "custom-state(" + state + ")"; } throw new IllegalStateException("Unknown state: " + state); } public boolean isPipStateIdle() { Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransitionController.java +6 −0 Original line number Diff line number Diff line Loading @@ -398,6 +398,12 @@ public abstract class PipTransitionController implements Transitions.TransitionH public void finishTransition() { } /** * Callback when the transition is aborted. */ public void onTransitionAborted() { } /** * End the currently-playing PiP animation. * Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java +24 −1 Original line number Diff line number Diff line Loading @@ -281,7 +281,11 @@ public class PipTransition extends PipTransitionController implements @Override public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted, @Nullable SurfaceControl.Transaction finishT) {} @Nullable SurfaceControl.Transaction finishT) { if (transition == mBoundsChangeTransition && aborted) { onTransitionAborted(); } } @Override public boolean startAnimation(@NonNull IBinder transition, Loading Loading @@ -1032,6 +1036,25 @@ public class PipTransition extends PipTransitionController implements } } @Override public void onTransitionAborted() { final int currentState = mPipTransitionState.getState(); int nextState = PipTransitionState.UNDEFINED; switch (currentState) { case PipTransitionState.SCHEDULED_BOUNDS_CHANGE: nextState = PipTransitionState.CHANGED_PIP_BOUNDS; break; } if (nextState == PipTransitionState.UNDEFINED) { Log.wtf(TAG, String.format(""" PipTransitionState resolved to an undefined state in abortTransition(). callers=%s""", Debug.getCallers(4))); } mPipTransitionState.setState(nextState); } @Override public void onPipTransitionStateChanged(@PipTransitionState.TransitionState int oldState, @PipTransitionState.TransitionState int newState, @Nullable Bundle extra) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransitionState.java +4 −1 Original line number Diff line number Diff line Loading @@ -203,6 +203,9 @@ public class PipTransitionState { * @param extra a bundle passed to the subscribed listeners to resolve/cache extra info. */ public void setState(@TransitionState int state, @Nullable Bundle extra) { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "%s setState from=%s to=%s", TAG, stateToString(mState), stateToString(state)); if (state == ENTERING_PIP || state == SWIPING_TO_PIP || state == SCHEDULED_BOUNDS_CHANGE || state == CHANGING_PIP_BOUNDS) { // States listed above require extra bundles to be provided. Loading Loading @@ -425,8 +428,8 @@ public class PipTransitionState { case CHANGED_PIP_BOUNDS: return "changed-bounds"; case EXITING_PIP: return "exiting-pip"; case EXITED_PIP: return "exited-pip"; default: return "custom-state(" + state + ")"; } throw new IllegalStateException("Unknown state: " + state); } public boolean isPipStateIdle() { Loading