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

Commit 49c0ea0c authored by Filip Gruszczynski's avatar Filip Gruszczynski Committed by Android (Google) Code Review
Browse files

Merge "Fix crash when docking from recents."

parents 5fd37dd9 96daf32e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -528,6 +528,15 @@ public class ActivityManager {
            return stackId == FULLSCREEN_WORKSPACE_STACK_ID
                    || stackId == DOCKED_STACK_ID || stackId == PINNED_STACK_ID;
        }

        /**
         * Returns true if animation specs should be constructed for app transition that moves
         * the task to the specified stack.
         */
        public static boolean useAnimationSpecForAppTransition(int stackId) {
            return stackId == FREEFORM_WORKSPACE_STACK_ID
                    || stackId == FULLSCREEN_WORKSPACE_STACK_ID || stackId == DOCKED_STACK_ID;
        }
    }

    /**
+4 −2
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package com.android.systemui.recents.views;

import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManager.StackId;
import android.app.ActivityOptions;
import android.content.Context;
import android.graphics.Bitmap;
@@ -47,6 +49,7 @@ import com.android.systemui.recents.model.TaskStack;
import java.util.ArrayList;
import java.util.List;

import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
@@ -243,8 +246,7 @@ public class RecentsTransitionHelper {
        // Ensure we have a valid target stack id
        final int targetStackId = destinationStack != INVALID_STACK_ID ?
                destinationStack : task.key.stackId;
        if (targetStackId != FREEFORM_WORKSPACE_STACK_ID
                && targetStackId != FULLSCREEN_WORKSPACE_STACK_ID) {
        if (!StackId.useAnimationSpecForAppTransition(targetStackId)) {
            return null;
        }

+3 −1
Original line number Diff line number Diff line
@@ -1480,8 +1480,10 @@ public class AppTransition implements Dump {
                                mNextAppTransitionFutureCallback, null /* finishedCallback */,
                                mNextAppTransitionScaleUp);
                        mNextAppTransitionFutureCallback = null;
                        if (specs != null) {
                            mService.prolongAnimationsFromSpecs(specs, mNextAppTransitionScaleUp);
                        }
                    }
                    mService.requestTraversal();
                }
            });
+2 −5
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ import static com.android.server.wm.AppWindowAnimator.PROLONG_ANIMATION_AT_START

import android.Manifest;
import android.animation.ValueAnimator;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManagerNative;
import android.app.AppOpsManager;
@@ -3700,14 +3701,10 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    void prolongAnimationsFromSpecs(AppTransitionAnimationSpec[] specs, boolean scaleUp) {
    void prolongAnimationsFromSpecs(@NonNull AppTransitionAnimationSpec[] specs, boolean scaleUp) {
        // This is used by freeform <-> recents windows transition. We need to synchronize
        // the animation with the appearance of the content of recents, so we will make
        // animation stay on the first or last frame a little longer.
        if (specs == null) {
            Slog.wtf(TAG, "prolongAnimationsFromSpecs: AppTransitionAnimationSpec is null!");
            return;
        }
        mTmpTaskIds.clear();
        for (int i = specs.length - 1; i >= 0; i--) {
            mTmpTaskIds.put(specs[i].taskId, 0);