1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.server.wm;
18 
19 import android.graphics.Rect;
20 
21 /**
22  * The target for a BoundsAnimation.
23  * @see BoundsAnimationController
24  */
25 interface BoundsAnimationTarget {
26 
27     /**
28      * Callback for the target to inform it that the animation has started, so it can do some
29      * necessary preparation.
30      *
31      * @param schedulePipModeChangedCallback whether or not to schedule the PiP mode changed
32      * callbacks
33      */
onAnimationStart(boolean schedulePipModeChangedCallback, boolean forceUpdate)34     void onAnimationStart(boolean schedulePipModeChangedCallback, boolean forceUpdate);
35 
36     /**
37      * @return Whether the animation should be paused waiting for the windows to draw before
38      *         entering PiP.
39      */
shouldDeferStartOnMoveToFullscreen()40     boolean shouldDeferStartOnMoveToFullscreen();
41 
42     /**
43      * Sets the size of the target (without any intermediate steps, like scheduling animation)
44      * but freezes the bounds of any tasks in the target at taskBounds, to allow for more
45      * flexibility during resizing. Only works for the pinned stack at the moment.  This will
46      * only be called between onAnimationStart() and onAnimationEnd().
47      *
48      * @return Whether the target should continue to be animated and this call was successful.
49      * If false, the animation will be cancelled because the user has determined that the
50      * animation is now invalid and not required. In such a case, the cancel will trigger the
51      * animation end callback as well, but will not send any further size changes.
52      */
setPinnedStackSize(Rect stackBounds, Rect taskBounds)53     boolean setPinnedStackSize(Rect stackBounds, Rect taskBounds);
54 
55     /**
56      * Callback for the target to inform it that the animation has ended, so it can do some
57      * necessary cleanup.
58      *
59      * @param schedulePipModeChangedCallback whether or not to schedule the PiP mode changed
60      * callbacks
61      * @param finalStackSize the final stack bounds to set on the target (can be to indicate that
62      * the animation was cancelled and the target does not need to update to the final stack bounds)
63      * @param moveToFullscreen whether or the target should reparent itself to the fullscreen stack
64      * when the animation completes
65      */
onAnimationEnd(boolean schedulePipModeChangedCallback, Rect finalStackSize, boolean moveToFullscreen)66     void onAnimationEnd(boolean schedulePipModeChangedCallback, Rect finalStackSize,
67             boolean moveToFullscreen);
68 }
69