Skip to content

Commit

Permalink
protect against convertAlldayUtcToLocal trashing its recycle argument
Browse files Browse the repository at this point in the history
when it looks like the caller does not expect it
  • Loading branch information
Lionel Mamane committed Oct 6, 2023
1 parent 983b9a9 commit 4169e03
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
11 changes: 7 additions & 4 deletions app/src/main/java/com/android/calendar/AllInOneActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1365,10 +1365,13 @@ public void handleEvent(EventInfo event) {
if (event.startTime != null && event.endTime != null) {
// Event is all day , adjust the goto time to local time
if (event.isAllDay()) {
Utils.convertAlldayUtcToLocal(
event.startTime, event.startTime.toMillis(), mTimeZone);
Utils.convertAlldayUtcToLocal(
event.endTime, event.endTime.toMillis(), mTimeZone);
final Time t = new Time();
event.startTime.set(
Utils.convertAlldayUtcToLocal(
t, event.startTime.toMillis(), mTimeZone));
event.endTime.set(
Utils.convertAlldayUtcToLocal(
t, event.endTime.toMillis(), mTimeZone));
}
mController.sendEvent(this, EventType.GO_TO, event.startTime, event.endTime,
event.selectedTime, event.id, ViewType.AGENDA,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,9 @@ public void calculateDays(DayAdapterInfo dayAdapterInfo) {
long instanceId = cursor.getLong(AgendaWindowAdapter.INDEX_INSTANCE_ID);
boolean allDay = cursor.getInt(AgendaWindowAdapter.INDEX_ALL_DAY) != 0;
if (allDay) {
startTime = Utils.convertAlldayUtcToLocal(tempTime, startTime, mTimeZone);
endTime = Utils.convertAlldayUtcToLocal(tempTime, endTime, mTimeZone);
final Time recycle = new Time();
startTime = Utils.convertAlldayUtcToLocal(recycle, startTime, mTimeZone);
endTime = Utils.convertAlldayUtcToLocal(recycle, endTime, mTimeZone);
}
// Skip over the days outside of the adapter's range
startDay = Math.max(startDay, dayAdapterInfo.start);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private static void queryNextReminderAndSchedule(Cursor instancesCursor, Context
long localStartTime;
if (allday) {
// Adjust allday to local time.
localStartTime = Utils.convertAlldayUtcToLocal(timeObj, begin,
localStartTime = Utils.convertAlldayUtcToLocal(null, begin,
Utils.getCurrentTimezone());
} else {
localStartTime = begin;
Expand Down

0 comments on commit 4169e03

Please sign in to comment.