diff --git a/app/src/main/java/com/android/calendar/event/EditEventFragment.java b/app/src/main/java/com/android/calendar/event/EditEventFragment.java index 302a81716..a24563d27 100644 --- a/app/src/main/java/com/android/calendar/event/EditEventFragment.java +++ b/app/src/main/java/com/android/calendar/event/EditEventFragment.java @@ -764,8 +764,8 @@ protected void onQueryComplete(int token, Object cookie, Cursor cursor) { // recurring event AND api level >= 30. enable changing calendars to synced // calendars only, as we currently don't allow recurrence exceptions in local calendars // and would lose them when moving the recurrence between calendars - selection = EditEventHelper.CALENDARS_WHERE_SYNCED_WRITEABLE_VISIBLE; - selectionArgs = null; + selection = EditEventHelper.CALENDARS_SELECTION_FOR_MOVING_RECURRENCE; + selectionArgs = new String[] { Long.toString(mModel.mCalendarId) }; } else { // non recurring event. enable changing calendars to all calendars. selection = EditEventHelper.CALENDARS_WHERE_WRITEABLE_VISIBLE; diff --git a/app/src/main/java/com/android/calendar/event/EditEventHelper.java b/app/src/main/java/com/android/calendar/event/EditEventHelper.java index 760720394..c3644f879 100644 --- a/app/src/main/java/com/android/calendar/event/EditEventHelper.java +++ b/app/src/main/java/com/android/calendar/event/EditEventHelper.java @@ -220,10 +220,22 @@ public class EditEventHelper { static final String CALENDARS_WHERE_WRITEABLE_VISIBLE = Calendars.CALENDAR_ACCESS_LEVEL + ">=" + Calendars.CAL_ACCESS_CONTRIBUTOR + " AND " + Calendars.VISIBLE + "=1"; - static final String CALENDARS_WHERE_SYNCED_WRITEABLE_VISIBLE = - Calendars.CALENDAR_ACCESS_LEVEL + ">=" + Calendars.CAL_ACCESS_CONTRIBUTOR - + " AND " + Calendars.VISIBLE + "=1" - + " AND " + Calendars.ACCOUNT_TYPE + "!='" + CalendarContract.ACCOUNT_TYPE_LOCAL + "'"; + /** + * Query to find all calendars to which a recurrence can be moved to. + *

+ * This always includes the current calendar of the recurrence, as the current calendar must be + * displayed as a possible selection (for not moving the recurrence at all). + *

+ * Argument placeholders: + *

+ */ + static final String CALENDARS_SELECTION_FOR_MOVING_RECURRENCE = + "(" + Calendars._ID + "=?) OR (" + + Calendars.CALENDAR_ACCESS_LEVEL + ">=" + Calendars.CAL_ACCESS_CONTRIBUTOR + + " AND " + Calendars.VISIBLE + "=1" + + " AND " + Calendars.ACCOUNT_TYPE + "!='" + CalendarContract.ACCOUNT_TYPE_LOCAL + "')"; static final String CALENDARS_WHERE = Calendars._ID + "=?";