Merge "Fix failing test TaplTaskbarTest#testHideShowTaskbar" into tm-dev
diff --git a/quickstep/src/com/android/quickstep/interaction/AssistantGestureTutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/AssistantGestureTutorialFragment.java
index b797f0c..b3f2354 100644
--- a/quickstep/src/com/android/quickstep/interaction/AssistantGestureTutorialFragment.java
+++ b/quickstep/src/com/android/quickstep/interaction/AssistantGestureTutorialFragment.java
@@ -15,13 +15,21 @@
  */
 package com.android.quickstep.interaction;
 
+import android.content.SharedPreferences;
 import android.view.MotionEvent;
 import android.view.View;
 
+import com.android.launcher3.logging.StatsLogManager;
 import com.android.quickstep.interaction.TutorialController.TutorialType;
 
 /** Shows the Home gesture interactive tutorial. */
 public class AssistantGestureTutorialFragment extends TutorialFragment {
+
+    protected AssistantGestureTutorialFragment(
+            SharedPreferences sharedPrefs, StatsLogManager statsLogManager) {
+        super(sharedPrefs, statsLogManager);
+    }
+
     @Override
     TutorialController createController(TutorialType type) {
         return new AssistantGestureTutorialController(this, type);
@@ -39,4 +47,14 @@
         }
         return super.onTouch(view, motionEvent);
     }
+
+    @Override
+    void logTutorialStepShown() {
+        // No-Op: tutorial step not currently shown to users
+    }
+
+    @Override
+    void logTutorialStepCompleted() {
+        // No-Op: tutorial step not currently shown to users
+    }
 }
diff --git a/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialFragment.java
index f54734d..e7ed0b4 100644
--- a/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialFragment.java
+++ b/quickstep/src/com/android/quickstep/interaction/BackGestureTutorialFragment.java
@@ -19,12 +19,14 @@
 import android.animation.AnimatorListenerAdapter;
 import android.animation.AnimatorSet;
 import android.animation.ObjectAnimator;
+import android.content.SharedPreferences;
 import android.view.MotionEvent;
 import android.view.View;
 
 import androidx.annotation.Nullable;
 
 import com.android.launcher3.R;
+import com.android.launcher3.logging.StatsLogManager;
 import com.android.quickstep.interaction.TutorialController.TutorialType;
 
 import java.util.ArrayList;
@@ -32,6 +34,11 @@
 /** Shows the Back gesture interactive tutorial. */
 public class BackGestureTutorialFragment extends TutorialFragment {
 
+    protected BackGestureTutorialFragment(
+            SharedPreferences sharedPrefs, StatsLogManager statsLogManager) {
+        super(sharedPrefs, statsLogManager);
+    }
+
     @Nullable
     @Override
     Integer getEdgeAnimationResId() {
@@ -117,4 +124,16 @@
         }
         return super.onTouch(view, motionEvent);
     }
+
+    @Override
+    void logTutorialStepShown() {
+        mStatsLogManager.logger().log(
+                StatsLogManager.LauncherEvent.LAUNCHER_GESTURE_TUTORIAL_BACK_STEP_SHOWN);
+    }
+
+    @Override
+    void logTutorialStepCompleted() {
+        mStatsLogManager.logger().log(
+                StatsLogManager.LauncherEvent.LAUNCHER_GESTURE_TUTORIAL_BACK_STEP_COMPLETED);
+    }
 }
diff --git a/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java b/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java
index c2524b1..002e8b7 100644
--- a/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java
+++ b/quickstep/src/com/android/quickstep/interaction/GestureSandboxActivity.java
@@ -15,6 +15,7 @@
  */
 package com.android.quickstep.interaction;
 
+import android.content.SharedPreferences;
 import android.graphics.Color;
 import android.graphics.Rect;
 import android.os.Bundle;
@@ -28,6 +29,8 @@
 import androidx.fragment.app.FragmentActivity;
 
 import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
+import com.android.launcher3.logging.StatsLogManager;
 import com.android.quickstep.interaction.TutorialController.TutorialType;
 
 import java.util.List;
@@ -46,17 +49,26 @@
     private int mCurrentStep;
     private int mNumSteps;
 
+    private SharedPreferences mSharedPrefs;
+    private StatsLogManager mStatsLogManager;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         requestWindowFeature(Window.FEATURE_NO_TITLE);
         setContentView(R.layout.gesture_tutorial_activity);
 
+        mSharedPrefs = Utilities.getPrefs(this);
+        mStatsLogManager = StatsLogManager.newInstance(getApplicationContext());
+
         Bundle args = savedInstanceState == null ? getIntent().getExtras() : savedInstanceState;
         mTutorialSteps = getTutorialSteps(args);
         mCurrentTutorialStep = mTutorialSteps[mCurrentStep - 1];
         mFragment = TutorialFragment.newInstance(
-                mCurrentTutorialStep, args.getBoolean(KEY_GESTURE_COMPLETE, false));
+                mCurrentTutorialStep,
+                args.getBoolean(KEY_GESTURE_COMPLETE, false),
+                mSharedPrefs,
+                mStatsLogManager);
         getSupportFragmentManager().beginTransaction()
                 .add(R.id.gesture_tutorial_fragment_container, mFragment)
                 .commit();
@@ -105,13 +117,6 @@
     }
 
     /**
-     * Closes the tutorial and this activity.
-     */
-    public void closeTutorial() {
-        mFragment.closeTutorial();
-    }
-
-    /**
      * Replaces the current TutorialFragment, continuing to the next tutorial step if there is one.
      *
      * If there is no following step, the tutorial is closed.
@@ -122,7 +127,8 @@
             return;
         }
         mCurrentTutorialStep = mTutorialSteps[mCurrentStep];
-        mFragment = TutorialFragment.newInstance(mCurrentTutorialStep, false);
+        mFragment = TutorialFragment.newInstance(
+                mCurrentTutorialStep, /* gestureComplete= */ false, mSharedPrefs, mStatsLogManager);
         getSupportFragmentManager().beginTransaction()
                 .replace(R.id.gesture_tutorial_fragment_container, mFragment)
                 .runOnCommit(() -> mFragment.onAttachedToWindow())
diff --git a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialFragment.java
index 423e66f..e987d5a 100644
--- a/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialFragment.java
+++ b/quickstep/src/com/android/quickstep/interaction/HomeGestureTutorialFragment.java
@@ -18,12 +18,14 @@
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
 import android.animation.AnimatorSet;
