Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11ac41d9 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Don't show NLSes with excessively long component names

Test: install test app with long CN
Test: ServiceListingTest
Bug: 260570119
Change-Id: I3ffd02f6cf6bf282e7fc264fd070ed3add4d8571
Merged-In: I3ffd02f6cf6bf282e7fc264fd070ed3add4d8571
parent c7e8052b
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -57,6 +57,9 @@ import java.util.List;
@SearchIndexable
@SearchIndexable
public class NotificationAccessSettings extends EmptyTextSettings {
public class NotificationAccessSettings extends EmptyTextSettings {
    private static final String TAG = "NotifAccessSettings";
    private static final String TAG = "NotifAccessSettings";

    private static final int MAX_CN_LENGTH = 500;

    private static final ManagedServiceSettings.Config CONFIG =
    private static final ManagedServiceSettings.Config CONFIG =
            new ManagedServiceSettings.Config.Builder()
            new ManagedServiceSettings.Config.Builder()
                    .setTag(TAG)
                    .setTag(TAG)
@@ -91,6 +94,12 @@ public class NotificationAccessSettings extends EmptyTextSettings {
                .setNoun(CONFIG.noun)
                .setNoun(CONFIG.noun)
                .setSetting(CONFIG.setting)
                .setSetting(CONFIG.setting)
                .setTag(CONFIG.tag)
                .setTag(CONFIG.tag)
                .setValidator(info -> {
                    if (info.getComponentName().flattenToString().length() > MAX_CN_LENGTH) {
                        return false;
                    }
                    return true;
                })
                .build();
                .build();
        mServiceListing.addCallback(this::updateList);
        mServiceListing.addCallback(this::updateList);
        setPreferenceScreen(getPreferenceManager().createPreferenceScreen(mContext));
        setPreferenceScreen(getPreferenceManager().createPreferenceScreen(mContext));