summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRhed Jao <rhedjao@google.com>2021-08-11 05:19:39 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-08-11 05:19:39 +0000
commit1c93d67774c3bb669512e8f1d5abe0ad814650fd (patch)
treedf6f857e3b0b881288762b0f59040f669c8112db
parent4fc54276f88cce877bccc38810934bb70a721666 (diff)
parent3c26a24644feaf2860892809929dec816f354bae (diff)
downloadbase-1c93d67774c3bb669512e8f1d5abe0ad814650fd.tar.gz
Merge "DO NOT MERGE Apply a maximum char count to the load label api" into rvc-dev
-rw-r--r--core/java/android/content/pm/PackageItemInfo.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/java/android/content/pm/PackageItemInfo.java b/core/java/android/content/pm/PackageItemInfo.java
index 65ce1e7ef079..9cd568fe2aaf 100644
--- a/core/java/android/content/pm/PackageItemInfo.java
+++ b/core/java/android/content/pm/PackageItemInfo.java
@@ -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);
}
}