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
17package com.android.server.wm;
18
19import android.graphics.Rect;
20
21/**
22 * The target for a BoundsAnimation.
23 * @see BoundsAnimationController
24 */
25interface 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     */
34    void onAnimationStart(boolean schedulePipModeChangedCallback);
35
36    /**
37     * Sets the size of the target (without any intermediate steps, like scheduling animation)
38     * but freezes the bounds of any tasks in the target at taskBounds, to allow for more
39     * flexibility during resizing. Only works for the pinned stack at the moment.  This will
40     * only be called between onAnimationStart() and onAnimationEnd().
41     *
42     * @return Whether the target should continue to be animated and this call was successful.
43     * If false, the animation will be cancelled because the user has determined that the
44     * animation is now invalid and not required. In such a case, the cancel will trigger the
45     * animation end callback as well, but will not send any further size changes.
46     */
47    boolean setPinnedStackSize(Rect stackBounds, Rect taskBounds);
48
49    /**
50     * Callback for the target to inform it that the animation has ended, so it can do some
51     * necessary cleanup.
52     *
53     * @param schedulePipModeChangedCallback whether or not to schedule the PiP mode changed
54     * callbacks
55     * @param finalStackSize the final stack bounds to set on the target (can be to indicate that
56     * the animation was cancelled and the target does not need to update to the final stack bounds)
57     * @param moveToFullscreen whether or the target should reparent itself to the fullscreen stack
58     * when the animation completes
59     */
60    void onAnimationEnd(boolean schedulePipModeChangedCallback, Rect finalStackSize,
61            boolean moveToFullscreen);
62}
63