Merge "Add the gesture nav tutorial menu page" into tm-qpr-dev
diff --git a/quickstep/res/layout/transient_taskbar.xml b/quickstep/res/layout/transient_taskbar.xml
index 47d63e7..62c6933 100644
--- a/quickstep/res/layout/transient_taskbar.xml
+++ b/quickstep/res/layout/transient_taskbar.xml
@@ -26,6 +26,8 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:gravity="center"
+        android:focusable="true"
+        android:importantForAccessibility="yes"
         android:forceHasOverlappingRendering="false"
         android:layout_gravity="bottom"
         android:layout_marginBottom="@dimen/transient_taskbar_bottom_margin"
diff --git a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
index 5c2f6b1..85d0ab5 100644
--- a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
+++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
@@ -33,6 +33,7 @@
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.annotation.VisibleForTesting;
 
 import com.android.launcher3.DeviceProfile;
 import com.android.launcher3.DragSource;
@@ -51,6 +52,8 @@
 import com.android.launcher3.model.data.ItemInfo;
 import com.android.launcher3.model.data.WorkspaceItemInfo;
 import com.android.launcher3.popup.SystemShortcut;
+import com.android.launcher3.testing.TestLogging;
+import com.android.launcher3.testing.shared.TestProtocol;
 import com.android.launcher3.touch.ItemLongClickListener;
 import com.android.launcher3.uioverrides.PredictedAppIcon;
 import com.android.launcher3.uioverrides.QuickstepLauncher;
@@ -89,10 +92,14 @@
 
     private List<PredictedAppIcon.PredictedIconOutlineDrawing> mOutlineDrawings = new ArrayList<>();
 
+    private boolean mEnableHotseatLongPressTipForTesting = true;
+
     private final View.OnLongClickListener mPredictionLongClickListener = v -> {
         if (!ItemLongClickListener.canStartDrag(mLauncher)) return false;
         if (mLauncher.getWorkspace().isSwitchingState()) return false;
-        if (!mLauncher.getOnboardingPrefs().getBoolean(
+
+        TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "onWorkspaceItemLongClick");
+        if (mEnableHotseatLongPressTipForTesting && !mLauncher.getOnboardingPrefs().getBoolean(
                 OnboardingPrefs.HOTSEAT_LONGPRESS_TIP_SEEN)) {
             Snackbar.show(mLauncher, R.string.hotseat_tip_gaps_filled,
                     R.string.hotseat_prediction_settings, null,
@@ -132,6 +139,12 @@
         onHotseatHierarchyChanged();
     }
 
+    /** Enables/disabled the hotseat prediction icon long press edu for testing. */
+    @VisibleForTesting
+    public void enableHotseatEdu(boolean enable) {
+        mEnableHotseatLongPressTipForTesting = enable;
+    }
+
     private void onHotseatHierarchyChanged() {
         if (mPauseFlags == 0 && !mLauncher.isWorkspaceLoading()) {
             // Post update after a single frame to avoid layout within layout
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 41d35cf..b98f172 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -600,7 +600,11 @@
                 if (!mIsStashed) {
                     tryStartTaskbarTimeout();
                 }
-                mControllers.taskbarViewController.announceForAccessibility();
+
+                // only announce if we are actually animating
+                if (duration > 0 && isInApp()) {
+                    mControllers.taskbarViewController.announceForAccessibility();
+                }
             }
         });
     }
diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index 1b888c9..5e22703 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -317,6 +317,12 @@
         return mHotseatPredictionController;
     }
 
+    @Override
+    public void enableHotseatEdu(boolean enable) {
+        super.enableHotseatEdu(enable);
+        mHotseatPredictionController.enableHotseatEdu(enable);
+    }
+
     /**
      * Builds the {@link QuickstepTransitionManager} instance to use for managing transitions.
      */
