From 5e27c021ac3a808590989a3c17910870d6cc7e6d Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Thu, 28 Oct 2021 11:21:47 -0700 Subject: [PATCH] Check if RemoteAnimationTargets apps are present * Before the refactor to use RemoteTargetGluer, we only set the preview if the runningTaskTarget wasn't null, that check got removed during the refactor. * Why that check was there to begin with is a bit of a mystery, sadly Fixes: 199658495 Change-Id: I053fac0fa0eee0979dff651c01287d04d06298e6 --- .../android/quickstep/RemoteTargetGluer.java | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/quickstep/src/com/android/quickstep/RemoteTargetGluer.java b/quickstep/src/com/android/quickstep/RemoteTargetGluer.java index 825abedead..5f2b49d07f 100644 --- a/quickstep/src/com/android/quickstep/RemoteTargetGluer.java +++ b/quickstep/src/com/android/quickstep/RemoteTargetGluer.java @@ -17,7 +17,6 @@ package com.android.quickstep; import android.content.Context; -import android.util.Log; import androidx.annotation.Nullable; @@ -33,8 +32,6 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat; * {@link TaskViewSimulator} */ public class RemoteTargetGluer { - private static final String TAG = "RemoteTargetGluer"; - private RemoteTargetHandle[] mRemoteTargetHandles; private SplitConfigurationOptions.StagedSplitBounds mStagedSplitBounds; @@ -94,25 +91,18 @@ public class RemoteTargetGluer { public RemoteTargetHandle[] assignTargetsForSplitScreen(RemoteAnimationTargets targets) { int[] splitIds = LauncherSplitScreenListener.INSTANCE.getNoCreate() .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 secondaryTaskTarget; if (mRemoteTargetHandles.length == 1) { // 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 - // without being in split screen - primaryTaskTarget = targets.apps[0]; + // should always hit this case. mRemoteTargetHandles[0].mTransformParams.setTargetSet(targets); - mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(primaryTaskTarget, null); + 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); + } } else { // split screen primaryTaskTarget = targets.findTask(splitIds[0]);