DO NOT MERGE Apply a maximum char count to the load label api am: baf1f463f0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15706234

Change-Id: If48eb277933a8f50810aaa8bcd06189ec1868f5f
This commit is contained in:
Rhed Jao
2021-09-01 05:33:42 +00:00
committed by Automerger Merge Worker

View File

@@ -207,7 +207,9 @@ public class PackageItemInfo {
return loadSafeLabel(pm, DEFAULT_MAX_LABEL_SIZE_PX, SAFE_STRING_FLAG_TRIM
| SAFE_STRING_FLAG_FIRST_LINE);
} else {
return loadUnsafeLabel(pm);
// Trims the label string to the MAX_SAFE_LABEL_LENGTH. This is to prevent that the
// system is overwhelmed by an enormous string returned by the application.
return TextUtils.trimToSize(loadUnsafeLabel(pm), MAX_SAFE_LABEL_LENGTH);
}
}