Merge "Fix null pointer issue of accesibility learn more button click event" into sc-v2-dev

This commit is contained in:
Menghan Li
2021-09-01 06:19:03 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 8 deletions

View File

@@ -104,11 +104,17 @@ public class AccessibilityFooterPreferenceController extends BasePreferenceContr
sb.append(getIntroductionTitle()).append("\n\n").append(footerPreference.getTitle());
footerPreference.setContentDescription(sb);
final Intent helpIntent;
if (getHelpResource() != 0) {
// Returns may be null if content is wrong or empty.
helpIntent = HelpUtils.getHelpIntent(mContext, mContext.getString(getHelpResource()),
mContext.getClass().getName());
} else {
helpIntent = null;
}
if (helpIntent != null) {
footerPreference.setLearnMoreAction(view -> {
final Intent helpIntent = HelpUtils.getHelpIntent(
mContext, mContext.getString(getHelpResource()),
mContext.getClass().getName());
view.startActivityForResult(helpIntent, 0);
});
footerPreference.setLearnMoreContentDescription(getLearnMoreContentDescription());