Merge "Removing unnecessary device sumaltion code" into tm-qpr-dev
diff --git a/quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java
index c165750..ed4a212 100644
--- a/quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/FallbackTaskbarUIController.java
@@ -15,6 +15,7 @@
  */
 package com.android.launcher3.taskbar;
 
+import static com.android.launcher3.Utilities.isRunningInTestHarness;
 import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP;
 import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASHED_LAUNCHER_STATE;
 
@@ -80,10 +81,13 @@
      * Currently this animation just force stashes the taskbar in Overview.
      */
     public Animator createAnimToRecentsState(RecentsState toState, long duration) {
-        boolean useStashedLauncherState = toState.hasOverviewActions();
-        boolean stashedLauncherState =
-                useStashedLauncherState && FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get()
-                        && toState == RecentsState.MODAL_TASK;
+        // Force stash the taskbar in overview modal state or when going home. We do not force
+        // stash on home when running in a test as 3p launchers rely on taskbar instead of hotseat.
+        boolean isGoingHome = toState == RecentsState.HOME && !isRunningInTestHarness();
+        boolean useStashedLauncherState = toState.hasOverviewActions() || isGoingHome;
+        boolean stashedLauncherState = useStashedLauncherState && (
+                (FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW.get() && toState == RecentsState.MODAL_TASK)
+                        || isGoingHome);
         TaskbarStashController stashController = mControllers.taskbarStashController;
         // Set both FLAG_IN_STASHED_LAUNCHER_STATE and FLAG_IN_APP to ensure the state is respected.
         // For all other states, just use the current stashed-in-app setting (e.g. if long clicked).
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java
index edcd4c8..03d08eb 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarKeyguardController.java
@@ -1,17 +1,17 @@
 package com.android.launcher3.taskbar;
 
 import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
-import static com.android.systemui.shared.system.QuickStepContract.SCREEN_STATE_OFF;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_AWAKE;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISABLED;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DOZING;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DREAMING;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
-import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_ON;
-import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_STATE_MASK;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING;
 import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_WAKEFULNESS_MASK;
+import static com.android.systemui.shared.system.QuickStepContract.WAKEFULNESS_ASLEEP;
 
 import android.app.KeyguardManager;
 
@@ -29,7 +29,7 @@
             | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING | SYSUI_STATE_DEVICE_DOZING
             | SYSUI_STATE_OVERVIEW_DISABLED | SYSUI_STATE_HOME_DISABLED
             | SYSUI_STATE_BACK_DISABLED | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED
-            | SYSUI_STATE_SCREEN_STATE_MASK;
+            | SYSUI_STATE_WAKEFULNESS_MASK;
 
     // If any of these SysUi flags (via QuickstepContract) is set, the device to be considered
     // locked.
@@ -75,13 +75,13 @@
                 keyguardOccluded);
         updateIconsForBouncer();
 
-        boolean screenOffOrTransitioningOff = (systemUiStateFlags & SYSUI_STATE_SCREEN_ON) == 0;
-        boolean closeFloatingViews = keyguardShowing || screenOffOrTransitioningOff;
+        boolean asleepOrGoingToSleep = (systemUiStateFlags & SYSUI_STATE_AWAKE) == 0;
+        boolean closeFloatingViews = keyguardShowing || asleepOrGoingToSleep;
 
         if (closeFloatingViews) {
-            // animate the closing of the views, unless the screen is already fully turned off.
+            // animate the closing of the views, unless the screen is already asleep.
             boolean animateViewClosing =
-                    (systemUiStateFlags & SYSUI_STATE_SCREEN_STATE_MASK) != SCREEN_STATE_OFF;
+                    (systemUiStateFlags & SYSUI_STATE_WAKEFULNESS_MASK) != WAKEFULNESS_ASLEEP;
             AbstractFloatingView.closeOpenViews(mContext, animateViewClosing, TYPE_ALL);
         }
     }
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
index cf8148e..b98ea81 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
@@ -22,7 +22,7 @@
 import static com.android.launcher3.util.FlagDebugUtils.appendFlag;
 import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange;
 import static com.android.systemui.animation.Interpolators.EMPHASIZED;
-import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_ON;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_AWAKE;
 
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
@@ -81,17 +81,17 @@
      *
      * This is cleared as soon as the screen begins to transition off.
      */
-    private static final int FLAG_SCREEN_ON = 1 << 3;
+    private static final int FLAG_AWAKE = 1 << 3;
 
     /**
-     * Captures whether the launcher was active at the time the FLAG_SCREEN_ON was cleared.
-     * Always cleared when FLAG_SCREEN_ON is set.
+     * Captures whether the launcher was active at the time the FLAG_AWAKE was cleared.
+     * Always cleared when FLAG_AWAKE is set.
      * <p>
-     * FLAG_RESUMED will be cleared when the screen is off, since all apps get paused at this point.
-     * Thus, this flag indicates whether the launcher will be shown when the screen gets turned on
+     * FLAG_RESUMED will be cleared when the device is asleep, since all apps get paused at this
+     * point. Thus, this flag indicates whether the launcher will be shown when the device wakes up
      * again.
      */
