Fix NPE on modes page when schedule has no days

Fixes: 387088843
Test: atest ZenModeTriggerUpdatePreferenceControllerTest
Flag: EXEMPT trivial bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5098df9b6c2a7caff5dde39911c70e35f2aacbe7)
Merged-In: I3b845784f5923521d7f3f6cae9d6d27a21f55361
Change-Id: I3b845784f5923521d7f3f6cae9d6d27a21f55361
This commit is contained in:
Matías Hernández
2025-01-08 19:11:59 +01:00
committed by Android Build Coastguard Worker
parent 954635a223
commit f496cf6fb9
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);