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

Commit b94eb691 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "[PB] While merge second transition, ignore the change mode target" into main

parents 4fd16321 c09120ae
Loading
Loading
Loading
Loading
+19 −2
Original line number Original line Diff line number Diff line
@@ -1459,8 +1459,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
                        }
                        }
                        moveToTop = change.hasFlags(FLAG_MOVED_TO_TOP);
                        moveToTop = change.hasFlags(FLAG_MOVED_TO_TOP);
                        info.getChanges().remove(j);
                        info.getChanges().remove(j);
                    } else if ((openShowWallpaper && change.hasFlags(FLAG_IS_WALLPAPER))
                    } else if ((openShowWallpaper && change.hasFlags(FLAG_IS_WALLPAPER))) {
                            || !change.hasFlags(FLAG_BACK_GESTURE_ANIMATED)) {
                        info.getChanges().remove(j);
                        info.getChanges().remove(j);
                    } else if (!mergePredictive && TransitionUtil.isClosingMode(change.getMode())) {
                    } else if (!mergePredictive && TransitionUtil.isClosingMode(change.getMode())) {
                        mergePredictive = true;
                        mergePredictive = true;
@@ -1483,6 +1482,13 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
                            if (moveToTop) {
                            if (moveToTop) {
                                change.setFlags(change.getFlags() | FLAG_MOVED_TO_TOP);
                                change.setFlags(change.getFlags() | FLAG_MOVED_TO_TOP);
                            }
                            }
                        } else if (Flags.unifyBackNavigationTransition()
                                && change.hasFlags(FLAG_BACK_GESTURE_ANIMATED)
                                && change.getMode() == TRANSIT_CHANGE
                                && isCloseChangeExist(info, change)) {
                            // This is the original top target, don't add it into current transition
                            // if it is closing.
                            continue;
                        }
                        }
                        info.getChanges().add(i, change);
                        info.getChanges().add(i, change);
                    }
                    }
@@ -1814,6 +1820,17 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont
        return findComponentName(change) != null || findTaskId(change) != INVALID_TASK_ID;
        return findComponentName(change) != null || findTaskId(change) != INVALID_TASK_ID;
    }
    }


    private static boolean isCloseChangeExist(TransitionInfo info, TransitionInfo.Change change) {
        for (int j = info.getChanges().size() - 1; j >= 0; --j) {
            final TransitionInfo.Change current = info.getChanges().get(j);
            if (TransitionUtil.isClosingMode(current.getMode())
                    && change.getLeash().isSameSurface(current.getLeash())) {
                return true;
            }
        }
        return false;
    }

    // Record the latest back gesture happen on which task.
    // Record the latest back gesture happen on which task.
    static class BackTransitionObserver implements Transitions.TransitionObserver {
    static class BackTransitionObserver implements Transitions.TransitionObserver {
        int mFocusedTaskId = INVALID_TASK_ID;
        int mFocusedTaskId = INVALID_TASK_ID;