From d3d88afee78473034e0f23b21743e67c260a6983 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Tue, 22 Sep 2020 15:09:56 -0700 Subject: [PATCH] Fix issue where "learn more" link on 5G NR settings doesn't work. Issue is due to the fact the footer text is a spannable string which although different from the original text loaded when the preference was constructed, is the same in terms of object equality. Clearing the preference title before assigning the footer text fixes this. Fixes: 162011372 Test: Manual test; open settings and verify link is clickable now. Merged-In: I5d22c665b0d6fb842bc54dc55a2eb3045e0092a2 Change-Id: I5d22c665b0d6fb842bc54dc55a2eb3045e0092a2 (cherry picked from commit 97d8711d847109722a2c1b26b81d3f61b15210ac) Exempt-From-Owner-Approval: Straight cherry-pick. --- .../NrDisabledInDsdsFooterPreferenceController.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java b/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java index 3911fb8038e..78dfe51f007 100644 --- a/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java +++ b/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java @@ -55,6 +55,13 @@ public class NrDisabledInDsdsFooterPreferenceController extends BasePreferenceCo super.updateState(preference); if (preference != null) { + // This is necessary to ensure that setting the title to the spannable string returned + // by getFooterText will be accepted. Internally, setTitle does an equality check on + // the spannable string being set to the text already set on the preference. That + // equality check apparently only takes into account the raw text and not and spannables + // that are part of the text. So we clear the title before applying the spannable + // footer to ensure it is accepted. + preference.setTitle(""); preference.setTitle(getFooterText()); } }