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

Commit b8183b8b authored by Vinit Nayak's avatar Vinit Nayak Committed by Automerger Merge Worker
Browse files

Merge "Check if RemoteAnimationTargets apps are present" into sc-v2-dev am: a216ad2c

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/16142291

Change-Id: Ie2063e2dfd117a2cb18bc3b36976e1ce652ba2c3
parents 1ba47a8f a216ad2c
Loading
Loading
Loading
Loading
+6 −16
Original line number Original line Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.quickstep;
package com.android.quickstep;


import android.content.Context;
import android.content.Context;
import android.util.Log;


import androidx.annotation.Nullable;
import androidx.annotation.Nullable;


@@ -33,8 +32,6 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
 * {@link TaskViewSimulator}
 * {@link TaskViewSimulator}
 */
 */
public class RemoteTargetGluer {
public class RemoteTargetGluer {
    private static final String TAG = "RemoteTargetGluer";

    private RemoteTargetHandle[] mRemoteTargetHandles;
    private RemoteTargetHandle[] mRemoteTargetHandles;
    private SplitConfigurationOptions.StagedSplitBounds mStagedSplitBounds;
    private SplitConfigurationOptions.StagedSplitBounds mStagedSplitBounds;


@@ -94,25 +91,18 @@ public class RemoteTargetGluer {
    public RemoteTargetHandle[] assignTargetsForSplitScreen(RemoteAnimationTargets targets) {
    public RemoteTargetHandle[] assignTargetsForSplitScreen(RemoteAnimationTargets targets) {
        int[] splitIds = LauncherSplitScreenListener.INSTANCE.getNoCreate()
        int[] splitIds = LauncherSplitScreenListener.INSTANCE.getNoCreate()
                .getRunningSplitTaskIds();
                .getRunningSplitTaskIds();
        Log.d(TAG, "splitIds length: " + splitIds.length
                + " targetAppsLength: " + targets.apps.length
                + " remoteHandlesLength: " + mRemoteTargetHandles.length);
        if (splitIds.length == 0 && mRemoteTargetHandles.length > 1) {
            // There's a chance that between the creation of this class and assigning targets,
            // LauncherSplitScreenListener may have received callback that removes split
            mRemoteTargetHandles = new RemoteTargetHandle[]{mRemoteTargetHandles[0]};
            Log.w(TAG, "splitTaskIds changed between creation and assignment");
        }


        RemoteAnimationTargetCompat primaryTaskTarget;
        RemoteAnimationTargetCompat primaryTaskTarget;
        RemoteAnimationTargetCompat secondaryTaskTarget;
        RemoteAnimationTargetCompat secondaryTaskTarget;
        if (mRemoteTargetHandles.length == 1) {
        if (mRemoteTargetHandles.length == 1) {
            // If we're not in split screen, the splitIds count doesn't really matter since we
            // If we're not in split screen, the splitIds count doesn't really matter since we
            // should always hit this case. Right now there's no use case for multiple app targets
            // should always hit this case.
            // without being in split screen
            primaryTaskTarget = targets.apps[0];
            mRemoteTargetHandles[0].mTransformParams.setTargetSet(targets);
            mRemoteTargetHandles[0].mTransformParams.setTargetSet(targets);
            if (targets.apps.length > 0) {
                // Unclear why/when target.apps length == 0, but it sure does happen :(
                primaryTaskTarget = targets.apps[0];
                mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(primaryTaskTarget, null);
                mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(primaryTaskTarget, null);
            }
        } else {
        } else {
            // split screen
            // split screen
            primaryTaskTarget = targets.findTask(splitIds[0]);
            primaryTaskTarget = targets.findTask(splitIds[0]);