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

Commit ecf4725e authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Fix issue #7401818: Wrong transition animation when clearing task" into jb-mr1-dev

parents 799916e6 9622ca4f
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -602,6 +602,15 @@ final class ActivityRecord {
        }
    }

    void updateOptionsLocked(ActivityOptions options) {
        if (options != null) {
            if (pendingOptions != null) {
                pendingOptions.abort();
            }
            pendingOptions = options;
        }
    }

    void applyOptionsLocked() {
        if (pendingOptions != null) {
            final int animationType = pendingOptions.getAnimationType();
@@ -653,6 +662,12 @@ final class ActivityRecord {
        }
    }

    ActivityOptions takeOptionsLocked() {
        ActivityOptions opts = pendingOptions;
        pendingOptions = null;
        return opts;
    }

    void removeUriPermissionsLocked() {
        if (uriPermissions != null) {
            uriPermissions.removeUriPermissionsLocked();
+33 −1
Original line number Diff line number Diff line
@@ -1963,6 +1963,8 @@ final class ActivityStack {
        int taskTopI = -1;
        int replyChainEnd = -1;
        int lastReparentPos = -1;
        ActivityOptions topOptions = null;
        boolean canMoveOptions = true;
        for (int i=mHistory.size()-1; i>=-1; i--) {
            ActivityRecord below = i >= 0 ? mHistory.get(i) : null;
            
@@ -2048,6 +2050,7 @@ final class ActivityStack {
                        }
                        int dstPos = 0;
                        ThumbnailHolder curThumbHolder = target.thumbHolder;
                        boolean gotOptions = !canMoveOptions;
                        for (int srcPos=targetI; srcPos<=replyChainEnd; srcPos++) {
                            p = mHistory.get(srcPos);
                            if (p.finishing) {
@@ -2057,6 +2060,13 @@ final class ActivityStack {
                                    + " out to target's task " + target.task);
                            p.setTask(target.task, curThumbHolder, false);
                            curThumbHolder = p.thumbHolder;
                            canMoveOptions = false;
                            if (!gotOptions && topOptions == null) {
                                topOptions = p.takeOptionsLocked();
                                if (topOptions != null) {
                                    gotOptions = true;
                                }
                            }
                            if (DEBUG_ADD_REMOVE) {
                                RuntimeException here = new RuntimeException("here");
                                here.fillInStackTrace();
@@ -2101,11 +2111,19 @@ final class ActivityStack {
                            replyChainEnd = targetI;
                        }
                        ActivityRecord p = null;
                        boolean gotOptions = !canMoveOptions;
                        for (int srcPos=targetI; srcPos<=replyChainEnd; srcPos++) {
                            p = mHistory.get(srcPos);
                            if (p.finishing) {
                                continue;
                            }
                            canMoveOptions = false;
                            if (!gotOptions && topOptions == null) {
                                topOptions = p.takeOptionsLocked();
                                if (topOptions != null) {
                                    gotOptions = true;
                                }
                            }
                            if (finishActivityLocked(p, srcPos,
                                    Activity.RESULT_CANCELED, null, "reset", false)) {
                                replyChainEnd--;
@@ -2246,6 +2264,16 @@ final class ActivityStack {
            targetI = i;
        }

        if (topOptions != null) {
            // If we got some ActivityOptions from an activity on top that
            // was removed from the task, propagate them to the new real top.
            if (taskTop != null) {
                taskTop.updateOptionsLocked(topOptions);
            } else {
                topOptions.abort();
            }
        }

        return taskTop;
    }
    
@@ -2296,6 +2324,10 @@ final class ActivityStack {
                    if (r.finishing) {
                        continue;
                    }
                    ActivityOptions opts = r.takeOptionsLocked();
                    if (opts != null) {
                        ret.updateOptionsLocked(opts);
                    }
                    if (finishActivityLocked(r, i, Activity.RESULT_CANCELED,
                            null, "clear", false)) {
                        i--;