Snap for 10276566 from e5613ea1def77cc81ca10283c3b4a8ee1f334b9f to tm-platform-release

Change-Id: Iaf2543b741cbbedae57fdeee3ad14f161bf0f7d6
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