Settings: Fix FC when learn more textview help intent is NULL

Click the learn more textview in footer preference and trigger its help intent action. FC occurs when its help intent is NULL.

Add NULL check and hide the learn more textview if its help intent is not set.

Buganizer: 216401549

Change-Id: I3bad6814ef399d1ecd3003649edf42102478242b
Merged-In: I4e7a7c926205be1179d55d33ada345024c8a44ab
This commit is contained in:
hoffc
2022-01-26 15:28:54 +08:00
committed by Wesley Wang
parent 49a9361062
commit b4831d9fde

View File

@@ -354,13 +354,16 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
footerString = context.getString(R.string.manager_battery_usage_footer);
}
mFooterPreference.setTitle(footerString);
mFooterPreference.setLearnMoreAction(v ->
startActivityForResult(HelpUtils.getHelpIntent(context,
final Intent helpIntent = HelpUtils.getHelpIntent(context,
context.getString(R.string.help_url_app_usage_settings),
/*backupContext=*/ ""), /*requestCode=*/ 0));
/*backupContext=*/ "");
if (helpIntent != null) {
mFooterPreference.setLearnMoreAction(v ->
startActivityForResult(helpIntent, /*requestCode=*/ 0));
mFooterPreference.setLearnMoreContentDescription(
context.getString(R.string.manager_battery_usage_link_a11y));
}
}
@Override
public int getMetricsCategory() {