Fix crash due to over limited length.

Flag: EXEMPT bug fix
Fix: b/388404115
Test: Manual test
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a66f9dc3629586c3543952566f05f1b720dfa50c)
Merged-In: I5c72c3c9ca9cb2e4058959abc5a0b4fdd60907bf
Change-Id: I5c72c3c9ca9cb2e4058959abc5a0b4fdd60907bf
This commit is contained in:
tom hsu
2025-02-05 23:54:17 -08:00
committed by Tom Hsu
parent 85107f0fb4
commit d9b78ebc97
3 changed files with 10 additions and 8 deletions

View File

@@ -165,9 +165,9 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
}
final CharSequence displayName = SubscriptionUtil.getUniqueSubscriptionDisplayName(
info, getContext());
mNameView.setText(displayName);
if (!TextUtils.isEmpty(displayName)) {
mNameView.setSelection(displayName.length());
mNameView.setSelection(Math.min(displayName.length(),
getResources().getInteger(R.integer.sim_label_max_length)));
}
mColorSpinner = view.findViewById(R.id.color_spinner);
@@ -176,7 +176,7 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
mColorSpinner.setAdapter(adapter);
mColorSpinner.setSelection(getSimColorIndex(info.getIconTint()));
if(Flags.isDualSimOnboardingEnabled()){
if (Flags.isDualSimOnboardingEnabled()) {
return;
}
@@ -293,10 +293,10 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen
}
/*
* Get the color index from previous color that defined in Android OS
* (frameworks/base/core/res/res/values/arrays.xml). If can't find the color, continue to look
* for it in the new color plattee. If not, give it the first index.
*/
* Get the color index from previous color that defined in Android OS
* (frameworks/base/core/res/res/values/arrays.xml). If can't find the color, continue to look
* for it in the new color plattee. If not, give it the first index.
*/
private int getSimColorIndex(int color) {
int index = -1;