diff --git a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java
index 98b8d98..91d337f 100644
--- a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialController.java
@@ -92,6 +92,7 @@
                     case BACK_COMPLETED_FROM_RIGHT:
                     case BACK_CANCELLED_FROM_LEFT:
                     case BACK_CANCELLED_FROM_RIGHT:
+                    case BACK_NOT_STARTED_TOO_FAR_FROM_EDGE:
                         showFeedback(R.string.home_gesture_feedback_swipe_too_far_from_edge);
                         break;
                 }
diff --git a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
index af80d5f..7cd6756 100644
--- a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
+++ b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java
@@ -326,7 +326,11 @@
     }
 
     private void setBannerOutline() {
-        mOldBannerOutlineProvider = mBanner.getOutlineProvider();
+        // TODO(b\273367585) to investigate why mBanner.getOutlineProvider() can be null
+        mOldBannerOutlineProvider = mBanner.getOutlineProvider() != null
+                ? mBanner.getOutlineProvider()
+                : ViewOutlineProvider.BACKGROUND;
+
         mBanner.setOutlineProvider(new ViewOutlineProvider() {
             @Override
             public void getOutline(View view, Outline outline) {
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index 47396a5..0c19e4b 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -1144,7 +1144,7 @@
                     transientTaskbarIconSize[INDEX_DEFAULT]);
             transientTaskbarIconSize[INDEX_TWO_PANEL_PORTRAIT] = a.getFloat(
                     R.styleable.ProfileDisplayOption_transientTaskbarIconSizeTwoPanelPortrait,
-                    hotseatQsbSpace[INDEX_DEFAULT]);
+                    transientTaskbarIconSize[INDEX_DEFAULT]);
 
             a.recycle();
         }
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 22b07ef..7da16c0 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3259,6 +3259,10 @@
         return new LauncherAccessibilityDelegate(this);
     }
 
+    /** Enables/disabled the hotseat prediction icon long press edu for testing. */
+    @VisibleForTesting
+    public void enableHotseatEdu(boolean enable) {}
+
     /**
      * @see LauncherState#getOverviewScaleAndOffset(Launcher)
      */
diff --git a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java
index 6b21522..dd74125 100644
--- a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java
+++ b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java
@@ -39,6 +39,8 @@
 import com.android.launcher3.pm.PinRequestHelper;
 import com.android.launcher3.pm.ShortcutConfigActivityInfo;
 
+import java.util.function.Supplier;
+
 /**
  * Extension of ShortcutConfigActivityInfo to be used in the confirmation prompt for pin item
  * request.
@@ -50,15 +52,19 @@
     // actual existing class.
     private static final String STUB_COMPONENT_CLASS = "pinned-shortcut";
 
-    private final PinItemRequest mRequest;
+    private final Supplier<PinItemRequest> mRequestSupplier;
     private final ShortcutInfo mInfo;
     private final Context mContext;
 
     public PinShortcutRequestActivityInfo(PinItemRequest request, Context context) {
-        super(new ComponentName(request.getShortcutInfo().getPackage(), STUB_COMPONENT_CLASS),
-                request.getShortcutInfo().getUserHandle());
-        mRequest = request;
-        mInfo = request.getShortcutInfo();
+        this(request.getShortcutInfo(), () -> request, context);
+    }
+
+    public PinShortcutRequestActivityInfo(
+            ShortcutInfo si, Supplier<PinItemRequest> requestSupplier, Context context) {
+        super(new ComponentName(si.getPackage(), STUB_COMPONENT_CLASS), si.getUserHandle());
+        mRequestSupplier = requestSupplier;
+        mInfo = si;
         mContext = context;
     }
 
@@ -91,7 +97,7 @@
                         true /* isToState */);
         // Delay the actual accept() call until the drop animation is complete.
         return PinRequestHelper.createWorkspaceItemFromPinItemRequest(
-                mContext, mRequest, duration);
+                mContext, mRequestSupplier.get(), duration);
     }
 
     @Override