-    private static final int FLAG_LAUNCHER_ACTIVE_AT_SCREEN_OFF = 1 << 4;
+    private static final int FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE = 1 << 4;
 
     /** Whether the device is currently locked. */
     private static final int FLAG_DEVICE_LOCKED = 1 << 5;
@@ -265,15 +265,15 @@
 
     /** SysUI flags updated, see QuickStepContract.SYSUI_STATE_* values. */
     public void updateStateForSysuiFlags(int systemUiStateFlags, boolean skipAnim) {
-        final boolean prevScreenIsOn = hasAnyFlag(FLAG_SCREEN_ON);
-        final boolean currScreenIsOn = hasAnyFlag(systemUiStateFlags, SYSUI_STATE_SCREEN_ON);
+        final boolean prevIsAwake = hasAnyFlag(FLAG_AWAKE);
+        final boolean currIsAwake = hasAnyFlag(systemUiStateFlags, SYSUI_STATE_AWAKE);
 
-        updateStateForFlag(FLAG_SCREEN_ON, currScreenIsOn);
-        if (prevScreenIsOn != currScreenIsOn) {
+        updateStateForFlag(FLAG_AWAKE, currIsAwake);
+        if (prevIsAwake != currIsAwake) {
             // The screen is switching between on/off. When turning off, capture whether the
             // launcher is active and memoize this state.
-            updateStateForFlag(FLAG_LAUNCHER_ACTIVE_AT_SCREEN_OFF,
-                    prevScreenIsOn && hasAnyFlag(FLAGS_LAUNCHER_ACTIVE));
+            updateStateForFlag(FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE,
+                    prevIsAwake && hasAnyFlag(FLAGS_LAUNCHER_ACTIVE));
         }
 
         boolean isDeviceLocked = hasAnyFlag(systemUiStateFlags, MASK_ANY_SYSUI_LOCKED);
@@ -377,7 +377,7 @@
             }
         }
 
