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

Commit b46c4feb authored by lumark's avatar lumark
Browse files

Fix ActivityRecord#attachCrossProfileAppsThumbnailAnimation issue

Since Cross-Profile app thumbnail animation is an transparent animation
layer which should be above SnapShotStartWindow (attached in
ActivityRecord), and the layer should be attached in its root task.

Also, use getRelativeFrameLw to get relative position of its parent for
thumbnail surface.

Fix: 149692548
Test: manual as below steps:
1. Create a work profile (e.g. via TestDPC - go/testdpc)
2. Launch a personal app that supports the CrossProfileApps API (e.g. Gmail),
   ensuring that said app is also installed in the work profile
3. Tap "Switch to work profile"
Expecting Profile switching animation background to be semi-transparent

Change-Id: Ib19f669fac891f1d9d7aa765db89538057dd6318
parent ccd4db5e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -5931,7 +5931,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (win == null) {
            return;
        }
        final Rect frame = win.getFrameLw();
        final Rect frame = win.getRelativeFrameLw();
        final int thumbnailDrawableRes = task.mUserId == mWmService.mCurrentUserId
                ? R.drawable.ic_account_circle
                : R.drawable.ic_corp_badge;
@@ -5941,12 +5941,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (thumbnail == null) {
            return;
        }
        final Transaction transaction = getAnimatingContainer().getPendingTransaction();
        final Transaction transaction = getPendingTransaction();
        mThumbnail = new WindowContainerThumbnail(mWmService.mSurfaceFactory,
                transaction, getAnimatingContainer(), thumbnail);
                transaction, getTask(), thumbnail);
        final Animation animation =
                getDisplayContent().mAppTransition.createCrossProfileAppsThumbnailAnimationLocked(
                        win.getFrameLw());
                        frame);
        mThumbnail.startAnimation(transaction, animation, new Point(frame.left, frame.top));
    }

+2 −2
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ class WindowContainerThumbnail implements Animatable {
        // TODO: This should be attached as a child to the app token, once the thumbnail animations
        // use relative coordinates. Once we start animating task we can also consider attaching
        // this to the task.
        mSurfaceControl = mWindowContainer.makeSurface()
        mSurfaceControl = mWindowContainer.makeChildSurface(mWindowContainer.getTopChild())
                .setName("thumbnail anim: " + mWindowContainer.toString())
                .setBufferSize(mWidth, mHeight)
                .setFormat(PixelFormat.TRANSLUCENT)
@@ -209,7 +209,7 @@ class WindowContainerThumbnail implements Animatable {

    @Override
    public Builder makeAnimationLeash() {
        return mWindowContainer.makeSurface();
        return mWindowContainer.makeChildSurface(mWindowContainer.getTopChild());
    }

    @Override