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

Commit eac42a98 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Initialize display id of fixed rotation listener correctly

- Make sure the listener uses the initialized DisplayContent#mDisplayId.
- Avoid using unexpected member of AppTransitionListener.
  e.g. DisplayContent#mDisplayId will be hidden by
  AppTransitionListener#mDisplayId in FixedRotationTransitionListener
  because the listener is an inner class of DisplayContent.
  So rename to AppTransitionListener#mTargetDisplayId.

Bug: 354626262
Bug: 326610743
Flag: EXEMPT bugfix
Test: TransitionTests
Change-Id: I2d7ca5fdc0a2a468c1d96f2836a11d00714e5e27
parent ebc0c099
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -619,8 +619,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    private static final long FIXED_ROTATION_HIDE_ANIMATION_DEBOUNCE_DELAY_MS = 250;
    private AsyncRotationController mAsyncRotationController;

    final FixedRotationTransitionListener mFixedRotationTransitionListener =
            new FixedRotationTransitionListener();
    final FixedRotationTransitionListener mFixedRotationTransitionListener;

    @VisibleForTesting
    final DeviceStateController mDeviceStateController;
@@ -1163,6 +1162,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                TAG_WM + "/displayId:" + mDisplayId, mDisplayId);
        mHoldScreenWakeLock.setReferenceCounted(false);

        mFixedRotationTransitionListener = new FixedRotationTransitionListener(mDisplayId);
        mAppTransition = new AppTransition(mWmService.mContext, mWmService, this);
        mAppTransition.registerListenerLocked(mWmService.mActivityManagerAppTransitionNotifier);
        mAppTransition.registerListenerLocked(mFixedRotationTransitionListener);
@@ -6927,8 +6927,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        /** Whether {@link #mAnimatingRecents} is going to be the top activity. */
        private boolean mRecentsWillBeTop;

        FixedRotationTransitionListener() {
            super(DisplayContent.this.mDisplayId);
        FixedRotationTransitionListener(int displayId) {
            super(displayId);
        }

        /**
@@ -7017,7 +7017,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            // by finishing the recents animation and moving it to top. That also avoids flickering
            // due to wait for previous activity to be paused if it supports PiP that ignores the
            // effect of resume-while-pausing.
            if (r == null || r == mAnimatingRecents || r.getDisplayId() != mDisplayId) {
            if (r == null || r == mAnimatingRecents) {
                return;
            }
            if (mAnimatingRecents != null && mRecentsWillBeTop) {
+2 −1
Original line number Diff line number Diff line
@@ -1350,7 +1350,8 @@ class TransitionController {
    private static boolean shouldDispatchLegacyListener(
            WindowManagerInternal.AppTransitionListener listener, int displayId) {
        // INVALID_DISPLAY means that it is a global listener.
        return listener.mDisplayId == Display.INVALID_DISPLAY || listener.mDisplayId == displayId;
        return listener.mTargetDisplayId == Display.INVALID_DISPLAY
                || listener.mTargetDisplayId == displayId;
    }

    void dispatchLegacyAppTransitionPending(int displayId) {
+2 −2
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ public abstract class WindowManagerInternal {
         * The display this listener is interested in. If it is INVALID_DISPLAY, then which display
         * should be notified depends on the dispatcher.
         */
        public final int mDisplayId;
        public final int mTargetDisplayId;

        /** Let transition controller decide which display should receive the callbacks. */
        public AppTransitionListener() {
@@ -256,7 +256,7 @@ public abstract class WindowManagerInternal {

        /** It will listen the transition on the given display. */
        public AppTransitionListener(int displayId) {
            mDisplayId = displayId;
            mTargetDisplayId = displayId;
        }

        /**