-        if (hasAnyFlag(changedFlags, FLAGS_LAUNCHER_ACTIVE | FLAG_SCREEN_ON)) {
+        if (hasAnyFlag(changedFlags, FLAGS_LAUNCHER_ACTIVE | FLAG_AWAKE)) {
             animatorSet.addListener(new AnimatorListenerAdapter() {
                 @Override
                 public void onAnimationStart(Animator animation) {
@@ -573,10 +573,10 @@
 
     /** Whether the launcher is considered active. */
     private boolean isInLauncher() {
-        if (hasAnyFlag(FLAG_SCREEN_ON)) {
+        if (hasAnyFlag(FLAG_AWAKE)) {
             return hasAnyFlag(FLAGS_LAUNCHER_ACTIVE);
         } else {
-            return hasAnyFlag(FLAG_LAUNCHER_ACTIVE_AT_SCREEN_OFF);
+            return hasAnyFlag(FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE);
         }
     }
 
@@ -677,9 +677,9 @@
         appendFlag(result, flags, FLAG_TRANSITION_TO_RESUMED, "transition_to_resumed");
         appendFlag(result, flags, FLAG_LAUNCHER_IN_STATE_TRANSITION,
                 "launcher_in_state_transition");
-        appendFlag(result, flags, FLAG_SCREEN_ON, "screen_on");
-        appendFlag(result, flags, FLAG_LAUNCHER_ACTIVE_AT_SCREEN_OFF,
-                "launcher_active_at_screen_off");
+        appendFlag(result, flags, FLAG_AWAKE, "awake");
+        appendFlag(result, flags, FLAG_LAUNCHER_WAS_ACTIVE_WHILE_AWAKE,
+                "was_active_while_awake");
         appendFlag(result, flags, FLAG_DEVICE_LOCKED, "device_locked");
         return result.toString();
     }
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
index c537106..3d8bf9e 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
@@ -22,6 +22,7 @@
 
 import static com.android.launcher3.util.DisplayController.CHANGE_DENSITY;
 import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
+import static com.android.launcher3.util.DisplayController.TASKBAR_NOT_DESTROYED_TAG;
 import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
 import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange;
 
@@ -63,6 +64,7 @@
 import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider;
 
 import java.io.PrintWriter;
+import java.util.StringJoiner;
 
 /**
  * Class to manage taskbar lifecycle
@@ -147,6 +149,8 @@
 
             @Override
             public void onConfigurationChanged(Configuration newConfig) {
+                debugWhyTaskbarNotDestroyed(
+                        "TaskbarManager#mComponentCallbacks.onConfigurationChanged: " + newConfig);
                 DeviceProfile dp = mUserUnlocked
                         ? LauncherAppState.getIDP(mContext).getDeviceProfile(mContext)
                         : null;
@@ -179,6 +183,9 @@
                     }
                 }
 
+                debugWhyTaskbarNotDestroyed("ComponentCallbacks#onConfigurationChanged() "
+                        + "configDiffForRecreate="
+                        + Configuration.configurationDiffToString(configDiffForRecreate));
                 if ((configDiffForRecreate & configsRequiringRecreate) != 0) {
                     recreateTaskbar();
                 } else {
@@ -207,6 +214,8 @@
                 mNavMode = info.navigationMode;
                 recreateTaskbar();
             }
+            debugWhyTaskbarNotDestroyed("DisplayInfoChangeListener#"
+                    + mDisplayController.getChangeFlagsString(flags));
         };
         mNavMode = mDisplayController.getInfo().navigationMode;
         mDisplayController.addChangeListener(mDispInfoChangeListener);
@@ -227,10 +236,13 @@
                     new IntentFilter(ACTION_SHOW_TASKBAR),
                     RECEIVER_NOT_EXPORTED);
         });
+
+        debugWhyTaskbarNotDestroyed("TaskbarManager created");
         recreateTaskbar();
     }
 
     private void destroyExistingTaskbar() {
+        debugWhyTaskbarNotDestroyed("destroyExistingTaskbar: " + mTaskbarActivityContext);
         if (mTaskbarActivityContext != null) {
             mTaskbarActivityContext.onDestroy();
             if (!FLAG_HIDE_NAVBAR_WINDOW) {
@@ -274,7 +286,12 @@
         if (mActivity == activity) {
             return;
         }
+        if (mActivity != null) {
+            mActivity.removeOnDeviceProfileChangeListener(mDebugActivityDeviceProfileChanged);
+        }
         mActivity = activity;
+        debugWhyTaskbarNotDestroyed("Set mActivity=" + mActivity);
+        mActivity.addOnDeviceProfileChangeListener(mDebugActivityDeviceProfileChanged);
         UnfoldTransitionProgressProvider unfoldTransitionProgressProvider =
                 getUnfoldTransitionProgressProviderForActivity(activity);
         mUnfoldProgressProvider.setSourceProvider(unfoldTransitionProgressProvider);
@@ -318,7 +335,9 @@
      */
     public void clearActivity(@NonNull StatefulActivity activity) {
         if (mActivity == activity) {
+            mActivity.removeOnDeviceProfileChangeListener(mDebugActivityDeviceProfileChanged);
             mActivity = null;
+            debugWhyTaskbarNotDestroyed("clearActivity");
             if (mTaskbarActivityContext != null) {
                 mTaskbarActivityContext.setUIController(TaskbarUIController.DEFAULT);
             }
@@ -338,8 +357,12 @@
 
         destroyExistingTaskbar();
 
-        boolean isTaskBarEnabled = dp != null && isTaskbarPresent(dp);
-        if (!isTaskBarEnabled) {
+        boolean isTaskbarEnabled = dp != null && isTaskbarPresent(dp);
+        debugWhyTaskbarNotDestroyed("recreateTaskbar: isTaskbarEnabled=" + isTaskbarEnabled
+                + " [dp != null (i.e. mUserUnlocked)]=" + (dp != null)
+                + " FLAG_HIDE_NAVBAR_WINDOW=" + FLAG_HIDE_NAVBAR_WINDOW
+                + " dp.isTaskbarPresent=" + (dp == null ? "null" : dp.isTaskbarPresent));
+        if (!isTaskbarEnabled) {
             SystemUiProxy.INSTANCE.get(mContext)
                     .notifyTaskbarStatus(/* visible */ false, /* stashed */ false);
             return;
@@ -440,6 +463,11 @@
      * Called when the manager is no longer needed
      */
     public void destroy() {
+        debugWhyTaskbarNotDestroyed("TaskbarManager#destroy()");
+        if (mActivity != null) {
+            mActivity.removeOnDeviceProfileChangeListener(mDebugActivityDeviceProfileChanged);
+        }
+
         UI_HELPER_EXECUTOR.execute(
                 () -> mTaskbarBroadcastReceiver.unregisterReceiverSafely(mContext));
         destroyExistingTaskbar();
@@ -464,4 +492,46 @@
             mTaskbarActivityContext.dumpLogs(prefix + "\t", pw);
         }
     }
+
+    /** Temp logs for b/254119092. */
+    public void debugWhyTaskbarNotDestroyed(String debugReason) {
+        StringJoiner log = new StringJoiner("\n");
+        log.add(debugReason);
+
+        boolean activityTaskbarPresent = mActivity != null
+                && mActivity.getDeviceProfile().isTaskbarPresent;
+        boolean contextTaskbarPresent = mUserUnlocked
+                && LauncherAppState.getIDP(mContext).getDeviceProfile(mContext).isTaskbarPresent;
+        if (activityTaskbarPresent == contextTaskbarPresent) {
+            log.add("mActivity and mContext agree taskbarIsPresent=" + contextTaskbarPresent);
+            Log.d(TASKBAR_NOT_DESTROYED_TAG, log.toString());
+            return;
+        }
+
+        log.add("mActivity and mContext device profiles have different values, add more logs.");
+
+        log.add("\tmActivity logs:");
+        log.add("\t\tmActivity=" + mActivity);
+        if (mActivity != null) {
+            log.add("\t\tmActivity.getResources().getConfiguration()="
+                    + mActivity.getResources().getConfiguration());
+            log.add("\t\tmActivity.getDeviceProfile().isTaskbarPresent="
+                    + activityTaskbarPresent);
+        }
+        log.add("\tmContext logs:");
+        log.add("\t\tmContext=" + mContext);
+        log.add("\t\tmContext.getResources().getConfiguration()="
+                + mContext.getResources().getConfiguration());
+        if (mUserUnlocked) {
+            log.add("\t\tLauncherAppState.getIDP().getDeviceProfile(mContext).isTaskbarPresent="
+                    + contextTaskbarPresent);
+        } else {
+            log.add("\t\tCouldn't get DeviceProfile because !mUserUnlocked");
+        }
+
+        Log.d(TASKBAR_NOT_DESTROYED_TAG, log.toString());
+    }
+
+    private final DeviceProfile.OnDeviceProfileChangeListener mDebugActivityDeviceProfileChanged =
+            dp -> debugWhyTaskbarNotDestroyed("mActivity onDeviceProfileChanged");
 }
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
index 4ab093f..6eb409e 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
@@ -286,7 +286,7 @@
     }
 
     private ValueAnimator createRevealAnimForView(View view, boolean isStashed, float newWidth,
-            boolean shouldStartAlign) {
+            boolean isQsb) {
         Rect viewBounds = new Rect(0, 0, view.getWidth(), view.getHeight());
         int centerY = viewBounds.centerY();
         int halfHandleHeight = mStashedHandleHeight / 2;
@@ -295,7 +295,8 @@
 
         final int left;
         final int right;
-        if (shouldStartAlign) {
+        // QSB will crop from the 'start' whereas all other icons will crop from the center.
+        if (isQsb) {
             if (mIsRtl) {
                 right = viewBounds.right;
                 left = (int) (right - newWidth);
@@ -311,7 +312,10 @@
         }
 
         Rect stashedRect = new Rect(left, top, right, bottom);
-        float radius = viewBounds.height() / 2f;
+        // QSB radius can be > 0 since it does not have any UI elements outside of it bounds.
+        float radius = isQsb
+                ? viewBounds.height() / 2f
+                : 0f;
         float stashedRadius = stashedRect.height() / 2f;
 
         return new RoundedRectRevealOutlineProvider(radius, stashedRadius, viewBounds, stashedRect)
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index 5e22703..243ed5c 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -639,7 +639,7 @@
         PendingAnimation anim = new PendingAnimation(TABLET_HOME_TO_SPLIT.getDuration());
         RectF startingTaskRect = new RectF();
         final FloatingTaskView floatingTaskView = FloatingTaskView.getFloatingTaskView(this,
-                source.view, null /* thumbnail */, source.drawable, startingTaskRect);
+                source.getView(), null /* thumbnail */, source.getDrawable(), startingTaskRect);
         floatingTaskView.setAlpha(1);
         floatingTaskView.addStagingAnimation(anim, startingTaskRect, tempRect,
                 false /* fadeWithThumbnail */, true /* isStagedTask */);
@@ -1237,6 +1237,9 @@
         Trace.instantForTrack(TRACE_TAG_APP, "QuickstepLauncher#DeviceProfileChanged",
                 getDeviceProfile().toSmallString());
         SystemUiProxy.INSTANCE.get(this).setLauncherAppIconSize(mDeviceProfile.iconSizePx);
+        if (mTaskbarManager != null) {
+            mTaskbarManager.debugWhyTaskbarNotDestroyed("QuickstepLauncher#onDeviceProfileChanged");
+        }
     }
 
     /**
diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
index 6dd67de..b76fe5c 100644
--- a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
+++ b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
@@ -24,6 +24,7 @@
 import com.android.launcher3.DeviceProfile
 import com.android.launcher3.anim.PendingAnimation
 import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource
+import com.android.quickstep.views.IconView
 import com.android.quickstep.views.TaskThumbnailView
 import com.android.quickstep.views.TaskView
 import com.android.quickstep.views.TaskView.TaskIdAttributeContainer
@@ -52,21 +53,22 @@
      * depending on the state of the surface from which the split was initiated
      */
     fun getFirstAnimInitViews(taskViewSupplier: Supplier<TaskView>,
-                              splitSelectSourceSupplier: Supplier<SplitSelectSource>)
+                              splitSelectSourceSupplier: Supplier<SplitSelectSource?>)
             : SplitAnimInitProps {
+        val splitSelectSource = splitSelectSourceSupplier.get()
         if (!splitSelectStateController.isAnimateCurrentTaskDismissal) {
             // Initiating from home
-            val splitSelectSource = splitSelectSourceSupplier.get()
-            return SplitAnimInitProps(splitSelectSource.view, originalBitmap = null,
+            return SplitAnimInitProps(splitSelectSource!!.view, originalBitmap = null,
                     splitSelectSource.drawable, fadeWithThumbnail = false, isStagedTask = true,
                     iconView = null)
         } else if (splitSelectStateController.isDismissingFromSplitPair) {
             // Initiating split from overview, but on a split pair
             val taskView = taskViewSupplier.get()
             for (container : TaskIdAttributeContainer in taskView.taskIdAttributeContainers) {
-                if (container.task.key.id == splitSelectStateController.initialTaskId) {
+                if (container.task.getKey().getId() == splitSelectStateController.initialTaskId) {
+                    val drawable = getDrawable(container.iconView, splitSelectSource)
                     return SplitAnimInitProps(container.thumbnailView,
-                            container.thumbnailView.thumbnail, container.iconView.drawable!!,
+                            container.thumbnailView.thumbnail, drawable!!,
                             fadeWithThumbnail = true, isStagedTask = true,
                             iconView = container.iconView
                     )
@@ -77,14 +79,28 @@
         } else {
             // Initiating split from overview on fullscreen task TaskView
             val taskView = taskViewSupplier.get()
+            val drawable = getDrawable(taskView.iconView, splitSelectSource)
             return SplitAnimInitProps(taskView.thumbnail, taskView.thumbnail.thumbnail,
-                    taskView.iconView.drawable!!, fadeWithThumbnail = true, isStagedTask = true,
+                    drawable!!, fadeWithThumbnail = true, isStagedTask = true,
                     taskView.iconView
             )
         }
     }
 
     /**
+     * Returns the drawable that's provided in iconView, however if that
+     * is null it falls back to the drawable that's in splitSelectSource.
+     * TaskView's icon drawable can be null if the TaskView is scrolled far enough off screen
+     * @return [Drawable]
+     */
+    fun getDrawable(iconView: IconView, splitSelectSource: SplitSelectSource?) : Drawable? {
+        if (iconView.drawable == null && splitSelectSource != null) {
+            return splitSelectSource.drawable
+        }
+        return iconView.drawable
+    }
+
+    /**
      * When selecting first app from split pair, second app's thumbnail remains. This animates
      * the second thumbnail by expanding it to take up the full taskViewWidth/Height and overlaying
      * it with [TaskThumbnailView]'s splashView. Adds animations to the provided builder.
diff --git a/quickstep/tests/src/com/android/quickstep/util/SplitAnimationControllerTest.kt b/quickstep/tests/src/com/android/quickstep/util/SplitAnimationControllerTest.kt
new file mode 100644
index 0000000..7e07b81
--- /dev/null
+++ b/quickstep/tests/src/com/android/quickstep/util/SplitAnimationControllerTest.kt
@@ -0,0 +1,165 @@
+/*
+ *  Copyright (C) 2023 The Android Open Source Project
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package com.android.quickstep.util
+
+import android.graphics.Bitmap
+import android.graphics.drawable.Drawable
+import android.view.View
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.launcher3.util.SplitConfigurationOptions
+import com.android.quickstep.views.GroupedTaskView
+import com.android.quickstep.views.IconView
+import com.android.quickstep.views.TaskThumbnailView
+import com.android.quickstep.views.TaskView
+import com.android.quickstep.views.TaskView.TaskIdAttributeContainer
+import com.android.systemui.shared.recents.model.Task
+import org.junit.Assert.assertEquals
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.Mock
+import org.mockito.MockitoAnnotations
+import org.mockito.Mockito.`when` as whenever
+
+@RunWith(AndroidJUnit4::class)
+class SplitAnimationControllerTest {
+
+    private val taskId = 9
+
+    @Mock lateinit var mockSplitSelectStateController: SplitSelectStateController
+    // TaskView
+    @Mock lateinit var mockTaskView: TaskView
+    @Mock lateinit var mockThumbnailView: TaskThumbnailView
+    @Mock lateinit var mockBitmap: Bitmap
+    @Mock lateinit var mockIconView: IconView
+    @Mock lateinit var mockTaskViewDrawable: Drawable
+    // GroupedTaskView
+    @Mock lateinit var mockGroupedTaskView: GroupedTaskView
+    @Mock lateinit var mockTask: Task
+    @Mock lateinit var mockTaskKey: Task.TaskKey
+    @Mock lateinit var mockTaskIdAttributeContainer: TaskIdAttributeContainer
+
+    // SplitSelectSource
+    @Mock lateinit var splitSelectSource: SplitConfigurationOptions.SplitSelectSource
+    @Mock lateinit var mockSplitSourceDrawable: Drawable
+    @Mock lateinit var mockSplitSourceView: View
+
+    lateinit var splitAnimationController: SplitAnimationController
+
+    @Before
+    fun setup() {
+        MockitoAnnotations.initMocks(this)
+
+        whenever(mockTaskView.thumbnail).thenReturn(mockThumbnailView)
+        whenever(mockThumbnailView.thumbnail).thenReturn(mockBitmap)
+        whenever(mockTaskView.iconView).thenReturn(mockIconView)
+        whenever(mockIconView.drawable).thenReturn(mockTaskViewDrawable)
+
+        whenever(splitSelectSource.drawable).thenReturn(mockSplitSourceDrawable)
+        whenever(splitSelectSource.view).thenReturn(mockSplitSourceView)
+
+        splitAnimationController = SplitAnimationController(mockSplitSelectStateController)
+    }
+
+    @Test
+    fun getFirstAnimInitViews_nullTaskViewIcon_useSplitSourceIcon() {
+        // Hit fullscreen task dismissal state
+        whenever(mockSplitSelectStateController.isAnimateCurrentTaskDismissal).thenReturn(true)
+        whenever(mockSplitSelectStateController.isDismissingFromSplitPair).thenReturn(false)
+
+        // Missing taskView icon
+        whenever(mockIconView.drawable).thenReturn(null)
+
+        val splitAnimInitProps : SplitAnimationController.Companion.SplitAnimInitProps =
+                splitAnimationController.getFirstAnimInitViews(
+                        { mockTaskView }, { splitSelectSource })
+
+        assertEquals("Did not fallback to use splitSource icon drawable",
+                mockSplitSourceDrawable, splitAnimInitProps.iconDrawable)
+    }
+
+    @Test
+    fun getFirstAnimInitViews_validTaskViewIcon_useTaskViewIcon() {
+        // Hit fullscreen task dismissal state
+        whenever(mockSplitSelectStateController.isAnimateCurrentTaskDismissal).thenReturn(true)
+        whenever(mockSplitSelectStateController.isDismissingFromSplitPair).thenReturn(false)
+
+        val splitAnimInitProps : SplitAnimationController.Companion.SplitAnimInitProps =
+                splitAnimationController.getFirstAnimInitViews(
+                        { mockTaskView }, { splitSelectSource })
+
+        assertEquals("Did not use taskView icon drawable", mockTaskViewDrawable,
+                splitAnimInitProps.iconDrawable)
+    }
+
+    @Test
+    fun getFirstAnimInitViews_validTaskViewNullSplitSource_useTaskViewIcon() {
+        // Hit fullscreen task dismissal state
+        whenever(mockSplitSelectStateController.isAnimateCurrentTaskDismissal).thenReturn(true)
+        whenever(mockSplitSelectStateController.isDismissingFromSplitPair).thenReturn(false)
+
+        // Set split source to null
+        whenever(splitSelectSource.drawable).thenReturn(null)
+
+        val splitAnimInitProps : SplitAnimationController.Companion.SplitAnimInitProps =
+                splitAnimationController.getFirstAnimInitViews(
+                        { mockTaskView }, { splitSelectSource })
+
+        assertEquals("Did not use taskView icon drawable", mockTaskViewDrawable,
+                splitAnimInitProps.iconDrawable)
+    }
+
+    @Test
+    fun getFirstAnimInitViews_nullTaskViewValidSplitSource_noTaskDismissal() {
+        // Hit initiating split from home
+        whenever(mockSplitSelectStateController.isAnimateCurrentTaskDismissal).thenReturn(false)
+        whenever(mockSplitSelectStateController.isDismissingFromSplitPair).thenReturn(false)
+
+        val splitAnimInitProps : SplitAnimationController.Companion.SplitAnimInitProps =
+                splitAnimationController.getFirstAnimInitViews(
+                        { mockTaskView }, { splitSelectSource })
+
+        assertEquals("Did not use splitSource icon drawable", mockSplitSourceDrawable,
+                splitAnimInitProps.iconDrawable)
+    }
+
+    @Test
+    fun getFirstAnimInitViews_nullTaskViewValidSplitSource_groupedTaskView() {
+        // Hit groupedTaskView dismissal
+        whenever(mockSplitSelectStateController.isAnimateCurrentTaskDismissal).thenReturn(true)
+        whenever(mockSplitSelectStateController.isDismissingFromSplitPair).thenReturn(true)
+
+        // Remove icon view from GroupedTaskView
+        whenever(mockIconView.drawable).thenReturn(null)
+
+        whenever(mockTaskIdAttributeContainer.task).thenReturn(mockTask)
+        whenever(mockTaskIdAttributeContainer.iconView).thenReturn(mockIconView)
+        whenever(mockTaskIdAttributeContainer.thumbnailView).thenReturn(mockThumbnailView)
+        whenever(mockTask.getKey()).thenReturn(mockTaskKey)
+        whenever(mockTaskKey.getId()).thenReturn(taskId)
+        whenever(mockSplitSelectStateController.initialTaskId).thenReturn(taskId)
+        whenever(mockGroupedTaskView.taskIdAttributeContainers)
+                .thenReturn(Array(1) { mockTaskIdAttributeContainer })
+        val splitAnimInitProps : SplitAnimationController.Companion.SplitAnimInitProps =
+                splitAnimationController.getFirstAnimInitViews(
+                        { mockGroupedTaskView }, { splitSelectSource })
+
+        assertEquals("Did not use splitSource icon drawable", mockSplitSourceDrawable,
+                splitAnimInitProps.iconDrawable)
+    }
+}
\ No newline at end of file
diff --git a/res/values-uz/strings.xml b/res/values-uz/strings.xml
index f53aaf4..30e6b8b 100644
--- a/res/values-uz/strings.xml
+++ b/res/values-uz/strings.xml
@@ -106,7 +106,7 @@
     <string name="allow_rotation_desc" msgid="8662546029078692509">"Telefon burilganda"</string>
     <string name="notification_dots_title" msgid="9062440428204120317">"Bildirishnoma belgilari"</string>
     <string name="notification_dots_desc_on" msgid="1679848116452218908">"Yoniq"</string>
-    <string name="notification_dots_desc_off" msgid="1760796511504341095">"Yoqilmagan"</string>
+    <string name="notification_dots_desc_off" msgid="1760796511504341095">"Oʻchiq"</string>
     <string name="title_missing_notification_access" msgid="7503287056163941064">"Bildirishnomalarga ruxsat berilmagan"</string>
     <string name="msg_missing_notification_access" msgid="281113995110910548">"Bildirishnoma belgilarini ko‘rsatish uchun <xliff:g id="NAME">%1$s</xliff:g> ilovasida bildirishnomalarni yoqing"</string>
     <string name="title_change_settings" msgid="1376365968844349552">"Sozlamalarni o‘zgartirish"</string>
diff --git a/src/com/android/launcher3/util/DisplayController.java b/src/com/android/launcher3/util/DisplayController.java
index 8a1c5e9..02ebb15 100644
--- a/src/com/android/launcher3/util/DisplayController.java
+++ b/src/com/android/launcher3/util/DisplayController.java
@@ -23,6 +23,7 @@
 import static com.android.launcher3.config.FeatureFlags.ENABLE_TRANSIENT_TASKBAR;
 import static com.android.launcher3.config.FeatureFlags.FORCE_PERSISTENT_TASKBAR;
 import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
+import static com.android.launcher3.util.FlagDebugUtils.appendFlag;
 import static com.android.launcher3.util.window.WindowManagerProxy.MIN_TABLET_WIDTH;
 
 import android.annotation.SuppressLint;
@@ -55,6 +56,7 @@
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
+import java.util.StringJoiner;
 
 /**
  * Utility class to cache properties of default display to avoid a system RPC on every call.
@@ -66,6 +68,9 @@
     private static final boolean DEBUG = false;
     private static boolean sTransientTaskbarStatusForTests;
 
+    // TODO(b/254119092) remove all logs with this tag
+    public static final String TASKBAR_NOT_DESTROYED_TAG = "b/254119092";
+
     public static final MainThreadInitializedObject<DisplayController> INSTANCE =
             new MainThreadInitializedObject<>(DisplayController::new);
 
@@ -206,6 +211,7 @@
     @Override
     @TargetApi(Build.VERSION_CODES.S)
     public final void onConfigurationChanged(Configuration config) {
+        Log.d(TASKBAR_NOT_DESTROYED_TAG, "DisplayController#onConfigurationChanged: " + config);
         Display display = mWindowContext.getDisplay();
         if (config.densityDpi != mInfo.densityDpi
                 || config.fontScale != mInfo.fontScale
@@ -272,7 +278,7 @@
             change |= CHANGE_SUPPORTED_BOUNDS;
         }
         if (DEBUG) {
-            Log.d(TAG, "handleInfoChange - change: 0b" + Integer.toBinaryString(change));
+            Log.d(TAG, "handleInfoChange - change: " + getChangeFlagsString(change));
         }
 
         if (change != 0) {
@@ -399,6 +405,20 @@
     }
 
     /**
+     * Returns the given binary flags as a human-readable string.
+     * @see #CHANGE_ALL
+     */
+    public String getChangeFlagsString(int change) {
+        StringJoiner result = new StringJoiner("|");
+        appendFlag(result, change, CHANGE_ACTIVE_SCREEN, "CHANGE_ACTIVE_SCREEN");
+        appendFlag(result, change, CHANGE_ROTATION, "CHANGE_ROTATION");
+        appendFlag(result, change, CHANGE_DENSITY, "CHANGE_DENSITY");
+        appendFlag(result, change, CHANGE_SUPPORTED_BOUNDS, "CHANGE_SUPPORTED_BOUNDS");
+        appendFlag(result, change, CHANGE_NAVIGATION_MODE, "CHANGE_NAVIGATION_MODE");
+        return result.toString();
+    }
+
+    /**
      * Dumps the current state information
      */
     public void dump(PrintWriter pw) {
diff --git a/src/com/android/launcher3/util/SplitConfigurationOptions.java b/src/com/android/launcher3/util/SplitConfigurationOptions.java
index 8c5e782..1ae43d0 100644
--- a/src/com/android/launcher3/util/SplitConfigurationOptions.java
+++ b/src/com/android/launcher3/util/SplitConfigurationOptions.java
@@ -200,8 +200,8 @@
         /** Keep in sync w/ ActivityTaskManager#INVALID_TASK_ID (unreference-able) */
         private static final int INVALID_TASK_ID = -1;
 
-        public final View view;
-        public final Drawable drawable;
+        private View view;
+        private Drawable drawable;
         public final Intent intent;
         public final SplitPositionOption position;
         public final ItemInfo itemInfo;
@@ -224,5 +224,13 @@
             this.itemInfo = itemInfo;
             this.splitEvent = splitEvent;
         }
+
+        public Drawable getDrawable() {
+            return drawable;
+        }
+
+        public View getView() {
+            return view;
+        }
     }
 }
diff --git a/src/com/android/launcher3/util/ViewOnDrawExecutor.java b/src/com/android/launcher3/util/ViewOnDrawExecutor.java
index 5d90291..3fa5799 100644
--- a/src/com/android/launcher3/util/ViewOnDrawExecutor.java
+++ b/src/com/android/launcher3/util/ViewOnDrawExecutor.java
@@ -16,11 +16,13 @@
 
 package com.android.launcher3.util;
 
+import android.util.Log;
 import android.view.View;
 import android.view.View.OnAttachStateChangeListener;
 import android.view.ViewTreeObserver.OnDrawListener;
 
 import com.android.launcher3.Launcher;
+import com.android.launcher3.testing.shared.TestProtocol;
 
 import java.util.function.Consumer;
 
@@ -42,12 +44,21 @@
     private boolean mCancelled;
 
     public ViewOnDrawExecutor(RunnableList tasks) {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.FLAKY_BINDING, "Initialize ViewOnDrawExecutor");
+        }
         mTasks = tasks;
     }
 
     public void attachTo(Launcher launcher) {
         mOnClearCallback = launcher::clearPendingExecutor;
         mAttachedView = launcher.getWorkspace();
+
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.FLAKY_BINDING, "ViewOnDrawExecutor.attachTo: launcher=" + launcher
+                    + ", isAttachedToWindow=" + mAttachedView.isAttachedToWindow());
+        }
+
         mAttachedView.addOnAttachStateChangeListener(this);
 
         if (mAttachedView.isAttachedToWindow()) {
@@ -56,6 +67,10 @@
     }
 
     private void attachObserver() {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.FLAKY_BINDING,
+                    "ViewOnDrawExecutor.attachObserver: mCompleted=" + mCompleted);
+        }
         if (!mCompleted) {
             mAttachedView.getViewTreeObserver().addOnDrawListener(this);
         }
@@ -63,6 +78,9 @@
 
     @Override
     public void onViewAttachedToWindow(View v) {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.FLAKY_BINDING, "ViewOnDrawExecutor.onViewAttachedToWindow");
+        }
         attachObserver();
     }
 
@@ -71,11 +89,19 @@
 
     @Override
     public void onDraw() {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.FLAKY_BINDING, "ViewOnDrawExecutor.onDraw");
+        }
         mFirstDrawCompleted = true;
         mAttachedView.post(this);
     }
 
     public void onLoadAnimationCompleted() {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.FLAKY_BINDING,
+                    "ViewOnDrawExecutor.onLoadAnimationCompleted: mAttachedView != null="
+                            + (mAttachedView != null));
+        }
         mLoadAnimationCompleted = true;
         if (mAttachedView != null) {
             mAttachedView.post(this);
@@ -84,6 +110,12 @@
 
     @Override
     public void run() {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.FLAKY_BINDING,
+                    "ViewOnDrawExecutor.run: mLoadAnimationCompleted=" + mLoadAnimationCompleted
+                            + ", mFirstDrawCompleted=" + mFirstDrawCompleted
+                            + ", mCompleted=" + mCompleted);
+        }
         // Post the pending tasks after both onDraw and onLoadAnimationCompleted have been called.
         if (mLoadAnimationCompleted && mFirstDrawCompleted && !mCompleted) {
             markCompleted();
@@ -94,6 +126,12 @@
      * Executes all tasks immediately
      */
     public void markCompleted() {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.FLAKY_BINDING,
+                    "ViewOnDrawExecutor.markCompleted: mCancelled=" + mCancelled
+                            + ", mOnClearCallback != null=" + (mOnClearCallback != null)
+                            + ", mAttachedView != null=" + (mAttachedView != null));
+        }
         if (!mCancelled) {
             mTasks.executeAllAndDestroy();
         }
@@ -108,6 +146,9 @@
     }
 
     public void cancel() {
+        if (TestProtocol.sDebugTracing) {
+            Log.d(TestProtocol.FLAKY_BINDING, "ViewOnDrawExecutor.cancel");
+        }
         mCancelled = true;
         markCompleted();
     }