+import android.content.SharedPreferences;
 import android.view.MotionEvent;
 import android.view.View;
 
 import androidx.annotation.Nullable;
 
 import com.android.launcher3.R;
+import com.android.launcher3.logging.StatsLogManager;
 import com.android.quickstep.interaction.TutorialController.TutorialType;
 
 import java.util.ArrayList;
@@ -31,6 +33,11 @@
 /** Shows the Home gesture interactive tutorial. */
 public class HomeGestureTutorialFragment extends TutorialFragment {
 
+    protected HomeGestureTutorialFragment(
+            SharedPreferences sharedPrefs, StatsLogManager statsLogManager) {
+        super(sharedPrefs, statsLogManager);
+    }
+
     @Nullable
     @Override
     Integer getEdgeAnimationResId() {
@@ -99,4 +106,16 @@
         releaseFeedbackAnimation();
         return super.onTouch(view, motionEvent);
     }
+
+    @Override
+    void logTutorialStepShown() {
+        mStatsLogManager.logger().log(
+                StatsLogManager.LauncherEvent.LAUNCHER_GESTURE_TUTORIAL_HOME_STEP_SHOWN);
+    }
+
+    @Override
+    void logTutorialStepCompleted() {
+        mStatsLogManager.logger().log(
+                StatsLogManager.LauncherEvent.LAUNCHER_GESTURE_TUTORIAL_HOME_STEP_COMPLETED);
+    }
 }
diff --git a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialFragment.java
index f63a945..c7e24db 100644
--- a/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialFragment.java
+++ b/quickstep/src/com/android/quickstep/interaction/OverviewGestureTutorialFragment.java
@@ -18,12 +18,14 @@
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
 import android.animation.AnimatorSet;
+import android.content.SharedPreferences;
 import android.view.MotionEvent;
 import android.view.View;
 
 import androidx.annotation.Nullable;
 
 import com.android.launcher3.R;
+import com.android.launcher3.logging.StatsLogManager;
 import com.android.quickstep.interaction.TutorialController.TutorialType;
 
 import java.util.ArrayList;
@@ -31,6 +33,11 @@
 /** Shows the Overview gesture interactive tutorial. */
 public class OverviewGestureTutorialFragment extends TutorialFragment {
 
+    protected OverviewGestureTutorialFragment(
+            SharedPreferences sharedPrefs, StatsLogManager statsLogManager) {
+        super(sharedPrefs, statsLogManager);
+    }
+
     @Nullable
     @Override
     Integer getEdgeAnimationResId() {
@@ -111,4 +118,16 @@
         releaseFeedbackAnimation();
         return super.onTouch(view, motionEvent);
     }
+
+    @Override
+    void logTutorialStepShown() {
+        mStatsLogManager.logger().log(
+                StatsLogManager.LauncherEvent.LAUNCHER_GESTURE_TUTORIAL_OVERVIEW_STEP_SHOWN);
+    }
+
+    @Override
+    void logTutorialStepCompleted() {
+        mStatsLogManager.logger().log(
+                StatsLogManager.LauncherEvent.LAUNCHER_GESTURE_TUTORIAL_OVERVIEW_STEP_COMPLETED);
+    }
 }
diff --git a/quickstep/src/com/android/quickstep/interaction/SandboxModeTutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/SandboxModeTutorialFragment.java
index 955a2f7..92a2731 100644
--- a/quickstep/src/com/android/quickstep/interaction/SandboxModeTutorialFragment.java
+++ b/quickstep/src/com/android/quickstep/interaction/SandboxModeTutorialFragment.java
@@ -15,14 +15,21 @@
  */
 package com.android.quickstep.interaction;
 
+import android.content.SharedPreferences;
 import android.view.MotionEvent;
 import android.view.View;
 
+import com.android.launcher3.logging.StatsLogManager;
 import com.android.quickstep.interaction.TutorialController.TutorialType;
 
 /** Shows the general navigation gesture sandbox environment. */
 public class SandboxModeTutorialFragment extends TutorialFragment {
 
+    protected SandboxModeTutorialFragment(
+            SharedPreferences sharedPrefs, StatsLogManager statsLogManager) {
+        super(sharedPrefs, statsLogManager);
+    }
+
     @Override
     TutorialController createController(TutorialType type) {
         return new SandboxModeTutorialController(this, type);
@@ -40,4 +47,14 @@
         }
         return super.onTouch(view, motionEvent);
     }
+
+    @Override
+    void logTutorialStepShown() {
+        // No-Op: tutorial step not currently shown to users
+    }
+
+    @Override
+    void logTutorialStepCompleted() {
+        // No-Op: tutorial step not currently shown to users
+    }
 }
diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialController.java b/quickstep/src/com/android/quickstep/interaction/TutorialController.java
index 3c88988..6a8894e 100644
--- a/quickstep/src/com/android/quickstep/interaction/TutorialController.java
+++ b/quickstep/src/com/android/quickstep/interaction/TutorialController.java
@@ -81,7 +81,8 @@
     TutorialType mTutorialType;
     final Context mContext;
 
-    final TextView mCloseButton;
+    final TextView mSkipButton;
+    final Button mDoneButton;
     final ViewGroup mFeedbackView;
     final TextView mFeedbackTitleView;
     final ImageView mEdgeGestureVideoView;
@@ -94,7 +95,6 @@
     final AnimatedTaskView mFakePreviousTaskView;
     final View mRippleView;
     final RippleDrawable mRippleDrawable;
-    final Button mActionButton;
     final TutorialStepIndicator mTutorialStepView;
     final ImageView mFingerDotView;
     private final AlertDialog mSkipTutorialDialog;
@@ -115,8 +115,8 @@
         mContext = mTutorialFragment.getContext();
 
         RootSandboxLayout rootView = tutorialFragment.getRootView();
-        mCloseButton = rootView.findViewById(R.id.gesture_tutorial_fragment_close_button);
-        mCloseButton.setOnClickListener(button -> showSkipTutorialDialog());
+        mSkipButton = rootView.findViewById(R.id.gesture_tutorial_fragment_close_button);
+        mSkipButton.setOnClickListener(button -> showSkipTutorialDialog());
         mFeedbackView = rootView.findViewById(R.id.gesture_tutorial_fragment_feedback_view);
         mFeedbackTitleView = mFeedbackView.findViewById(
                 R.id.gesture_tutorial_fragment_feedback_title);
