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

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

Merge "Revert^2 "Explicitly release all surfaces after transition completed"" into main

parents 2a2f062d 08b2373d
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,17 @@ flag {
    }
    }
}
}


flag {
  name: "release_surface_on_transition_finish"
  namespace: "windowing_frontend"
  description: "Reduce offscreen layers which rely on GC to release"
  bug: "407719374"
  is_fixed_read_only: true
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
flag {
  name: "cache_window_style"
  name: "cache_window_style"
  namespace: "windowing_frontend"
  namespace: "windowing_frontend"
+18 −10
Original line number Original line Diff line number Diff line
@@ -357,6 +357,9 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
                mInteractionJankMonitor.end(CUJ_DEFAULT_TASK_TO_TASK_ANIMATION);
                mInteractionJankMonitor.end(CUJ_DEFAULT_TASK_TO_TASK_ANIMATION);
            }
            }
            mAnimations.remove(transition);
            mAnimations.remove(transition);
            if (Flags.releaseSurfaceOnTransitionFinish()) {
                info.releaseAllSurfaces();
            }
            finishCallback.onTransitionFinished(null /* wct */);
            finishCallback.onTransitionFinished(null /* wct */);
        };
        };


@@ -623,8 +626,10 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {


        startTransaction.apply();
        startTransaction.apply();


        final boolean hasAnimations = !animations.isEmpty();
        // now start animations. they are started on another thread, so we have to post them
        // now start animations. they are started on another thread, so we have to post them
        // *after* applying the startTransaction
        // *after* applying the startTransaction
        if (hasAnimations) {
            mAnimExecutor.execute(() -> {
            mAnimExecutor.execute(() -> {
                if (isTaskTransition) {
                if (isTaskTransition) {
                    mInteractionJankMonitor.begin(info.getRoot(0).getLeash(), mContext,
                    mInteractionJankMonitor.begin(info.getRoot(0).getLeash(), mContext,
@@ -634,11 +639,14 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
                    animations.get(i).start();
                    animations.get(i).start();
                }
                }
            });
            });
        }


        mRotator.cleanUp(finishTransaction);
        mRotator.cleanUp(finishTransaction);
        TransitionMetrics.getInstance().reportAnimationStart(transition);
        TransitionMetrics.getInstance().reportAnimationStart(transition);
        // run finish now in-case there are no animations
        // run finish now in-case there are no animations
        if (!hasAnimations) {
            onAnimFinish.run();
            onAnimFinish.run();
        }
        return true;
        return true;
    }
    }