RecentsAnimation.java revision bc2aabe84568c6b1a54c1b1467a539781488c8ca
1e2d721781fc024cbd9a14929741e5b476242291fWinson Chung/*
2e2d721781fc024cbd9a14929741e5b476242291fWinson Chung * Copyright (C) 2018 The Android Open Source Project
3e2d721781fc024cbd9a14929741e5b476242291fWinson Chung *
4e2d721781fc024cbd9a14929741e5b476242291fWinson Chung * Licensed under the Apache License, Version 2.0 (the "License");
5e2d721781fc024cbd9a14929741e5b476242291fWinson Chung * you may not use this file except in compliance with the License.
6e2d721781fc024cbd9a14929741e5b476242291fWinson Chung * You may obtain a copy of the License at
7e2d721781fc024cbd9a14929741e5b476242291fWinson Chung *
8e2d721781fc024cbd9a14929741e5b476242291fWinson Chung *      http://www.apache.org/licenses/LICENSE-2.0
9e2d721781fc024cbd9a14929741e5b476242291fWinson Chung *
10e2d721781fc024cbd9a14929741e5b476242291fWinson Chung * Unless required by applicable law or agreed to in writing, software
11e2d721781fc024cbd9a14929741e5b476242291fWinson Chung * distributed under the License is distributed on an "AS IS" BASIS,
12e2d721781fc024cbd9a14929741e5b476242291fWinson Chung * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e2d721781fc024cbd9a14929741e5b476242291fWinson Chung * See the License for the specific language governing permissions and
14e2d721781fc024cbd9a14929741e5b476242291fWinson Chung * limitations under the License.
15e2d721781fc024cbd9a14929741e5b476242291fWinson Chung */
16e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
17e2d721781fc024cbd9a14929741e5b476242291fWinson Chungpackage com.android.server.am;
18e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
19e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport static android.app.ActivityManager.StackId.INVALID_STACK_ID;
20e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
21e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
22e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
23584d652a1dba2b09975a1555c71ed339374faac7Winson Chungimport static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
24e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport static android.view.WindowManager.TRANSIT_NONE;
25e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS;
26e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
27e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport android.app.ActivityOptions;
28e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport android.content.ComponentName;
29e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport android.content.Intent;
30e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport android.os.Handler;
31ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chungimport android.os.RemoteException;
32584d652a1dba2b09975a1555c71ed339374faac7Winson Chungimport android.os.Trace;
33ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chungimport android.util.Slog;
34e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport android.view.IRecentsAnimationRunner;
35e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport com.android.server.wm.RecentsAnimationController.RecentsAnimationCallbacks;
36e2d721781fc024cbd9a14929741e5b476242291fWinson Chungimport com.android.server.wm.WindowManagerService;
37e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
38e2d721781fc024cbd9a14929741e5b476242291fWinson Chung/**
39e2d721781fc024cbd9a14929741e5b476242291fWinson Chung * Manages the recents animation, including the reordering of the stacks for the transition and
40e2d721781fc024cbd9a14929741e5b476242291fWinson Chung * cleanup. See {@link com.android.server.wm.RecentsAnimationController}.
41e2d721781fc024cbd9a14929741e5b476242291fWinson Chung */
42e2d721781fc024cbd9a14929741e5b476242291fWinson Chungclass RecentsAnimation implements RecentsAnimationCallbacks {
43e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    private static final String TAG = RecentsAnimation.class.getSimpleName();
44e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
45e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    private static final int RECENTS_ANIMATION_TIMEOUT = 10 * 1000;
46e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
47e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    private final ActivityManagerService mService;
48e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    private final ActivityStackSupervisor mStackSupervisor;
49e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    private final ActivityStartController mActivityStartController;
50e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    private final WindowManagerService mWindowManager;
51e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    private final UserController mUserController;
52e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    private final Handler mHandler;
53bc2aabe84568c6b1a54c1b1467a539781488c8caJorim Jaggi    private final int mCallingPid;
54e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
55e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    private final Runnable mCancelAnimationRunnable;
56e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
57e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    // The stack to restore the home stack behind when the animation is finished
58e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    private ActivityStack mRestoreHomeBehindStack;
59e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
60e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    RecentsAnimation(ActivityManagerService am, ActivityStackSupervisor stackSupervisor,
61e2d721781fc024cbd9a14929741e5b476242291fWinson Chung            ActivityStartController activityStartController, WindowManagerService wm,
62bc2aabe84568c6b1a54c1b1467a539781488c8caJorim Jaggi            UserController userController, int callingPid) {
63e2d721781fc024cbd9a14929741e5b476242291fWinson Chung        mService = am;
64e2d721781fc024cbd9a14929741e5b476242291fWinson Chung        mStackSupervisor = stackSupervisor;
65e2d721781fc024cbd9a14929741e5b476242291fWinson Chung        mActivityStartController = activityStartController;
66e2d721781fc024cbd9a14929741e5b476242291fWinson Chung        mHandler = new Handler(mStackSupervisor.mLooper);
67e2d721781fc024cbd9a14929741e5b476242291fWinson Chung        mWindowManager = wm;
68e2d721781fc024cbd9a14929741e5b476242291fWinson Chung        mUserController = userController;
69bc2aabe84568c6b1a54c1b1467a539781488c8caJorim Jaggi        mCallingPid = callingPid;
70ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung
71e2d721781fc024cbd9a14929741e5b476242291fWinson Chung        mCancelAnimationRunnable = () -> {
72e2d721781fc024cbd9a14929741e5b476242291fWinson Chung            // The caller has not finished the animation in a predefined amount of time, so
73e2d721781fc024cbd9a14929741e5b476242291fWinson Chung            // force-cancel the animation
74e2d721781fc024cbd9a14929741e5b476242291fWinson Chung            mWindowManager.cancelRecentsAnimation();
75e2d721781fc024cbd9a14929741e5b476242291fWinson Chung        };
76e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    }
77e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
78e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    void startRecentsActivity(Intent intent, IRecentsAnimationRunner recentsAnimationRunner,
79e2d721781fc024cbd9a14929741e5b476242291fWinson Chung            ComponentName recentsComponent, int recentsUid) {
80584d652a1dba2b09975a1555c71ed339374faac7Winson Chung        Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "RecentsAnimation#startRecentsActivity");
81ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung
82ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung        if (!mWindowManager.canStartRecentsAnimation()) {
83ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            notifyAnimationCancelBeforeStart(recentsAnimationRunner);
84ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            return;
85ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung        }
86ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung
87ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung        // If the existing home activity is already on top, then cancel
88ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung        ActivityRecord homeActivity = mStackSupervisor.getHomeActivity();
89ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung        final boolean hasExistingHomeActivity = homeActivity != null;
90ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung        if (hasExistingHomeActivity) {
91ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            final ActivityDisplay display = homeActivity.getDisplay();
92ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            mRestoreHomeBehindStack = display.getStackAboveHome();
93ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            if (mRestoreHomeBehindStack == null) {
94ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung                notifyAnimationCancelBeforeStart(recentsAnimationRunner);
95ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung                return;
96ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            }
97ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung        }
98ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung
99bc2aabe84568c6b1a54c1b1467a539781488c8caJorim Jaggi        mService.setRunningRemoteAnimation(mCallingPid, true);
100bc2aabe84568c6b1a54c1b1467a539781488c8caJorim Jaggi
1011e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung        mWindowManager.deferSurfaceLayout();
1021e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung        try {
103ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            final ActivityDisplay display;
104ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            if (hasExistingHomeActivity) {
105ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung                // Move the home activity into place for the animation if it is not already top most
106ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung                display = homeActivity.getDisplay();
107ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung                display.moveHomeStackBehindBottomMostVisibleStack();
108ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            } else {
1091e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                // No home activity
1101e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                final ActivityOptions opts = ActivityOptions.makeBasic();
1111e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                opts.setLaunchActivityType(ACTIVITY_TYPE_HOME);
1121e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                opts.setAvoidMoveToFront();
1131e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_NO_ANIMATION);
1141e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung
1151e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                mActivityStartController
1161e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        .obtainStarter(intent, "startRecentsActivity_noHomeActivity")
1171e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        .setCallingUid(recentsUid)
1181e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        .setCallingPackage(recentsComponent.getPackageName())
1191e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        .setActivityOptions(SafeActivityOptions.fromBundle(opts.toBundle()))
1201e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        .setMayWait(mUserController.getCurrentUserId())
1211e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        .execute();
1221e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                mWindowManager.prepareAppTransition(TRANSIT_NONE, false);
123e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
124ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung                homeActivity = mStackSupervisor.getHomeActivity();
125ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung                display = homeActivity.getDisplay();
126ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung
1271e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                // TODO: Maybe wait for app to draw in this particular case?
1281e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung            }
129e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
1301e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung            // Mark the home activity as launch-behind to bump its visibility for the
1311e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung            // duration of the gesture that is driven by the recents component
1321e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung            homeActivity.mLaunchTaskBehind = true;
133e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
134ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            // Post a timeout for the animation. This needs to happen before initializing the
135ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            // recents animation on the WM side since we may decide to cancel the animation there
136ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            mHandler.postDelayed(mCancelAnimationRunnable, RECENTS_ANIMATION_TIMEOUT);
137ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung
1381e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung            // Fetch all the surface controls and pass them to the client to get the animation
1391e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung            // started
14065fc89acafc2c359751af4c4a7b6c6753c1b4e47Winson Chung            mWindowManager.cancelRecentsAnimation();
1411e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung            mWindowManager.initializeRecentsAnimation(recentsAnimationRunner, this,
1421e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    display.mDisplayId);
143e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
1441e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung            // If we updated the launch-behind state, update the visibility of the activities after
1451e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung            // we fetch the visible tasks to be controlled by the animation
1461e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung            mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, PRESERVE_WINDOWS);
1471e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung        } finally {
1481e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung            mWindowManager.continueSurfaceLayout();
149584d652a1dba2b09975a1555c71ed339374faac7Winson Chung            Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
1501e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung        }
151e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    }
152e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
153e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    @Override
154e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    public void onAnimationFinished(boolean moveHomeToTop) {
155e2d721781fc024cbd9a14929741e5b476242291fWinson Chung        mHandler.removeCallbacks(mCancelAnimationRunnable);
156e2d721781fc024cbd9a14929741e5b476242291fWinson Chung        synchronized (mService) {
157e2d721781fc024cbd9a14929741e5b476242291fWinson Chung            if (mWindowManager.getRecentsAnimationController() == null) return;
158e2d721781fc024cbd9a14929741e5b476242291fWinson Chung
159bc2aabe84568c6b1a54c1b1467a539781488c8caJorim Jaggi            mService.setRunningRemoteAnimation(mCallingPid, false);
160bc2aabe84568c6b1a54c1b1467a539781488c8caJorim Jaggi
161e2d721781fc024cbd9a14929741e5b476242291fWinson Chung            mWindowManager.inSurfaceTransaction(() -> {
162584d652a1dba2b09975a1555c71ed339374faac7Winson Chung                Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER,
163584d652a1dba2b09975a1555c71ed339374faac7Winson Chung                        "RecentsAnimation#onAnimationFinished_inSurfaceTransaction");
1641e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                mWindowManager.deferSurfaceLayout();
1651e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                try {
1661e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    mWindowManager.cleanupRecentsAnimation();
1671e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung
1681e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    // Move the home stack to the front
1691e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    final ActivityRecord homeActivity = mStackSupervisor.getHomeActivity();
1701e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    if (homeActivity == null) {
1711e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        return;
1721e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    }
1731e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung
1741e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    // Restore the launched-behind state
1751e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    homeActivity.mLaunchTaskBehind = false;
1761e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung
1771e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    if (moveHomeToTop) {
1781e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        // Bring the home stack to the front
1791e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        final ActivityStack homeStack = homeActivity.getStack();
180fa9ed96f1e9970e8867daa0b76175006c082b890Jorim Jaggi                        mStackSupervisor.mNoAnimActivities.add(homeActivity);
1811e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        homeStack.moveToFront("RecentsAnimation.onAnimationFinished()");
1821e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    } else {
1831e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        // Restore the home stack to its previous position
1841e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        final ActivityDisplay display = homeActivity.getDisplay();
1851e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                        display.moveHomeStackBehindStack(mRestoreHomeBehindStack);
1861e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    }
1871e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung
1881e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    mWindowManager.prepareAppTransition(TRANSIT_NONE, false);
1891e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, false);
1901e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    mStackSupervisor.resumeFocusedStackTopActivityLocked();
1911e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung
1921e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    // No reason to wait for the pausing activity in this case, as the hiding of
1931e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    // surfaces needs to be done immediately.
1941e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    mWindowManager.executeAppTransition();
1951e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                } finally {
1961e6d4a9e001f910de9396f4056eb74fdf9b8257cWinson Chung                    mWindowManager.continueSurfaceLayout();
197584d652a1dba2b09975a1555c71ed339374faac7Winson Chung                    Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
198e2d721781fc024cbd9a14929741e5b476242291fWinson Chung                }
199e2d721781fc024cbd9a14929741e5b476242291fWinson Chung            });
200e2d721781fc024cbd9a14929741e5b476242291fWinson Chung        }
201e2d721781fc024cbd9a14929741e5b476242291fWinson Chung    }
202ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung
203ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung    /**
204ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung     * Called only when the animation should be canceled prior to starting.
205ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung     */
206ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung    private void notifyAnimationCancelBeforeStart(IRecentsAnimationRunner recentsAnimationRunner) {
207ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung        try {
208ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            recentsAnimationRunner.onAnimationCanceled();
209ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung        } catch (RemoteException e) {
210ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung            Slog.e(TAG, "Failed to cancel recents animation before start", e);
211ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung        }
212ddf62975798eff2a68422d075441a4bfcf1cd6b4Winson Chung    }
213e2d721781fc024cbd9a14929741e5b476242291fWinson Chung}
214