commit | b33789c9cb626a14724c5e60386008e3fc17f10c | [log] [tgz] |
---|---|---|
author | Julia Reynolds <juliacr@google.com> | Tue Mar 07 15:44:29 2023 -0500 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Apr 06 00:36:10 2023 +0000 |
tree | b56d5aefd62a42c63b5347d0fc81ad74fac1a80b | |
parent | 383a0bbe529a9db8d6d9aaea03cc4a8bd10a4766 [diff] |
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:11ac41d9b6eddc4733e782984c312fd482a616f3) Merged-In: I3ffd02f6cf6bf282e7fc264fd070ed3add4d8571 Change-Id: I3ffd02f6cf6bf282e7fc264fd070ed3add4d8571
diff --git a/src/com/android/settings/notification/NotificationAccessSettings.java b/src/com/android/settings/notification/NotificationAccessSettings.java index 9df548c..71e58e4 100644 --- a/src/com/android/settings/notification/NotificationAccessSettings.java +++ b/src/com/android/settings/notification/NotificationAccessSettings.java
@@ -57,6 +57,9 @@ @SearchIndexable public class NotificationAccessSettings extends EmptyTextSettings { private static final String TAG = "NotifAccessSettings"; + + private static final int MAX_CN_LENGTH = 500; + private static final ManagedServiceSettings.Config CONFIG = new ManagedServiceSettings.Config.Builder() .setTag(TAG) @@ -91,6 +94,12 @@ .setNoun(CONFIG.noun) .setSetting(CONFIG.setting) .setTag(CONFIG.tag) + .setValidator(info -> { + if (info.getComponentName().flattenToString().length() > MAX_CN_LENGTH) { + return false; + } + return true; + }) .build(); mServiceListing.addCallback(this::updateList); setPreferenceScreen(getPreferenceManager().createPreferenceScreen(mContext));