Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c395c4ec authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Wait for animation done when sleeping

When pressing the home button when showing a show-when-locked
activity on top of Keyguard, stop signal was sent too early,
leading to a hole in various apps, for example, Camera, because
stop signal wasn't deferred until animation was done.

Since we only use sleep token for display off and Keyguard, we
think it's safe to also wait for animation done in that case, but
not for shutting down.

Also make sure to only check for transition type.

Test: Press home button while showing Secure camera on top of
locked Keyguard, observe no hole
Fixes: 156514461

Change-Id: I527747ae9b3042beee233f5436db3acf3df97964
parent ab476cc5
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ import static com.android.server.wm.ActivityTaskManagerService.RELAUNCH_REASON_N
import static com.android.server.wm.RootWindowContainer.MATCH_TASK_IN_STACKS_OR_RECENT_TASKS;
import static com.android.server.wm.RootWindowContainer.MATCH_TASK_IN_STACKS_OR_RECENT_TASKS_AND_RESTORE;
import static com.android.server.wm.RootWindowContainer.TAG_STATES;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
import static com.android.server.wm.Task.FLAG_FORCE_HIDDEN_FOR_PINNED_TASK;
import static com.android.server.wm.Task.LOCK_TASK_AUTH_LAUNCHABLE;
import static com.android.server.wm.Task.LOCK_TASK_AUTH_LAUNCHABLE_PRIV;
@@ -1807,15 +1808,11 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
        ArrayList<ActivityRecord> readyToStopActivities = null;
        for (int i = mStoppingActivities.size() - 1; i >= 0; --i) {
            final ActivityRecord s = mStoppingActivities.get(i);
            final boolean animating = s.isAnimating(TRANSITION | PARENTS);
            final boolean animating = s.isAnimating(TRANSITION | PARENTS,
                    ANIMATION_TYPE_APP_TRANSITION);
            if (DEBUG_STATES) Slog.v(TAG, "Stopping " + s + ": nowVisible=" + s.nowVisible
                    + " animating=" + animating + " finishing=" + s.finishing);

            final ActivityStack stack = s.getRootTask();
            final boolean shouldSleepOrShutDown = stack != null
                    ? stack.shouldSleepOrShutDownActivities()
                    : mService.isSleepingOrShuttingDownLocked();
            if (!animating || shouldSleepOrShutDown) {
            if (!animating || mService.mShuttingDown) {
                if (!processPausingActivities && s.isState(PAUSING)) {
                    // Defer processing pausing activities in this iteration and reschedule
                    // a delayed idle to reprocess it again