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 android.view; 18 19 import android.app.ActivityManager; 20 import android.view.IRemoteAnimationFinishedCallback; 21 import android.graphics.GraphicBuffer; 22 23 /** 24 * Passed to the {@link IRecentsAnimationRunner} in order for the runner to control to let the 25 * runner control certain aspects of the recents animation, and to notify window manager when the 26 * animation has completed. 27 * 28 * {@hide} 29 */ 30 interface IRecentsAnimationController { 31 32 /** 33 * Takes a screenshot of the task associated with the given {@param taskId}. Only valid for the 34 * current set of task ids provided to the handler. 35 */ 36 @UnsupportedAppUsage screenshotTask(int taskId)37 ActivityManager.TaskSnapshot screenshotTask(int taskId); 38 39 /** 40 * Notifies to the system that the animation into Recents should end, and all leashes associated 41 * with remote animation targets should be relinquished. If {@param moveHomeToTop} is true, then 42 * the home activity should be moved to the top. Otherwise, the home activity is hidden and the 43 * user is returned to the app. 44 * @param sendUserLeaveHint If set to true, {@link Activity#onUserLeaving} will be sent to the 45 * top resumed app, false otherwise. 46 */ 47 @UnsupportedAppUsage finish(boolean moveHomeToTop, boolean sendUserLeaveHint)48 void finish(boolean moveHomeToTop, boolean sendUserLeaveHint); 49 50 /** 51 * Called by the handler to indicate that the recents animation input consumer should be 52 * enabled. This is currently used to work around an issue where registering an input consumer 53 * mid-animation causes the existing motion event chain to be canceled. Instead, the caller 54 * may register the recents animation input consumer prior to starting the recents animation 55 * and then enable it mid-animation to start receiving touch events. 56 */ 57 @UnsupportedAppUsage setInputConsumerEnabled(boolean enabled)58 void setInputConsumerEnabled(boolean enabled); 59 60 /** 61 * Informs the system whether the animation targets passed into 62 * IRecentsAnimationRunner.onAnimationStart are currently behind the system bars. If they are, 63 * they can control the SystemUI flags, otherwise the SystemUI flags from home activity will be 64 * taken. 65 */ 66 @UnsupportedAppUsage setAnimationTargetsBehindSystemBars(boolean behindSystemBars)67 void setAnimationTargetsBehindSystemBars(boolean behindSystemBars); 68 69 /** 70 * Informs the system that the primary split-screen stack should be minimized. 71 */ setSplitScreenMinimized(boolean minimized)72 void setSplitScreenMinimized(boolean minimized); 73 74 /** 75 * Hides the current input method if one is showing. 76 */ hideCurrentInputMethod()77 void hideCurrentInputMethod(); 78 79 /** 80 * Set a state for controller whether would like to cancel recents animations with deferred 81 * task screenshot presentation. 82 * 83 * When we cancel the recents animation due to a stack order change, we can't just cancel it 84 * immediately as it would lead to a flicker in Launcher if we just remove the task from the 85 * leash. Instead we screenshot the previous task and replace the child of the leash with the 86 * screenshot, so that Launcher can still control the leash lifecycle & make the next app 87 * transition animate smoothly without flickering. 88 * 89 * @param screenshot When set {@code true}, means recents animation will be canceled when the 90 * next app launch. System will take previous task's screenshot when the next 91 * app transition starting, and skip previous task's animation. 92 * Set {@code false} means will not take screenshot & skip animation 93 * for previous task. 94 * 95 * @see #cleanupScreenshot() 96 * @see IRecentsAnimationRunner#onCancelled 97 */ setCancelWithDeferredScreenshot(boolean screenshot)98 void setCancelWithDeferredScreenshot(boolean screenshot); 99 100 /** 101 * Clean up the screenshot of previous task which was created during recents animation that 102 * was cancelled by a stack order change. 103 * 104 * @see {@link IRecentsAnimationRunner#onAnimationCanceled} 105 */ cleanupScreenshot()106 void cleanupScreenshot(); 107 } 108