@@ -130,7 +130,7 @@
                 rootView.findViewById(R.id.gesture_tutorial_fake_previous_task_view);
         mRippleView = rootView.findViewById(R.id.gesture_tutorial_ripple_view);
         mRippleDrawable = (RippleDrawable) mRippleView.getBackground();
-        mActionButton = rootView.findViewById(R.id.gesture_tutorial_fragment_action_button);
+        mDoneButton = rootView.findViewById(R.id.gesture_tutorial_fragment_action_button);
         mTutorialStepView =
                 rootView.findViewById(R.id.gesture_tutorial_fragment_feedback_tutorial_step);
         mFingerDotView = rootView.findViewById(R.id.gesture_tutorial_finger_dot);
@@ -431,22 +431,22 @@
     }
 
     void updateCloseButton() {
-        mCloseButton.setTextAppearance(Utilities.isDarkTheme(mContext)
+        mSkipButton.setTextAppearance(Utilities.isDarkTheme(mContext)
                 ? R.style.TextAppearance_GestureTutorial_Feedback_Subtext
                 : R.style.TextAppearance_GestureTutorial_Feedback_Subtext_Dark);
     }
 
     void hideActionButton() {
-        mCloseButton.setVisibility(View.VISIBLE);
+        mSkipButton.setVisibility(View.VISIBLE);
         // Invisible to maintain the layout.
-        mActionButton.setVisibility(View.INVISIBLE);
-        mActionButton.setOnClickListener(null);
+        mDoneButton.setVisibility(View.INVISIBLE);
+        mDoneButton.setOnClickListener(null);
     }
 
     void showActionButton() {
-        mCloseButton.setVisibility(GONE);
-        mActionButton.setVisibility(View.VISIBLE);
-        mActionButton.setOnClickListener(this::onActionButtonClicked);
+        mSkipButton.setVisibility(GONE);
+        mDoneButton.setVisibility(View.VISIBLE);
+        mDoneButton.setOnClickListener(this::onActionButtonClicked);
     }
 
     void hideFakeTaskbar(boolean animateToHotseat) {
@@ -609,7 +609,7 @@
                     R.id.gesture_tutorial_dialog_confirm_button);
             if (confirmButton != null) {
                 confirmButton.setOnClickListener(v -> {
-                    sandboxActivity.closeTutorial();
+                    mTutorialFragment.closeTutorial(true);
                     tutorialDialog.dismiss();
                 });
             } else {
diff --git a/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java b/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
index 4b836e3..d79b946 100644
--- a/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
+++ b/quickstep/src/com/android/quickstep/interaction/TutorialFragment.java
@@ -20,11 +20,13 @@
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.graphics.Insets;
 import android.graphics.drawable.Animatable2;
 import android.graphics.drawable.AnimatedVectorDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
+import android.util.ArraySet;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
@@ -43,14 +45,24 @@
 import com.android.launcher3.DeviceProfile;
 import com.android.launcher3.InvariantDeviceProfile;
 import com.android.launcher3.R;
+import com.android.launcher3.logging.StatsLogManager;
 import com.android.quickstep.interaction.TutorialController.TutorialType;
 
+import java.util.Set;
+
 abstract class TutorialFragment extends Fragment implements OnTouchListener {
 
     private static final String LOG_TAG = "TutorialFragment";
     static final String KEY_TUTORIAL_TYPE = "tutorial_type";
     static final String KEY_GESTURE_COMPLETE = "gesture_complete";
 
+    private static final String TUTORIAL_SKIPPED_PREFERENCE_KEY = "pref_gestureTutorialSkipped";
+    private static final String COMPLETED_TUTORIAL_STEPS_PREFERENCE_KEY =
+            "pref_completedTutorialSteps";
+
+    private final SharedPreferences mSharedPrefs;
+    protected final StatsLogManager mStatsLogManager;
+
     TutorialType mTutorialType;
     boolean mGestureComplete = false;
     @Nullable TutorialController mTutorialController = null;
@@ -71,10 +83,15 @@
     private boolean mIsLargeScreen;
     private boolean mIsFoldable;
 
-    public static TutorialFragment newInstance(TutorialType tutorialType, boolean gestureComplete) {
-        TutorialFragment fragment = getFragmentForTutorialType(tutorialType);
+    public static TutorialFragment newInstance(
+            TutorialType tutorialType,
+            boolean gestureComplete,
+            SharedPreferences sharedPrefs,
+            StatsLogManager statsLogManager) {
+        TutorialFragment fragment =
+                getFragmentForTutorialType(tutorialType, sharedPrefs, statsLogManager);
         if (fragment == null) {
-            fragment = new BackGestureTutorialFragment();
+            fragment = new BackGestureTutorialFragment(sharedPrefs, statsLogManager);
             tutorialType = TutorialType.BACK_NAVIGATION;
         }
 
@@ -86,28 +103,36 @@
     }
 
     @Nullable
-    private static TutorialFragment getFragmentForTutorialType(TutorialType tutorialType) {
+    private static TutorialFragment getFragmentForTutorialType(
+            TutorialType tutorialType,
+            SharedPreferences sharedPrefs,
+            StatsLogManager statsLogManager) {
         switch (tutorialType) {
             case BACK_NAVIGATION:
             case BACK_NAVIGATION_COMPLETE:
-                return new BackGestureTutorialFragment();
+                return new BackGestureTutorialFragment(sharedPrefs, statsLogManager);
             case HOME_NAVIGATION:
             case HOME_NAVIGATION_COMPLETE:
-                return new HomeGestureTutorialFragment();
+                return new HomeGestureTutorialFragment(sharedPrefs, statsLogManager);
             case OVERVIEW_NAVIGATION:
             case OVERVIEW_NAVIGATION_COMPLETE:
-                return new OverviewGestureTutorialFragment();
+                return new OverviewGestureTutorialFragment(sharedPrefs, statsLogManager);
             case ASSISTANT:
             case ASSISTANT_COMPLETE:
-                return new AssistantGestureTutorialFragment();
+                return new AssistantGestureTutorialFragment(sharedPrefs, statsLogManager);
             case SANDBOX_MODE:
-                return new SandboxModeTutorialFragment();
+                return new SandboxModeTutorialFragment(sharedPrefs, statsLogManager);
             default:
                 Log.e(LOG_TAG, "Failed to find an appropriate fragment for " + tutorialType.name());
         }
         return null;
     }
 
+    protected TutorialFragment(SharedPreferences sharedPrefs, StatsLogManager statsLogManager) {
+        mSharedPrefs = sharedPrefs;
+        mStatsLogManager = statsLogManager;
+    }
+
     @Nullable Integer getEdgeAnimationResId() {
         return null;
     }
@@ -315,6 +340,7 @@
     }
 
     void onAttachedToWindow() {
+        logTutorialStepShown();
         mEdgeBackGestureHandler.setViewGroupParent(getRootView());
     }
 
@@ -348,8 +374,16 @@
     }
 
     void continueTutorial() {
-        GestureSandboxActivity gestureSandboxActivity = getGestureSandboxActivity();
+        Set<String> updatedCompletedSteps = new ArraySet<>(mSharedPrefs.getStringSet(
+                COMPLETED_TUTORIAL_STEPS_PREFERENCE_KEY, new ArraySet<>()));
 
+        updatedCompletedSteps.add(mTutorialType.toString());
+
+        mSharedPrefs.edit().putStringSet(
+                COMPLETED_TUTORIAL_STEPS_PREFERENCE_KEY, updatedCompletedSteps).apply();
+        logTutorialStepCompleted();
+
+        GestureSandboxActivity gestureSandboxActivity = getGestureSandboxActivity();
         if (gestureSandboxActivity == null) {
             closeTutorial();
             return;
@@ -358,6 +392,15 @@
     }
 
     void closeTutorial() {
+        closeTutorial(false);
+    }
+
+    void closeTutorial(boolean tutorialSkipped) {
+        if (tutorialSkipped) {
+            mSharedPrefs.edit().putBoolean(TUTORIAL_SKIPPED_PREFERENCE_KEY, true).apply();
+            mStatsLogManager.logger().log(
+                    StatsLogManager.LauncherEvent.LAUNCHER_GESTURE_TUTORIAL_SKIPPED);
+        }
         FragmentActivity activity = getActivity();
         if (activity != null) {
             activity.setResult(Activity.RESULT_OK);
@@ -390,6 +433,10 @@
                 || (mTutorialController != null && mTutorialController.isGestureCompleted());
     }
 
+    abstract void logTutorialStepShown();
+
+    abstract void logTutorialStepCompleted();
+
     @Nullable
     private GestureSandboxActivity getGestureSandboxActivity() {
         Context context = getContext();
diff --git a/quickstep/tests/src/com/android/quickstep/DigitalWellBeingToastTest.java b/quickstep/tests/src/com/android/quickstep/DigitalWellBeingToastTest.java
index 3e84a76..3bd3722 100644
--- a/quickstep/tests/src/com/android/quickstep/DigitalWellBeingToastTest.java
+++ b/quickstep/tests/src/com/android/quickstep/DigitalWellBeingToastTest.java
@@ -48,7 +48,7 @@
                             Duration.ofSeconds(600), Duration.ofSeconds(300),
                             PendingIntent.getActivity(mTargetContext, -1, new Intent(), 0)));
 
-            mLauncher.pressHome();
+            mLauncher.goHome();
             final DigitalWellBeingToast toast = getToast();
 
             waitForLauncherCondition("Toast is not visible", launcher -> toast.hasLimit());
@@ -58,7 +58,7 @@
             runWithShellPermission(
                     () -> usageStatsManager.unregisterAppUsageLimitObserver(observerId));
 
-            mLauncher.pressHome();
+            mLauncher.goHome();
             assertFalse("Toast is visible", getToast().hasLimit());
         } finally {
             runWithShellPermission(
diff --git a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java
index 5351963..6ec6269 100644
--- a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java
+++ b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java
@@ -41,7 +41,7 @@
         super.setUp();
         TaplTestsLauncher3.initialize(this);
         // b/143488140
-        mLauncher.pressHome();
+        mLauncher.goHome();
         // Start an activity where the gestures start.
         startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
     }
@@ -54,7 +54,7 @@
 
         // The test action.
         eventProcessor.startIteration();
-        mLauncher.pressHome();
+        mLauncher.goHome();
         eventProcessor.finishIteration();
     }
 
@@ -66,7 +66,7 @@
             closeLauncherActivity();
 
             // The test action.
-            mLauncher.pressHome();
+            mLauncher.goHome();
         }
     }
 
@@ -81,6 +81,6 @@
             mLauncher.getLaunchedAppState().switchToOverview();
         }
         closeLauncherActivity();
