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

Commit 5fa247fd authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Include assistant in RemoteTargetGluer

* The UI isn't terribly great, but this fixes the crashes

Bug: 285781761
Change-Id: Ie3376a98b16c19bbdb4e39e7a0a436ddae200c4a
parent 59ec439e
Loading
Loading
Loading
Loading
+26 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.quickstep;

import android.app.WindowConfiguration;
import android.content.Context;
import android.graphics.Rect;
import android.view.RemoteAnimationTarget;
@@ -123,7 +124,14 @@ public class RemoteTargetGluer {
            mRemoteTargetHandles = newHandles;
        }

        boolean containsSplitTargets = Arrays.stream(targets.apps)
                .anyMatch(remoteAnimationTarget ->
                        remoteAnimationTarget.windowConfiguration.getWindowingMode()
                                == WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW);

        if (mRemoteTargetHandles.length == 1) {
            // Single fullscreen app

            // If we're not in split screen, the splitIds count doesn't really matter since we
            // should always hit this case.
            mRemoteTargetHandles[0].mTransformParams.setTargetSet(targets);
@@ -131,13 +139,29 @@ public class RemoteTargetGluer {
                // Unclear why/when target.apps length == 0, but it sure does happen :(
                mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(targets.apps[0], null);
            }
        } else if (!containsSplitTargets) {
            // Single App + Assistant
            for (int i = 0; i < mRemoteTargetHandles.length; i++) {
                mRemoteTargetHandles[i].mTransformParams.setTargetSet(targets);
                mRemoteTargetHandles[i].mTaskViewSimulator.setPreview(targets.apps[i], null);
            }
        } else {
            RemoteAnimationTarget topLeftTarget = targets.apps[0];
            // Split apps (+ maybe assistant)
            RemoteAnimationTarget topLeftTarget = Arrays.stream(targets.apps)
                    .filter(remoteAnimationTarget ->
                            remoteAnimationTarget.windowConfiguration.getWindowingMode()
                                    == WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW)
                    .findFirst().get();

            // Fetch the adjacent target for split screen.
            RemoteAnimationTarget bottomRightTarget = null;
            for (int i = 1; i < targets.apps.length; i++) {
            for (int i = 0; i < targets.apps.length; i++) {
                final RemoteAnimationTarget target = targets.apps[i];
                if (target.windowConfiguration.getWindowingMode() !=
                        WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW ||
                        target == topLeftTarget) {
                    continue;
                }
                Rect topLeftBounds = getStartBounds(topLeftTarget);
                Rect bounds = getStartBounds(target);
                if (topLeftBounds.left > bounds.right || topLeftBounds.top > bounds.bottom) {
+1 −1
Original line number Diff line number Diff line
@@ -411,7 +411,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
            // transitions, the animation leashes are reparented to an animation container so we
            // can bump layers as needed.
            builder.setLayer(mDrawsBelowRecents
                    ? Integer.MIN_VALUE + 1
                    ? Integer.MIN_VALUE + app.prefixOrderIndex
                    : ENABLE_SHELL_TRANSITIONS ? Integer.MAX_VALUE : 0);
        }
    }