Merge Android 13 QPR3

Bug: 275386652
Merged-In: Icad9af57dd72743c81f928baf3f1c50c1020125e
Change-Id: I473d23b3230477e56b4346693a8d2d3fccf9eb3f
diff --git a/main/src/com/google/android/setupdesign/util/DeviceHelper.java b/main/src/com/google/android/setupdesign/util/DeviceHelper.java
index 37c5144..1a7e0bd 100644
--- a/main/src/com/google/android/setupdesign/util/DeviceHelper.java
+++ b/main/src/com/google/android/setupdesign/util/DeviceHelper.java
@@ -53,10 +53,25 @@
    * com.google.android.setupwizard.util.PartnerResource#DEVICE_NAME}) > {@link
    * android.provider.Settings.Global#DEVICE_NAME} > system property ro.product.model)
    */
+  public static CharSequence getDeviceName(@NonNull Context context) {
+    return getDeviceName(context, /* enableCache= */ true);
+  }
+
+  /**
+   * Get the device name text from these resources, if they are unavailable or setupwizard apk is
+   * older which does not contains {@link DeviceHelper#GET_DEVICE_NAME_METHOD} method, return the
+   * device name as default value "device".
+   *
+   * <p>Priority: partner config ({@link
+   * com.google.android.setupwizard.util.PartnerResource#DEVICE_NAME}) > {@link
+   * android.provider.Settings.Global#DEVICE_NAME} > system property ro.product.model)
+   *
+   * @param enableCache Indicates whether the device name is preferentially obtained from the cache.
+   */
   @NonNull
   @SuppressLint("DiscouragedApi")
-  public static CharSequence getDeviceName(@NonNull Context context) {
-    if (deviceName == null || deviceName.isEmpty()) {
+  public static CharSequence getDeviceName(@NonNull Context context, boolean enableCache) {
+    if (deviceName == null || deviceName.isEmpty() || !enableCache) {
       try {
         deviceName =
             context