-        mLauncher.pressHome();
+        mLauncher.goHome();
     }
 }
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 396cb1b..399cd10 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -102,7 +102,7 @@
     public void testOverview() throws Exception {
         startTestAppsWithCheck();
         // mLauncher.pressHome() also tests an important case of pressing home while in background.
-        Overview overview = mLauncher.pressHome().switchToOverview();
+        Overview overview = mLauncher.goHome().switchToOverview();
         assertTrue("Launcher internal state didn't switch to Overview",
                 isInState(() -> LauncherState.OVERVIEW));
         executeOnLauncher(
@@ -127,7 +127,7 @@
                 getCurrentOverviewPage(launcher) < currentTaskAfterFlingForward));
 
         // Test opening a task.
-        OverviewTask task = mLauncher.pressHome().switchToOverview().getCurrentTask();
+        OverviewTask task = mLauncher.goHome().switchToOverview().getCurrentTask();
         assertNotNull("overview.getCurrentTask() returned null (1)", task);
         assertNotNull("OverviewTask.open returned null", task.open());
         assertTrue("Test activity didn't open from Overview", mDevice.wait(Until.hasObject(
@@ -139,7 +139,7 @@
                 isInLaunchedApp(launcher)));
 
         // Test dismissing a task.
-        overview = mLauncher.pressHome().switchToOverview();
+        overview = mLauncher.goHome().switchToOverview();
         assertTrue("Launcher internal state didn't switch to Overview",
                 isInState(() -> LauncherState.OVERVIEW));
         final Integer numTasks = getFromLauncher(launcher -> getTaskCount(launcher));
@@ -151,7 +151,7 @@
                         numTasks - 1, getTaskCount(launcher)));
 
         // Test dismissing all tasks.
