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

Commit 537e9e22 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role)
Browse files

[automerger] Using the split screen secondory bounds returned by SystemUIProxy am: a18918a0

Change-Id: I1ba38c87eddb2f63a621cf9918483b5b0553a1ea
parents 453e0cd3 a18918a0
Loading
Loading
Loading
Loading
+39 −21
Original line number Diff line number Diff line
@@ -26,14 +26,17 @@ import android.graphics.Matrix.ScaleToFit;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.RemoteException;

import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskThumbnailView;
import com.android.systemui.shared.recents.ISystemUiProxy;
import com.android.systemui.shared.recents.utilities.RectFEvaluator;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.TransactionCompat;
@@ -171,7 +174,36 @@ public class ClipAnimationHelper {
        mHomeStackBounds.offset(pos[0], pos[1]);

        if (rv.shouldUseMultiWindowTaskSizeStrategy()) {
            // TODO: Fetch multi-window target bounds from system-ui
            updateStackBoundsToMultiWindowTaskSize(activity);
        } else {
            mSourceStackBounds.set(mHomeStackBounds);
            mSourceInsets.set(activity.getDeviceProfile().getInsets());
        }

        Rect targetRect = new Rect();
        dl.getDescendantRectRelativeToSelf(ttv, targetRect);
        updateTargetRect(targetRect);

        // Transform the clip relative to the target rect.
        float scale = mTargetRect.width() / mSourceRect.width();
        mSourceWindowClipInsets.left = mSourceWindowClipInsets.left * scale;
        mSourceWindowClipInsets.top = mSourceWindowClipInsets.top * scale;
        mSourceWindowClipInsets.right = mSourceWindowClipInsets.right * scale;
        mSourceWindowClipInsets.bottom = mSourceWindowClipInsets.bottom * scale;
    }

    private void updateStackBoundsToMultiWindowTaskSize(BaseDraggingActivity activity) {
        ISystemUiProxy sysUiProxy = RecentsModel.getInstance(activity).getSystemUiProxy();
        if (sysUiProxy != null) {
            try {
                mSourceStackBounds.set(sysUiProxy.getNonMinimizedSplitScreenSecondaryBounds());
                return;
            } catch (RemoteException e) {
                // Use half screen size
            }
        }

        // Assume that the task size is half screen size (minus the insets and the divider size)
        DeviceProfile fullDp = activity.getDeviceProfile().getFullScreenProfile();
        // Use availableWidthPx and availableHeightPx instead of widthPx and heightPx to
        // account for system insets
@@ -192,22 +224,8 @@ public class ClipAnimationHelper {
        // Align the task to bottom right (probably not true for seascape).
        mSourceStackBounds.offset(insets.left + fullDp.availableWidthPx - taskWidth,
                insets.top + fullDp.availableHeightPx - taskHeight);
        } else {
            mSourceStackBounds.set(mHomeStackBounds);
            mSourceInsets.set(activity.getDeviceProfile().getInsets());
    }

        Rect targetRect = new Rect();
        dl.getDescendantRectRelativeToSelf(ttv, targetRect);
        updateTargetRect(targetRect);

        // Transform the clip relative to the target rect.
        float scale = mTargetRect.width() / mSourceRect.width();
        mSourceWindowClipInsets.left = mSourceWindowClipInsets.left * scale;
        mSourceWindowClipInsets.top = mSourceWindowClipInsets.top * scale;
        mSourceWindowClipInsets.right = mSourceWindowClipInsets.right * scale;
        mSourceWindowClipInsets.bottom = mSourceWindowClipInsets.bottom * scale;
    }

    public void drawForProgress(TaskThumbnailView ttv, Canvas canvas, float progress) {
        RectF currentRect =  mRectFEvaluator.evaluate(progress, mSourceRect, mTargetRect);