Merge "Move SharedPreferences code to its own class." into tm-qpr-dev
diff --git a/lint-baseline-launcher3.xml b/lint-baseline-launcher3.xml
index 107a346..a9dc0c6 100644
--- a/lint-baseline-launcher3.xml
+++ b/lint-baseline-launcher3.xml
@@ -606,4 +606,20 @@
             column="61"/>
     </issue>
 
+    <issue
+        id="NewApi"
+        message="Call requires API level 33 (current min is 26): `android.app.Activity#getOnBackInvokedDispatcher`">
+        <location
+            file="packages/apps/Launcher3/src/com/android/launcher3/BaseActivity.java"
+            line="182"/>
+    </issue>
+
+    <issue
+        id="NewApi"
+        message="Call requires API level 33 (current min is 26): `android.window.OnBackInvokedDispatcher#registerOnBackInvokedCallback`">
+        <location
+            file="packages/apps/Launcher3/src/com/android/launcher3/BaseActivity.java"
+            line="182"/>
+    </issue>
+
 </issues>
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index 1a801b5..45b8e3f 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -189,10 +189,10 @@
     <string name="allset_hint">Swipe up to go Home</string>
     <!-- Hint string at the bottom of "All Set" page for button navigation [CHAR LIMIT=NONE] -->
     <string name="allset_button_hint">Tap the home button to go to your home screen</string>
-    <!-- Description of "All Set" page on phones [CHAR LIMIT=NONE] -->
-    <string name="allset_description">You\u2019re ready to start using your phone</string>
-    <!-- Description of "All Set" page on tablets [CHAR LIMIT=NONE] -->
-    <string name="allset_description_tablet">You\u2019re ready to start using your tablet</string>
+    <!-- Description of "All Set" page on the user's device [CHAR LIMIT=NONE] -->
+    <string name="allset_description_generic">You\u2019re ready to start using your <xliff:g id="device" example="Pixel 6">%1$s</xliff:g></string>
+    <!-- A default device name to use in the description of the "All Set" page [CHAR LIMIT=NONE] -->
+    <string name="default_device_name">device</string>
     <!-- String linking to navigation settings on "All Set" page [CHAR LIMIT=NONE] -->
     <string name="allset_navigation_settings"><annotation id="link">System navigation settings</annotation></string>
 
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index 27159d3..bc6dd9a 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -958,12 +958,13 @@
         }
         mControllers.taskbarStashController.addUnstashToHotseatAnimation(fullAnimation, duration);
 
-        if (!FeatureFlags.ENABLE_ALL_APPS_BUTTON_IN_HOTSEAT.get()) {
+        View allAppsButton = mControllers.taskbarViewController.getAllAppsButtonView();
+        if (allAppsButton != null && !FeatureFlags.ENABLE_ALL_APPS_BUTTON_IN_HOTSEAT.get()) {
             ValueAnimator alphaOverride = ValueAnimator.ofFloat(0, 1);
             alphaOverride.setDuration(duration);
             alphaOverride.addUpdateListener(a -> {
                 // Override the alpha updates in the icon alignment animation.
-                mControllers.taskbarViewController.getAllAppsButtonView().setAlpha(0);
+                allAppsButton.setAlpha(0);
             });
             fullAnimation.play(alphaOverride);
         }
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index fe38bb1..c4eeca7 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -422,6 +422,7 @@
     /**
      * Returns the all apps button in the taskbar.
      */
+    @Nullable
     public View getAllAppsButtonView() {
         return mAllAppsButton;
     }
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
index 80a31b4..9936d27 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java
@@ -240,6 +240,7 @@
         return mTaskbarView.getIconViews();
     }
 
+    @Nullable
     public View getAllAppsButtonView() {
         return mTaskbarView.getAllAppsButtonView();
     }
diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
index 65614ba..713b016 100644
--- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
+++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -179,9 +179,15 @@
 
     private void enableBlockingTimeout(
             TouchInteractionService.TISBinder tisBinder, boolean enable) {
-        // Allow null-pointer to catch illegal states.
-        tisBinder.getTaskbarManager().getCurrentActivityContext().enableBlockingTimeoutDuringTests(
-                enable);
+        TaskbarActivityContext context = tisBinder.getTaskbarManager().getCurrentActivityContext();
+        if (context == null) {
+            if (TestProtocol.sDebugTracing) {
+                Log.d(NPE_TRANSIENT_TASKBAR, "enableBlockingTimeout: enable=" + enable,
+                        new Exception());
+            }
+        } else {
+            context.enableBlockingTimeoutDuringTests(enable);
+        }
     }
 
     private void enableTransientTaskbar(
diff --git a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java
index 897b559..52f1867 100644
--- a/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java
+++ b/quickstep/src/com/android/quickstep/interaction/AllSetActivity.java
@@ -42,6 +42,7 @@
 import android.os.Bundle;
 import android.os.VibrationEffect;
 import android.os.Vibrator;
+import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
 import android.view.View.AccessibilityDelegate;
@@ -79,6 +80,7 @@
             "#Intent;action=com.android.settings.SEARCH_RESULT_TRAMPOLINE;S.:settings:fragment_args_key=gesture_system_navigation_input_summary;S.:settings:show_fragment=com.android.settings.gestures.SystemNavigationGestureSettings;end";
     private static final String EXTRA_ACCENT_COLOR_DARK_MODE = "suwColorAccentDark";
     private static final String EXTRA_ACCENT_COLOR_LIGHT_MODE = "suwColorAccentLight";
+    private static final String EXTRA_DEVICE_NAME = "suwDeviceName";
 
     private static final float HINT_BOTTOM_FACTOR = 1 - .94f;
 
@@ -110,7 +112,8 @@
 
         int mode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
         boolean isDarkTheme = mode == Configuration.UI_MODE_NIGHT_YES;
-        int accentColor = getIntent().getIntExtra(
+        Intent intent = getIntent();
+        int accentColor = intent.getIntExtra(
                 isDarkTheme ? EXTRA_ACCENT_COLOR_DARK_MODE : EXTRA_ACCENT_COLOR_LIGHT_MODE,
                 isDarkTheme ? Color.WHITE : Color.BLACK);
 
@@ -121,10 +124,12 @@
         mContentView = findViewById(R.id.content_view);
         mSwipeUpShift = getResources().getDimension(R.dimen.allset_swipe_up_shift);
 
-        DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(this).getDeviceProfile(this);
         TextView subtitle = findViewById(R.id.subtitle);
-        subtitle.setText(dp.isTablet
-                ? R.string.allset_description_tablet : R.string.allset_description);
+        String suwDeviceName = intent.getStringExtra(EXTRA_DEVICE_NAME);
+        subtitle.setText(getString(
+                R.string.allset_description_generic,
+                !TextUtils.isEmpty(suwDeviceName)
+                        ? suwDeviceName : getString(R.string.default_device_name)));
 
         TextView tv = findViewById(R.id.navigation_settings);
         tv.setTextColor(accentColor);
@@ -138,6 +143,7 @@
         });
 
         TextView hintTextView = findViewById(R.id.hint);
+        DeviceProfile dp = InvariantDeviceProfile.INSTANCE.get(this).getDeviceProfile(this);
         if (!dp.isGestureMode) {
             hintTextView.setText(R.string.allset_button_hint);
         }