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

Commit 82267ce1 authored by Winson Chung's avatar Winson Chung
Browse files

Prevent extraneous saving of pinned snap fraction.

- When the PIP is dismissed offscreen, the pinned stack can receive
  onConfigurationChanged (when its windowing mode is set back to
  fullscreen) after the stack is hidden.  In this case, the saved snap
  fraction will be incorrect leading to a wrong animation on the next
  PiP animation. We don't expect the snap fraction to be saved in this
  case since the user is not expanding the PiP.
- Also add the animating-bounds state to the proto for use in the cts
  tests.

Bug: 73775460
Test: atest CtsActivityManagerDeviceTestCases:ActivityManagerPinnedStackTests
Change-Id: I30398ecf11de045d11a95282b8203e4d2d344ae9
parent 1b5a0deb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -220,6 +220,7 @@ message StackProto {
  optional float adjust_ime_amount = 10;
  optional float adjust_divider_amount = 11;
  optional .android.graphics.RectProto adjusted_bounds = 12;
  optional bool animating_bounds = 13;
}

/* represents Task */
+2 −1
Original line number Diff line number Diff line
@@ -1312,7 +1312,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        if (prevWinMode != WINDOWING_MODE_UNDEFINED && winMode == WINDOWING_MODE_PINNED) {
            // Entering PiP from fullscreen, reset the snap fraction
            mDisplayContent.mPinnedStackControllerLocked.resetReentrySnapFraction(this);
        } else if (prevWinMode == WINDOWING_MODE_PINNED && winMode != WINDOWING_MODE_UNDEFINED) {
        } else if (prevWinMode == WINDOWING_MODE_PINNED && winMode != WINDOWING_MODE_UNDEFINED
                && !isHidden()) {
            // Leaving PiP to fullscreen, save the snap fraction based on the pre-animation bounds
            // for the next re-entry into PiP (assuming the activity is not hidden or destroyed)
            final TaskStack pinnedStack = mDisplayContent.getPinnedStack();
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import static com.android.server.wm.StackProto.ADJUSTED_BOUNDS;
import static com.android.server.wm.StackProto.ADJUSTED_FOR_IME;
import static com.android.server.wm.StackProto.ADJUST_DIVIDER_AMOUNT;
import static com.android.server.wm.StackProto.ADJUST_IME_AMOUNT;
import static com.android.server.wm.StackProto.ANIMATING_BOUNDS;
import static com.android.server.wm.StackProto.ANIMATION_BACKGROUND_SURFACE_IS_DIMMING;
import static com.android.server.wm.StackProto.BOUNDS;
import static com.android.server.wm.StackProto.DEFER_REMOVAL;
@@ -1363,6 +1364,7 @@ public class TaskStack extends WindowContainer<Task> implements
        proto.write(ADJUST_IME_AMOUNT, mAdjustImeAmount);
        proto.write(ADJUST_DIVIDER_AMOUNT, mAdjustDividerAmount);
        mAdjustedBounds.writeToProto(proto, ADJUSTED_BOUNDS);
        proto.write(ANIMATING_BOUNDS, mBoundsAnimating);
        proto.end(token);
    }