-        mLauncher.pressHome().switchToOverview().dismissAllTasks();
+        mLauncher.goHome().switchToOverview().dismissAllTasks();
         assertTrue("Launcher internal state is not Home",
                 isInState(() -> LauncherState.NORMAL));
         executeOnLauncher(
@@ -168,14 +168,14 @@
     @ScreenRecord // b/195673272
     public void testOverviewActions() throws Exception {
         // Experimenting for b/165029151:
-        final Overview overview = mLauncher.pressHome().switchToOverview();
+        final Overview overview = mLauncher.goHome().switchToOverview();
         if (overview.hasTasks()) overview.dismissAllTasks();
-        mLauncher.pressHome();
+        mLauncher.goHome();
         //
 
         startTestAppsWithCheck();
         OverviewActions actionsView =
-                mLauncher.pressHome().switchToOverview().getOverviewActions();
+                mLauncher.goHome().switchToOverview().getOverviewActions();
         actionsView.clickAndDismissScreenshot();
     }
 
@@ -200,7 +200,7 @@
     @PortraitLandscape
     public void testSwitchToOverview() throws Exception {
         assertNotNull("Workspace.switchToOverview() returned null",
-                mLauncher.pressHome().switchToOverview());
+                mLauncher.goHome().switchToOverview());
         assertTrue("Launcher internal state didn't switch to Overview",
                 isInState(() -> LauncherState.OVERVIEW));
     }
@@ -240,7 +240,7 @@
         // Testing pressHome.
         assertTrue("Launcher internal state is not All Apps",
                 isInState(() -> LauncherState.ALL_APPS));
-        assertNotNull("pressHome returned null", mLauncher.pressHome());
+        assertNotNull("pressHome returned null", mLauncher.goHome());
         assertTrue("Launcher internal state is not Home",
                 isInState(() -> LauncherState.NORMAL));
         assertNotNull("getHome returned null", mLauncher.getWorkspace());
@@ -289,7 +289,7 @@
     @PortraitLandscape
     public void testQuickSwitchFromHome() throws Exception {
         startTestActivity(2);
-        mLauncher.pressHome().quickSwitchToPreviousApp();
+        mLauncher.goHome().quickSwitchToPreviousApp();
         assertTrue("The most recent task is not running after quick switching from home",
                 isTestActivityRunning(2));
         getAndAssertLaunchedApp();
@@ -329,7 +329,7 @@
             startTestActivity(i);
         }
 
-        Overview overview = mLauncher.pressHome().switchToOverview();
+        Overview overview = mLauncher.goHome().switchToOverview();
         executeOnLauncher(
                 launcher -> assertTrue("Don't have at least 13 tasks",
                         getTaskCount(launcher) >= 13));
@@ -348,7 +348,7 @@
                         DEFAULT_UI_TIMEOUT));
 
         // Scroll the task offscreen as it is now first
-        overview = mLauncher.pressHome().switchToOverview();
+        overview = mLauncher.goHome().switchToOverview();
         overview.scrollCurrentTaskOffScreen();
         assertTrue("Launcher internal state is not Overview",
                 isInState(() -> LauncherState.OVERVIEW));
@@ -377,7 +377,7 @@
                         launcher)) <= 1)));
 
         // Test dismissing all tasks.
-        mLauncher.pressHome().switchToOverview().dismissAllTasks();
+        mLauncher.goHome().switchToOverview().dismissAllTasks();
         assertTrue("Launcher internal state is not Home",
                 isInState(() -> LauncherState.NORMAL));
         executeOnLauncher(
diff --git a/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java b/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java
index 661beda..7e408a8 100644
--- a/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java
+++ b/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java
@@ -197,7 +197,7 @@
 
             addItemToScreen(item);
             assertTrue("Widget is not present",
-                    mLauncher.pressHome().tryGetWidget(info.label, DEFAULT_UI_TIMEOUT) != null);
+                    mLauncher.goHome().tryGetWidget(info.label, DEFAULT_UI_TIMEOUT) != null);
             int widgetId = item.appWidgetId;
 
             // Verify widget id
@@ -221,7 +221,7 @@
 
             // Widget is updated when going home
             mInitTracker.disableLog();
