• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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.wm.shell.recents;
18 
19 import android.graphics.GraphicBuffer;
20 import android.view.IRemoteAnimationFinishedCallback;
21 import android.view.RemoteAnimationTarget;
22 import android.view.SurfaceControl;
23 import android.window.PictureInPictureSurfaceTransaction;
24 import android.window.TaskSnapshot;
25 import android.window.WindowAnimationState;
26 
27 import com.android.internal.os.IResultReceiver;
28 
29 /**
30  * Passed to the {@link IRecentsAnimationRunner} in order for the runner to control to let the
31  * runner control certain aspects of the recents animation, and to notify window manager when the
32  * animation has completed.
33  *
34  * {@hide}
35  */
36 interface IRecentsAnimationController {
37 
38     /**
39      * Sets the final surface transaction on a Task. This is used by Launcher to notify the system
40      * that animating Activity to PiP has completed and the associated task surface should be
41      * updated accordingly. This should be called before `finish`
42      * @param taskId for which the leash should be updated
43      * @param finishTransaction leash operations for the final transform.
44      * @param overlay the surface control for an overlay being shown above the pip (can be null)
45      */
setFinishTaskTransaction(int taskId, in PictureInPictureSurfaceTransaction finishTransaction, in SurfaceControl overlay)46      void setFinishTaskTransaction(int taskId,
47              in PictureInPictureSurfaceTransaction finishTransaction, in SurfaceControl overlay);
48 
49     /**
50      * Notifies to the system that the animation into Recents should end, and all leashes associated
51      * with remote animation targets should be relinquished. If {@param moveHomeToTop} is true, then
52      * the home activity should be moved to the top. Otherwise, the home activity is hidden and the
53      * user is returned to the app.
54      * @param sendUserLeaveHint If set to true, {@link Activity#onUserLeaving} will be sent to the
55      *                          top resumed app, false otherwise.
56      */
finish(boolean moveHomeToTop, boolean sendUserLeaveHint, in IResultReceiver finishCb)57     void finish(boolean moveHomeToTop, boolean sendUserLeaveHint, in IResultReceiver finishCb);
58 
59     /**
60      * Called by the handler to indicate that the recents animation input consumer should be
61      * enabled. This is currently used to work around an issue where registering an input consumer
62      * mid-animation causes the existing motion event chain to be canceled. Instead, the caller
63      * may register the recents animation input consumer prior to starting the recents animation
64      * and then enable it mid-animation to start receiving touch events.
65      */
setInputConsumerEnabled(boolean enabled)66     void setInputConsumerEnabled(boolean enabled);
67 
68     /**
69      * Sets a state for controller to decide which surface is the destination when the recents
70      * animation is cancelled through fail safe mechanism.
71      */
setWillFinishToHome(boolean willFinishToHome)72     void setWillFinishToHome(boolean willFinishToHome);
73 
74     /**
75      * Detach navigation bar from app.
76      *
77      * The system reparents the leash of navigation bar to the app when the recents animation starts
78      * and Launcher should call this method to let system restore the navigation bar to its
79      * original position when the quick switch gesture is finished and will run the fade-in
80      * animation If {@param moveHomeToTop} is {@code true}. Otherwise, restore the navigtation bar
81      * without animation.
82      *
83      * @param moveHomeToTop if {@code true}, the home activity should be moved to the top.
84      *                      Otherwise, the home activity is hidden and the user is returned to the
85      *                      app.
86      */
detachNavigationBarFromApp(boolean moveHomeToTop)87     void detachNavigationBarFromApp(boolean moveHomeToTop);
88 
89     /**
90      * Hand off the ongoing animation of a set of remote targets, to be run by another handler using
91      * the given starting parameters.
92      *
93      * Once the handoff is complete, operations on the old leashes for the given targets as well as
94      * callbacks will become no-ops.
95      *
96      * The number of targets MUST match the number of states, and each state MUST match the target
97      * at the same index.
98      */
handOffAnimation(in RemoteAnimationTarget[] targets, in WindowAnimationState[] states)99     oneway void handOffAnimation(in RemoteAnimationTarget[] targets,
100                     in WindowAnimationState[] states);
101 }
102