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

Commit 7f52ead9 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge changes I1eafd69c,I4c5e401c into main

* changes:
  Skip performance hint for the end of scene transition
  Fix missing transition with visibility change when changing opaque
parents bb678447 debb9afe
Loading
Loading
Loading
Loading
+26 −13
Original line number Diff line number Diff line
@@ -421,8 +421,11 @@ public final class TransitionInfo implements Parcelable {
        final String perChangeLineStart = shouldPrettyPrint ? "\n" + innerPrefix : "";
        StringBuilder sb = new StringBuilder();
        sb.append("{id=").append(mDebugId).append(" t=").append(transitTypeToString(mType))
                .append(" f=0x").append(Integer.toHexString(mFlags)).append(" trk=").append(mTrack)
                .append(" r=[");
                .append(" f=0x").append(Integer.toHexString(mFlags)).append(" trk=").append(mTrack);
        if (mOptions != null) {
            sb.append(" opt=").append(mOptions);
        }
        sb.append(" r=[");
        for (int i = 0; i < mRoots.size(); ++i) {
            if (i > 0) {
                sb.append(',');
@@ -1211,21 +1214,31 @@ public final class TransitionInfo implements Parcelable {

        @NonNull
        private static String typeToString(int mode) {
            switch(mode) {
                case ANIM_CUSTOM: return "ANIM_CUSTOM";
                case ANIM_CLIP_REVEAL: return "ANIM_CLIP_REVEAL";
                case ANIM_SCALE_UP: return "ANIM_SCALE_UP";
                case ANIM_THUMBNAIL_SCALE_UP: return "ANIM_THUMBNAIL_SCALE_UP";
                case ANIM_THUMBNAIL_SCALE_DOWN: return "ANIM_THUMBNAIL_SCALE_DOWN";
                case ANIM_OPEN_CROSS_PROFILE_APPS: return "ANIM_OPEN_CROSS_PROFILE_APPS";
                default: return "<unknown:" + mode + ">";
            }
            return switch (mode) {
                case ANIM_CUSTOM -> "CUSTOM";
                case ANIM_SCALE_UP -> "SCALE_UP";
                case ANIM_THUMBNAIL_SCALE_UP -> "THUMBNAIL_SCALE_UP";
                case ANIM_THUMBNAIL_SCALE_DOWN -> "THUMBNAIL_SCALE_DOWN";
                case ANIM_SCENE_TRANSITION -> "SCENE_TRANSITION";
                case ANIM_CLIP_REVEAL -> "CLIP_REVEAL";
                case ANIM_OPEN_CROSS_PROFILE_APPS -> "OPEN_CROSS_PROFILE_APPS";
                case ANIM_FROM_STYLE -> "FROM_STYLE";
                default -> "<" + mode + ">";
            };
        }

        @Override
        public String toString() {
            return "{ AnimationOptions type= " + typeToString(mType) + " package=" + mPackageName
                    + " override=" + mOverrideTaskTransition + " b=" + mTransitionBounds + "}";
            final StringBuilder sb = new StringBuilder(32);
            sb.append("{t=").append(typeToString(mType));
            if (mOverrideTaskTransition) {
                sb.append(" overrideTask=true");
            }
            if (!mTransitionBounds.isEmpty()) {
                sb.append(" bounds=").append(mTransitionBounds);
            }
            sb.append('}');
            return sb.toString();
        }

        /** Customized activity transition. */
+8 −3
Original line number Diff line number Diff line
@@ -778,17 +778,22 @@ class ActivityClientController extends IActivityClientController.Stub {
        try {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r == null) {
                    return false;
                }
                // Create a transition if the activity is playing in case the below activity didn't
                // commit invisible. That's because if any activity below this one has changed its
                // visibility while playing transition, there won't able to commit visibility until
                // the running transition finish.
                final Transition transition = r != null
                        && r.mTransitionController.inPlayingTransition(r)
                final Transition transition = r.mTransitionController.isShellTransitionsEnabled()
                        && !r.mTransitionController.isCollecting()
                        ? r.mTransitionController.createTransition(TRANSIT_TO_BACK) : null;
                final boolean changed = r != null && r.setOccludesParent(true);
                final boolean changed = r.setOccludesParent(true);
                if (transition != null) {
                    if (changed) {
                        // Always set as scene transition because it expects to be a jump-cut.
                        transition.setOverrideAnimation(TransitionInfo.AnimationOptions
                                .makeSceneTransitionAnimOptions(), null, null);
                        r.mTransitionController.requestStartTransition(transition,
                                null /*startTask */, null /* remoteTransition */,
                                null /* displayChange */);
+0 −1
Original line number Diff line number Diff line
@@ -3093,7 +3093,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        final boolean changed = occludesParent != mOccludesParent;
        mOccludesParent = occludesParent;
        setMainWindowOpaque(occludesParent);
        mWmService.mWindowPlacerLocked.requestTraversal();

        if (changed && task != null && !occludesParent) {
            getRootTask().convertActivityToTranslucent(this);
+13 −0
Original line number Diff line number Diff line
@@ -2841,6 +2841,19 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        }
    }

    /** Returns {@code true} if the display should use high performance hint for this transition. */
    boolean shouldUsePerfHint(@NonNull DisplayContent dc) {
        if (mOverrideOptions != null
                && mOverrideOptions.getType() == ActivityOptions.ANIM_SCENE_TRANSITION
                && mType == TRANSIT_TO_BACK && mParticipants.size() == 1) {
            // This should be from convertFromTranslucent that makes the occluded activity invisible
            // without animation. So do not use perf hint (especially early-wakeup) that may disturb
            // SurfaceFlinger scheduling around the last frame.
            return false;
        }
        return mTargetDisplays.contains(dc);
    }

    /**
     * Returns {@code true} if the transition and the corresponding transaction should be applied
     * on display thread. Currently, this only checks for display rotation change because the order
+8 −1
Original line number Diff line number Diff line
@@ -1237,8 +1237,15 @@ class TransitionController {
            // enableHighPerfTransition(true) is also called in Transition#recordDisplay.
            for (int i = mAtm.mRootWindowContainer.getChildCount() - 1; i >= 0; i--) {
                final DisplayContent dc = mAtm.mRootWindowContainer.getChildAt(i);
                if (isTransitionOnDisplay(dc)) {
                if (mCollectingTransition != null && mCollectingTransition.shouldUsePerfHint(dc)) {
                    dc.enableHighPerfTransition(true);
                    continue;
                }
                for (int j = mPlayingTransitions.size() - 1; j >= 0; j--) {
                    if (mPlayingTransitions.get(j).shouldUsePerfHint(dc)) {
                        dc.enableHighPerfTransition(true);
                        break;
                    }
                }
            }
            // Usually transitions put quite a load onto the system already (with all the things