-            mLauncher.pressHome();
+            mLauncher.goHome();
             verifyWidget(finalWidgetText);
             assertNotEquals(1, mInitTracker.viewInitCount);
         } finally {
diff --git a/res/values-sw720dp-land/dimens.xml b/res/values-sw720dp-land/dimens.xml
index a9e0fb8..9821526 100644
--- a/res/values-sw720dp-land/dimens.xml
+++ b/res/values-sw720dp-land/dimens.xml
@@ -15,6 +15,9 @@
 -->
 
 <resources>
-<!-- AllApps -->
-    <dimen name="all_apps_top_padding">0dp</dimen>
+    <!-- Widget picker-->
+    <dimen name="widget_list_horizontal_margin">49dp</dimen>
+
+    <!-- Bottom sheet-->
+    <dimen name="bottom_sheet_extra_top_padding">0dp</dimen>
 </resources>
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 5c314d5..7ebc3f8 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -16,6 +16,11 @@
 
 <resources>
 <!-- AllApps -->
-    <dimen name="all_apps_top_padding">300dp</dimen>
     <dimen name="all_apps_bottom_sheet_horizontal_padding">65dp</dimen>
+
+<!-- Widget picker-->
+    <dimen name="widget_list_horizontal_margin">30dp</dimen>
+
+<!-- Bottom sheet-->
+    <dimen name="bottom_sheet_extra_top_padding">300dp</dimen>
 </resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 2b599bc..338e218 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -94,7 +94,6 @@
 
     <!-- All Apps -->
     <dimen name="all_apps_starting_vertical_translate">320dp</dimen>
-    <dimen name="all_apps_top_padding">0dp</dimen>
     <dimen name="all_apps_search_bar_field_height">48dp</dimen>
     <!-- all_apps_search_bar_field_height / 2 -->
     <dimen name="all_apps_search_bar_content_overlap">24dp</dimen>
@@ -368,6 +367,7 @@
     <dimen name="padded_rounded_button_padding">8dp</dimen>
 
 <!-- Bottom sheet related parameters -->
+    <dimen name="bottom_sheet_extra_top_padding">0dp</dimen>
     <dimen name="bottom_sheet_handle_width">32dp</dimen>
     <dimen name="bottom_sheet_handle_height">4dp</dimen>
     <dimen name="bottom_sheet_handle_margin">16dp</dimen>
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index ceb38d0..e75348c 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -103,7 +103,7 @@
     public static final int TYPE_REBIND_SAFE = TYPE_WIDGETS_FULL_SHEET
             | TYPE_WIDGETS_BOTTOM_SHEET | TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE
             | TYPE_ALL_APPS_EDU | TYPE_ICON_SURFACE | TYPE_WIDGETS_EDUCATION_DIALOG
-            | TYPE_TASKBAR_EDUCATION_DIALOG | TYPE_TASKBAR_ALL_APPS;
+            | TYPE_TASKBAR_EDUCATION_DIALOG;
 
     // Usually we show the back button when a floating view is open. Instead, hide for these types.
     public static final int TYPE_HIDE_BACK_BUTTON = TYPE_ON_BOARD_POPUP | TYPE_DISCOVERY_BOUNCE
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 041bee9..3bc0f6d 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -867,6 +867,11 @@
     }
 
     protected void applyCompoundDrawables(Drawable icon) {
+        if (icon == null) {
+            // Icon can be null when we use the BubbleTextView for text only.
+            return;
+        }
+
         // If we had already set an icon before, disable relayout as the icon size is the
         // same as before.
         mDisableRelayout = mIcon != null;
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 39020bd..622d750 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -175,6 +175,7 @@
     public Point allAppsBorderSpacePx;
     public int allAppsShiftRange;
     public int allAppsTopPadding;
+    public int bottomSheetTopPadding;
     public int allAppsCellHeightPx;
     public int allAppsCellWidthPx;
     public int allAppsIconSizePx;
@@ -294,8 +295,11 @@
         desiredWorkspaceHorizontalMarginPx = getHorizontalMarginPx(inv, res);
         desiredWorkspaceHorizontalMarginOriginalPx = desiredWorkspaceHorizontalMarginPx;
 
-        allAppsTopPadding = res.getDimensionPixelSize(R.dimen.all_apps_top_padding)
-                + (isTablet ? heightPx - availableHeightPx : 0);
+        bottomSheetTopPadding = windowBounds.insets.top // statusbar height
+                + res.getDimensionPixelSize(R.dimen.bottom_sheet_extra_top_padding)
+                + (isTablet ? 0 : edgeMarginPx); // phones need edgeMarginPx additional padding
+
+        allAppsTopPadding = isTablet ? bottomSheetTopPadding : 0;
         allAppsShiftRange = isTablet
                 ? heightPx - allAppsTopPadding
                 : res.getDimensionPixelSize(R.dimen.all_apps_starting_vertical_translate);
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 85ee8bc..5aa8a46 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -162,6 +162,7 @@
     private synchronized boolean prepForMigration(String dbFile, String targetTableName,
             Supplier<DatabaseHelper> src, Supplier<DatabaseHelper> dst) {
         if (TextUtils.equals(dbFile, mOpenHelper.getDatabaseName())) {
+            Log.e("b/198965093", "prepForMigration - target db is same as current: " + dbFile);
             return false;
         }
 
@@ -439,7 +440,7 @@
                 Bundle result = new Bundle();
                 result.putBoolean(LauncherSettings.Settings.EXTRA_VALUE,
                         prepForMigration(
-                                InvariantDeviceProfile.INSTANCE.get(getContext()).dbFile,
+                                arg /* dbFile */,
                                 Favorites.TMP_TABLE,
                                 () -> mOpenHelper,
                                 () -> DatabaseHelper.createDatabaseHelper(
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 3e0c9fc..df42355 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -89,9 +89,6 @@
     public static final BooleanFlag ENABLE_DEVICE_SEARCH = new DeviceFlag(
             "ENABLE_DEVICE_SEARCH", true, "Allows on device search in all apps");
 
-    public static final BooleanFlag ENABLE_ONE_SEARCH = new DeviceFlag("ENABLE_ONE_SEARCH", false,
-            "Use homescreen search box to complete allApps searches");
-
     public static final BooleanFlag ENABLE_FLOATING_SEARCH_BAR =
             getDebugFlag("ENABLE_FLOATING_SEARCH_BAR", false,
                     "Keep All Apps search bar at the bottom (but above keyboard if open)");
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index f392e95..e6dc21e 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -529,6 +529,27 @@
         @UiEvent(doc = "User clicks on the search icon on header to launch search in app.")
         LAUNCHER_ALLAPPS_SEARCHINAPP_LAUNCH(913),
 
+        @UiEvent(doc = "User is shown the back gesture navigation tutorial step.")
+        LAUNCHER_GESTURE_TUTORIAL_BACK_STEP_SHOWN(959),
+
+        @UiEvent(doc = "User is shown the home gesture navigation tutorial step.")
+        LAUNCHER_GESTURE_TUTORIAL_HOME_STEP_SHOWN(960),
+
+        @UiEvent(doc = "User is shown the overview gesture navigation tutorial step.")
+        LAUNCHER_GESTURE_TUTORIAL_OVERVIEW_STEP_SHOWN(961),
+
+        @UiEvent(doc = "User completed the back gesture navigation tutorial step.")
+        LAUNCHER_GESTURE_TUTORIAL_BACK_STEP_COMPLETED(962),
+
+        @UiEvent(doc = "User completed the home gesture navigation tutorial step.")
+        LAUNCHER_GESTURE_TUTORIAL_HOME_STEP_COMPLETED(963),
+
+        @UiEvent(doc = "User completed the overview gesture navigation tutorial step.")
+        LAUNCHER_GESTURE_TUTORIAL_OVERVIEW_STEP_COMPLETED(964),
+
+        @UiEvent(doc = "User skips the gesture navigation tutorial.")
+        LAUNCHER_GESTURE_TUTORIAL_SKIPPED(965),
+
         @UiEvent(doc = "User scrolled on one of the all apps surfaces such as A-Z list, search "
                 + "result page etc.")
         LAUNCHER_ALLAPPS_SCROLLED(985);
diff --git a/src/com/android/launcher3/model/DeviceGridState.java b/src/com/android/launcher3/model/DeviceGridState.java
index 3e49d79..35fcb78 100644
--- a/src/com/android/launcher3/model/DeviceGridState.java
+++ b/src/com/android/launcher3/model/DeviceGridState.java
@@ -43,15 +43,18 @@
     public static final String KEY_WORKSPACE_SIZE = "migration_src_workspace_size";
     public static final String KEY_HOTSEAT_COUNT = "migration_src_hotseat_count";
     public static final String KEY_DEVICE_TYPE = "migration_src_device_type";
+    public static final String KEY_DB_FILE = "migration_src_db_file";
 
     private final String mGridSizeString;
     private final int mNumHotseat;
     private final @DeviceType int mDeviceType;
+    private final String mDbFile;
 
     public DeviceGridState(InvariantDeviceProfile idp) {
         mGridSizeString = String.format(Locale.ENGLISH, "%d,%d", idp.numColumns, idp.numRows);
         mNumHotseat = idp.numDatabaseHotseatIcons;
         mDeviceType = idp.deviceType;
+        mDbFile = idp.dbFile;
     }
 
     public DeviceGridState(Context context) {
@@ -59,6 +62,7 @@
         mGridSizeString = prefs.getString(KEY_WORKSPACE_SIZE, "");
         mNumHotseat = prefs.getInt(KEY_HOTSEAT_COUNT, -1);
         mDeviceType = prefs.getInt(KEY_DEVICE_TYPE, TYPE_PHONE);
+        mDbFile = prefs.getString(KEY_DB_FILE, "");
     }
 
     /**
@@ -69,6 +73,20 @@
     }
 
     /**
+     * Returns the databaseFile for the grid.
+     */
+    public String getDbFile() {
+        return mDbFile;
+    }
+
+    /**
+     * Returns the number of hotseat icons.
+     */
+    public int getNumHotseat() {
+        return mNumHotseat;
+    }
+
+    /**
      * Stores the device state to shared preferences
      */
     public void writeToPrefs(Context context) {
@@ -76,6 +94,7 @@
                 .putString(KEY_WORKSPACE_SIZE, mGridSizeString)
                 .putInt(KEY_HOTSEAT_COUNT, mNumHotseat)
                 .putInt(KEY_DEVICE_TYPE, mDeviceType)
+                .putString(KEY_DB_FILE, mDbFile)
                 .apply();
     }
 
@@ -106,6 +125,7 @@
                 + "mGridSizeString='" + mGridSizeString + '\''
                 + ", mNumHotseat=" + mNumHotseat
                 + ", mDeviceType=" + mDeviceType
+                + ", mDbFile=" + mDbFile
                 + '}';
     }
 
diff --git a/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java b/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java
index 74b0a6f..0369b21 100644
--- a/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java
+++ b/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java
@@ -22,7 +22,6 @@
 import android.content.ContentValues;
 import android.content.Context;
 import android.content.Intent;
-import android.content.SharedPreferences;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.database.Cursor;
@@ -104,13 +103,16 @@
      * Check given a new IDP, if migration is necessary.
      */
     public static boolean needsToMigrate(Context context, InvariantDeviceProfile idp) {
-        DeviceGridState idpGridState = new DeviceGridState(idp);
-        DeviceGridState contextGridState = new DeviceGridState(context);
-        boolean needsToMigrate = !idpGridState.isCompatible(contextGridState);
+        return needsToMigrate(new DeviceGridState(context), new DeviceGridState(idp));
+    }
+
+    private static boolean needsToMigrate(
+            DeviceGridState srcDeviceState, DeviceGridState destDeviceState) {
+        boolean needsToMigrate = !destDeviceState.isCompatible(srcDeviceState);
         // TODO(b/198965093): Revert this change after bug is fixed
         if (needsToMigrate) {
-            Log.d("b/198965093", "Migration is needed. idpGridState: " + idpGridState
-                    + ", contextGridState: " + contextGridState);
+            Log.d("b/198965093", "Migration is needed. destDeviceState: " + destDeviceState
+                    + ", srcDeviceState: " + srcDeviceState);
         }
         return needsToMigrate;
     }
@@ -143,23 +145,26 @@
             idp = LauncherAppState.getIDP(context);
         }
 
-        if (!needsToMigrate(context, idp)) {
+        DeviceGridState srcDeviceState = new DeviceGridState(context);
+        DeviceGridState destDeviceState = new DeviceGridState(idp);
+        if (!needsToMigrate(srcDeviceState, destDeviceState)) {
             return true;
         }
 
-        SharedPreferences prefs = Utilities.getPrefs(context);
         HashSet<String> validPackages = getValidPackages(context);
 
         if (migrateForPreview) {
             if (!LauncherSettings.Settings.call(
                     context.getContentResolver(),
-                    LauncherSettings.Settings.METHOD_PREP_FOR_PREVIEW, idp.dbFile).getBoolean(
+                    LauncherSettings.Settings.METHOD_PREP_FOR_PREVIEW,
+                    destDeviceState.getDbFile()).getBoolean(
                     LauncherSettings.Settings.EXTRA_VALUE)) {
                 return false;
             }
         } else if (!LauncherSettings.Settings.call(
                 context.getContentResolver(),
-                LauncherSettings.Settings.METHOD_UPDATE_CURRENT_OPEN_HELPER).getBoolean(
+                LauncherSettings.Settings.METHOD_UPDATE_CURRENT_OPEN_HELPER,
+                destDeviceState.getDbFile()).getBoolean(
                 LauncherSettings.Settings.EXTRA_VALUE)) {
             return false;
         }
@@ -179,10 +184,10 @@
                             : LauncherSettings.Favorites.TABLE_NAME,
                     context, validPackages);
 
-            Point targetSize = new Point(idp.numColumns, idp.numRows);
+            Point targetSize = new Point(destDeviceState.getColumns(), destDeviceState.getRows());
             GridSizeMigrationTaskV2 task = new GridSizeMigrationTaskV2(context, t.getDb(),
-                    srcReader, destReader, idp.numDatabaseHotseatIcons, targetSize);
-            task.migrate(idp);
+                    srcReader, destReader, destDeviceState.getNumHotseat(), targetSize);
+            task.migrate(srcDeviceState, destDeviceState);
 
             if (!migrateForPreview) {
                 dropTable(t.getDb(), LauncherSettings.Favorites.TMP_TABLE);
@@ -200,13 +205,13 @@
 
             if (!migrateForPreview) {
                 // Save current configuration, so that the migration does not run again.
-                new DeviceGridState(idp).writeToPrefs(context);
+                destDeviceState.writeToPrefs(context);
             }
         }
     }
 
     @VisibleForTesting
-    protected boolean migrate(InvariantDeviceProfile idp) {
+    protected boolean migrate(DeviceGridState srcDeviceState, DeviceGridState destDeviceState) {
         if (mHotseatDiff.isEmpty() && mWorkspaceDiff.isEmpty()) {
             return false;
         }
@@ -228,8 +233,6 @@
 
         boolean preservePages = false;
         if (screens.isEmpty() && FeatureFlags.ENABLE_NEW_MIGRATION_LOGIC.get()) {
-            DeviceGridState srcDeviceState = new DeviceGridState(mContext);
-            DeviceGridState destDeviceState = new DeviceGridState(idp);
             preservePages = destDeviceState.compareTo(srcDeviceState) >= 0
                     && destDeviceState.getColumns() - srcDeviceState.getColumns() <= 2;
         }
diff --git a/src/com/android/launcher3/notification/NotificationInfo.java b/src/com/android/launcher3/notification/NotificationInfo.java
index ebe45a5..bb2c37f 100644
--- a/src/com/android/launcher3/notification/NotificationInfo.java
+++ b/src/com/android/launcher3/notification/NotificationInfo.java
@@ -16,6 +16,8 @@
 
 package com.android.launcher3.notification;
 
+import static com.android.launcher3.AbstractFloatingView.TYPE_ACTION_POPUP;
+import static com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_ALL_APPS;
 import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_NOTIFICATION_LAUNCH_TAP;
 
 import android.app.ActivityOptions;
@@ -116,7 +118,8 @@
                 popupDataProvider.cancelNotification(notificationKey);
             }
         }
-        AbstractFloatingView.closeOpenContainer(context, AbstractFloatingView.TYPE_ACTION_POPUP);
+        AbstractFloatingView.closeOpenViews(
+                context, true, TYPE_ACTION_POPUP | TYPE_TASKBAR_ALL_APPS);
     }
 
     public Drawable getIconForBackground(Context context, int background) {
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index 00a0050..b12574f 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -163,9 +163,8 @@
             widthUsed = Math.max(widthUsed, minUsedWidth);
         }
 
