Skip to content

Commit 61d1522

Browse files
Julia Reynoldsthestinger
authored andcommitted
Don't show NLSes with excessively long component names
Test: install test app with long CN Test: ServiceListingTest Bug: 260570119 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:793257967f165970f8cb0f4cebddab9dcd5d8353) Merged-In: I3ffd02f6cf6bf282e7fc264fd070ed3add4d8571 Change-Id: I3ffd02f6cf6bf282e7fc264fd070ed3add4d8571
1 parent a299e0e commit 61d1522

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/com/android/settings/notification/NotificationAccessSettings.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public class NotificationAccessSettings extends EmptyTextSettings {
6565
private static final String TAG = "NotifAccessSettings";
6666
private static final String ALLOWED_KEY = "allowed";
6767
private static final String NOT_ALLOWED_KEY = "not_allowed";
68+
private static final int MAX_CN_LENGTH = 500;
6869

6970
private static final ManagedServiceSettings.Config CONFIG =
7071
new ManagedServiceSettings.Config.Builder()
@@ -101,6 +102,12 @@ public void onCreate(Bundle icicle) {
101102
.setNoun(CONFIG.noun)
102103
.setSetting(CONFIG.setting)
103104
.setTag(CONFIG.tag)
105+
.setValidator(info -> {
106+
if (info.getComponentName().flattenToString().length() > MAX_CN_LENGTH) {
107+
return false;
108+
}
109+
return true;
110+
})
104111
.build();
105112
mServiceListing.addCallback(this::updateList);
106113

0 commit comments

Comments
 (0)