diff --git a/src/com/android/launcher3/views/ActivityContext.java b/src/com/android/launcher3/views/ActivityContext.java
index 10f40b7..a6744fb 100644
--- a/src/com/android/launcher3/views/ActivityContext.java
+++ b/src/com/android/launcher3/views/ActivityContext.java
@@ -324,8 +324,9 @@
         Bundle optsBundle = null;
         if (v != null) {
             optsBundle = getActivityLaunchOptions(v, item).toBundle();
-        } else if (item != null && item.animationType == LauncherSettings.Animation.DEFAULT_NO_ICON
-                && Utilities.ATLEAST_T) {
+        } else if (android.os.Build.VERSION.SDK_INT >= 33
+                && item != null
+                && item.animationType == LauncherSettings.Animation.DEFAULT_NO_ICON) {
             optsBundle = ActivityOptions.makeBasic()
                     .setSplashScreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_SOLID_COLOR).toBundle();
         }
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index c3633db..4d0e2af 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -80,7 +80,6 @@
 
     public static final float SHAPE_PROGRESS_DURATION = 0.10f;
     private static final RectF sTmpRectF = new RectF();
-    private static final Object[] sTmpObjArray = new Object[1];
 
     private Runnable mEndRunnable;
     private CancellationSignal mLoadIconSignal;
@@ -289,12 +288,13 @@
         } else {
             int width = (int) pos.width();
             int height = (int) pos.height();
+            Object[] tmpObjArray = new Object[1];
             if (supportsAdaptiveIcons) {
                 boolean shouldThemeIcon = btvIcon instanceof FastBitmapDrawable
                         && ((FastBitmapDrawable) btvIcon).isThemed();
-                drawable = getFullDrawable(l, info, width, height, shouldThemeIcon, sTmpObjArray);
+                drawable = getFullDrawable(l, info, width, height, shouldThemeIcon, tmpObjArray);
                 if (drawable instanceof AdaptiveIconDrawable) {
-                    badge = getBadge(l, info, sTmpObjArray[0]);
+                    badge = getBadge(l, info, tmpObjArray[0]);
                 } else {
                     // The drawable we get back is not an adaptive icon, so we need to use the
                     // BubbleTextView icon that is already legacy treated.
@@ -306,7 +306,7 @@
                     drawable = btvIcon;
                 } else {
                     drawable = getFullDrawable(l, info, width, height, true /* shouldThemeIcon */,
-                            sTmpObjArray);
+                            tmpObjArray);
                 }
             }
         }
@@ -679,7 +679,6 @@
         mOriginalIcon = null;
         mOnTargetChangeRunnable = null;
         mBadge = null;
-        sTmpObjArray[0] = null;
         sRecycledFetchIconId = sFetchIconId;
         mIconLoadResult = null;
         mClipIconView.recycle();
diff --git a/tests/src/com/android/launcher3/ui/workspace/TwoPanelWorkspaceTest.java b/tests/src/com/android/launcher3/ui/workspace/TwoPanelWorkspaceTest.java
index 6a938da..3abafdf 100644
--- a/tests/src/com/android/launcher3/ui/workspace/TwoPanelWorkspaceTest.java
+++ b/tests/src/com/android/launcher3/ui/workspace/TwoPanelWorkspaceTest.java
@@ -59,6 +59,7 @@
 
         // Pre verifying the screens
         executeOnLauncher(launcher -> {
+            launcher.enableHotseatEdu(false);
             assertPagesExist(launcher, 0, 1);
             assertItemsOnPage(launcher, 0, "Play Store", "Maps");
             assertPageEmpty(launcher, 1);
@@ -67,6 +68,7 @@
 
     @After
     public void tearDown() {
+        executeOnLauncher(launcher -> launcher.enableHotseatEdu(true));
         mLauncher.useDefaultWorkspaceLayoutOnReload();
     }