-        int heightUsed = mInsets.top + deviceProfile.edgeMarginPx;
         measureChildWithMargins(mContent, widthMeasureSpec,
-                widthUsed, heightMeasureSpec, heightUsed);
+                widthUsed, heightMeasureSpec, deviceProfile.bottomSheetTopPadding);
         setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),
                 MeasureSpec.getSize(heightMeasureSpec));
     }
diff --git a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
index 6e97774..341cb5c 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsFullSheet.java
@@ -96,8 +96,6 @@
     private static final String KEY_WIDGETS_EDUCATION_DIALOG_SEEN =
             "launcher.widgets_education_dialog_seen";
 
-    private final Rect mInsets = new Rect();
-
     private final UserManagerState mUserManagerState = new UserManagerState();
 
     private final boolean mHasWorkProfile;
diff --git a/tests/src/com/android/launcher3/model/GridSizeMigrationTaskV2Test.kt b/tests/src/com/android/launcher3/model/GridSizeMigrationTaskV2Test.kt
index 239e092..345016b 100644
--- a/tests/src/com/android/launcher3/model/GridSizeMigrationTaskV2Test.kt
+++ b/tests/src/com/android/launcher3/model/GridSizeMigrationTaskV2Test.kt
@@ -125,7 +125,7 @@
             idp.numDatabaseHotseatIcons,
             Point(idp.numColumns, idp.numRows)
         )
