Merge "Fix NPE on modes page when schedule has no days" into main

This commit is contained in:
Treehugger Robot
2025-01-08 11:17:09 -08:00
committed by Android (Google) Code Review
2 changed files with 24 additions and 3 deletions

View File

@@ -109,9 +109,11 @@ class ZenModeTriggerUpdatePreferenceController extends AbstractZenModePreference
tryParseScheduleConditionId(mode.getRule().getConditionId());
if (schedule != null) {
preference.setTitle(SystemZenRules.getTimeSummary(mContext, schedule));
preference.setSummary(Utils.createAccessibleSequence(
SystemZenRules.getDaysOfWeekShort(mContext, schedule),
SystemZenRules.getDaysOfWeekFull(mContext, schedule)));
String shortDaysSummary = SystemZenRules.getDaysOfWeekShort(mContext, schedule);
String fullDaysSummary = SystemZenRules.getDaysOfWeekFull(mContext, schedule);
preference.setSummary(shortDaysSummary != null && fullDaysSummary != null
? Utils.createAccessibleSequence(shortDaysSummary, fullDaysSummary)
: shortDaysSummary);
} else {
// Fallback, but shouldn't happen.
Log.wtf(TAG, "SCHEDULE_TIME mode without schedule: " + mode);