From 983b9a96b7232313ae48cb77d2cf507bf4d5a350 Mon Sep 17 00:00:00 2001 From: Lionel Mamane Date: Fri, 6 Oct 2023 10:42:35 +0200 Subject: [PATCH] gh#1463 don't pass recycle to functions that can thrash it when subsequent uses _do_ depend on (part of) the value thereof. --- .../com/android/calendar/widget/CalendarAppWidgetModel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/android/calendar/widget/CalendarAppWidgetModel.java b/app/src/main/java/com/android/calendar/widget/CalendarAppWidgetModel.java index a8b720720..d454d6ba3 100644 --- a/app/src/main/java/com/android/calendar/widget/CalendarAppWidgetModel.java +++ b/app/src/main/java/com/android/calendar/widget/CalendarAppWidgetModel.java @@ -60,13 +60,11 @@ public CalendarAppWidgetModel(Context context, String timeZone) { } public void buildFromCursor(Cursor cursor, String timeZone) { - final Time recycle = new Time(timeZone); final ArrayList> mBuckets = new ArrayList>(CalendarAppWidgetService.MAX_DAYS); for (int i = 0; i < CalendarAppWidgetService.MAX_DAYS; i++) { mBuckets.add(new LinkedList()); } - recycle.set(System.currentTimeMillis()); mShowTZ = !TextUtils.equals(timeZone, Utils.getCurrentTimezone()); if (mShowTZ) { mHomeTZName = TimeZone.getTimeZone(timeZone).getDisplayName(false, TimeZone.SHORT); @@ -93,6 +91,7 @@ public void buildFromCursor(Cursor cursor, String timeZone) { // Adjust all-day times into local timezone if (allDay) { + final Time recycle = new Time(); start = Utils.convertAlldayUtcToLocal(recycle, start, tz); end = Utils.convertAlldayUtcToLocal(recycle, end, tz); } @@ -131,6 +130,7 @@ public void buildFromCursor(Cursor cursor, String timeZone) { if (!bucket.isEmpty()) { // We don't show day header in today if (day != mTodayJulianDay) { + final Time recycle = new Time(timeZone); final DayInfo dayInfo = populateDayInfo(day, recycle); // Add the day header final int dayIndex = mDayInfos.size();