diff options
author | pihuei <pihuei@google.com> | 2023-01-16 14:50:04 +0000 |
---|---|---|
committer | Pihuei Wang <pihuei@google.com> | 2023-01-16 14:52:55 +0000 |
commit | aef17b6184392621ffab36bee05cffd453a66939 (patch) | |
tree | 0b175e08a59a1cf86fb0b87b51855b6c55a9b38a | |
parent | ff1efb9d28add86a03718854ee6894b9de269456 (diff) | |
download | setupdesign-android13-qpr3-c-s4-release.tar.gz |
Added a public method to allow reset device name bundleandroid-13.0.0_r82android-13.0.0_r81android-13.0.0_r80android-13.0.0_r74android-13.0.0_r73android-13.0.0_r72android-13.0.0_r66android-13.0.0_r65android-13.0.0_r64android-13.0.0_r60android-13.0.0_r59android-13.0.0_r58android13-qpr3-c-s8-releaseandroid13-qpr3-c-s7-releaseandroid13-qpr3-c-s6-releaseandroid13-qpr3-c-s5-releaseandroid13-qpr3-c-s4-releaseandroid13-qpr3-c-s3-releaseandroid13-qpr3-c-s2-releaseandroid13-qpr3-c-s12-releaseandroid13-qpr3-c-s11-releaseandroid13-qpr3-c-s10-releaseandroid13-qpr3-c-s1-release
copied from cl/501707304
Bug: 264949555
Test: manual test
Change-Id: I32db277bd7b4747a38e2dfa09bf39ccab6500e1e
-rw-r--r-- | main/src/com/google/android/setupdesign/util/DeviceHelper.java | 19 |
1 files changed, 17 insertions, 2 deletions
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 @@ public final class DeviceHelper { * 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 |