-        task.migrate(idp)
+        task.migrate(DeviceGridState(context), DeviceGridState(idp))
 
         // Check hotseat items
         var c = context.contentResolver.query(
@@ -205,7 +205,7 @@
             idp.numDatabaseHotseatIcons,
             Point(idp.numColumns, idp.numRows)
         )
-        task.migrate(idp)
+        task.migrate(DeviceGridState(context), DeviceGridState(idp))
 
         // Check hotseat items
         val c = context.contentResolver.query(
@@ -260,7 +260,7 @@
             idp.numDatabaseHotseatIcons,
             Point(idp.numColumns, idp.numRows)
         )
-        task.migrate(idp)
+        task.migrate(DeviceGridState(context), DeviceGridState(idp))
 
         // Check hotseat items
         val c = context.contentResolver.query(
@@ -325,7 +325,7 @@
             idp.numDatabaseHotseatIcons,
             Point(idp.numColumns, idp.numRows)
         )
-        task.migrate(idp)
+        task.migrate(DeviceGridState(context), DeviceGridState(idp))
 
         // Get workspace items
         val c = context.contentResolver.query(
@@ -385,7 +385,7 @@
             idp.numDatabaseHotseatIcons,
             Point(idp.numColumns, idp.numRows)
         )
-        task.migrate(idp)
+        task.migrate(DeviceGridState(context), DeviceGridState(idp))
 
         // Get workspace items
         val c = context.contentResolver.query(
@@ -446,7 +446,7 @@
             idp.numDatabaseHotseatIcons,
             Point(idp.numColumns, idp.numRows)
         )
-        task.migrate(idp)
+        task.migrate(DeviceGridState(context), DeviceGridState(idp))
 
         // Get workspace items
         val c = context.contentResolver.query(
diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
index 61ec8bd..73e9823 100644
--- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
+++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java
@@ -109,7 +109,7 @@
                 launcher -> assertNotNull("Launcher internal state didn't switch to Showing Menu",
                         launcher.getOptionsPopup()));
         // Check that pressHome works when the menu is shown.
-        mLauncher.pressHome();
+        mLauncher.goHome();
     }
 
     @Test
@@ -121,7 +121,7 @@
         } finally {
             allApps.unfreeze();
         }
-        mLauncher.pressHome();
+        mLauncher.goHome();
     }
 
     public static void runAllAppsTest(AbstractLauncherUiTest test, AllApps allApps) {
@@ -273,7 +273,7 @@
         executeOnLauncher(launcher -> assertTrue("Flinging backward didn't scroll widgets",
                 getWidgetsScroll(launcher) < flingForwardY));
 
-        mLauncher.pressHome();
+        mLauncher.goHome();
         waitForLauncherCondition("Widgets were not closed",
                 launcher -> getWidgetsView(launcher) == null);
     }
diff --git a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java b/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
index 0c1f0cd..9fb52fc 100644
--- a/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/RequestPinItemTest.java
@@ -169,7 +169,7 @@
         }
 
         // Go back to home
-        mLauncher.pressHome();
+        mLauncher.goHome();
         Wait.atMost("", new ItemSearchCondition(itemMatcher), DEFAULT_ACTIVITY_TIMEOUT,
                 mLauncher);
     }
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 1e3b078..8e0eb7b 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -877,11 +877,22 @@
     }
 
     /**
+     * @deprecated use goHome().
      * Presses nav bar home button.
      *
      * @return the Workspace object.
      */
+    @Deprecated
     public Workspace pressHome() {
+        return goHome();
+    }
+
+    /**
+     * Presses nav bar home button.
+     *
+     * @return the Workspace object.
+     */
+    public Workspace goHome() {
         try (LauncherInstrumentation.Closable e = eventsCheck();
              LauncherInstrumentation.Closable c = addContextLayer("want to switch to home")) {
             waitForLauncherInitialized();