Dismiss Quickstep onboarding tip sooner.

We want to dismiss the quickstep tip immediately after swipe up gesture
crosses threshold.

Bug: 70180942
Test: Manual test
Change-Id: I760e2b5cad4b38c84b1199729f9d5f2a8827af4c
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java
index f60e207..d16e1b1 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsOnboarding.java
@@ -69,7 +69,8 @@
     private static final boolean RESET_PREFS_FOR_DEBUG = false;
     private static final boolean ONBOARDING_ENABLED = true;
     private static final long SHOW_DELAY_MS = 500;
-    private static final long SHOW_HIDE_DURATION_MS = 300;
+    private static final long SHOW_DURATION_MS = 300;
+    private static final long HIDE_DURATION_MS = 100;
     // Show swipe-up tips after opening overview from home this number of times.
     private static final int SWIPE_UP_SHOW_ON_OVERVIEW_OPENED_FROM_HOME_COUNT = 3;
     // Show quick scrub tips after opening overview this number of times.
@@ -172,6 +173,11 @@
                 }
 
                 @Override
+                public void onQuickStepStarted() {
+                    hide(true);
+                }
+
+                @Override
                 public void onQuickScrubStarted() {
                     boolean alreadySeenQuickScrubsOnboarding = hasSeenQuickScrubOnboarding();
                     if (!alreadySeenQuickScrubsOnboarding) {
@@ -292,7 +298,7 @@
         mHasDismissedQuickScrubTip = false;
         mNumAppsLaunchedSinceSwipeUpTipDismiss = 0;
         mOverviewOpenedCountSinceQuickScrubTipDismiss = 0;
-        hide(false);
+        hide(true);
     }
 
     public void onConfigurationChanged(Configuration newConfiguration) {
@@ -305,15 +311,12 @@
         if (!shouldShow()) {
             return;
         }
-        if (mLayoutAttachedToWindow) {
-            hide(false);
-        }
         mDismissView.setTag(stringRes);
         mLayout.setTag(stringRes);
         mTextView.setText(stringRes);
         // Only show in portrait.
         int orientation = mContext.getResources().getConfiguration().orientation;
-        if (orientation == Configuration.ORIENTATION_PORTRAIT) {
+        if (!mLayoutAttachedToWindow && orientation == Configuration.ORIENTATION_PORTRAIT) {
             mLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
 
             mWindowManager.addView(mLayout, getWindowLayoutParams());
@@ -322,7 +325,7 @@
                     .alpha(1f)
                     .withLayer()
                     .setStartDelay(SHOW_DELAY_MS)
-                    .setDuration(SHOW_HIDE_DURATION_MS)
+                    .setDuration(SHOW_DURATION_MS)
                     .setInterpolator(new DecelerateInterpolator())
                     .start();
         }
@@ -344,7 +347,8 @@
                 mLayout.animate()
                         .alpha(0f)
                         .withLayer()
-                        .setDuration(SHOW_HIDE_DURATION_MS)
+                        .setStartDelay(0)
+                        .setDuration(HIDE_DURATION_MS)
                         .setInterpolator(new AccelerateInterpolator())
                         .withEndAction(() -> mWindowManager.removeViewImmediate(mLayout))
                         .start();