/** * Insert a new child of kind {@link DataKind} into the given * {@link RawContactDelta}, marked with the given {@link EditType}. */ public static ValuesDelta insertChild(RawContactDelta state, DataKind kind, EditType type) { // Bail early if invalid kind if (kind == null) return null; final ContentValues after = new ContentValues(); // Our parent CONTACT_ID is provided later after.put(Data.MIMETYPE, kind.mimeType); // Fill-in with any requested default values if (kind.defaultValues != null) { after.putAll(kind.defaultValues); } if (kind.typeColumn != null && type != null) { // Set type, if provided after.put(kind.typeColumn, type.rawValue); } final ValuesDelta child = ValuesDelta.fromAfter(after); state.addEntry(child); return child; }
newState.addEntry(ValuesDelta.fromAfter(values)); } else {
/** @hide Public only for testing. */ public static void migrateGenericWithoutTypeColumn( RawContactDelta oldState, RawContactDelta newState, DataKind newDataKind) { final ArrayList<ValuesDelta> mimeEntries = ensureEntryMaxSize(newState, newDataKind, oldState.getMimeEntries(newDataKind.mimeType)); if (mimeEntries == null || mimeEntries.isEmpty()) { return; } for (ValuesDelta entry : mimeEntries) { ContentValues values = entry.getAfter(); if (values != null) { newState.addEntry(ValuesDelta.fromAfter(values)); } } }
ContentValues values = entry.getAfter(); if (values != null) { newState.addEntry(ValuesDelta.fromAfter(values));
newState.addEntry(ValuesDelta.fromAfter(values)); totalCount++;
newState.addEntry(ValuesDelta.fromAfter(values));
ValuesDelta entry = ValuesDelta.fromAfter(values); if (isEmpty(entry, kind)) { continue;
newState.addEntry(ValuesDelta.fromAfter(values));