Home | History | Annotate | Download | only in core

Lines Matching full:voicemail

17 package com.example.android.voicemail.common.core;
19 import com.example.android.voicemail.common.logging.Logger;
20 import com.example.android.voicemail.common.utils.CloseUtils;
21 import com.example.android.voicemail.common.utils.DbQueryUtils;
44 /** Full projection on the voicemail table, giving us all the columns. */
75 * <code>com.android.providers.voicemail.permission.READ_WRITE_ALL_VOICEMAIL</code> and
76 * <code>com.android.providers.voicemail.permission.READ_WRITE_OWN_VOICEMAIL</code>.
87 * <code>com.android.providers.voicemail.permission.READ_WRITE_OWN_VOICEMAIL</code>.
95 public Uri insert(Voicemail voicemail) {
96 check(!voicemail.hasId(), "Inserted voicemails must not have an id", voicemail);
97 check(voicemail.hasTimestampMillis(), "Inserted voicemails must have a timestamp",
98 voicemail);
99 check(voicemail.hasNumber(), "Inserted voicemails must have a number", voicemail);
100 logger.d(String.format("Inserting new voicemail: %s", voicemail));
101 ContentValues contentValues = getContentValues(voicemail);
102 if (!voicemail.hasRead()) {
110 public int update(Uri uri, Voicemail voicemail) {
111 check(!voicemail.hasUri(), "Can't update the Uri of a voicemail", voicemail);
112 logger.d("Updating voicemail: " + voicemail + " for uri: " + uri);
113 ContentValues values = getContentValues(voicemail);
136 logger.d(String.format("Writing new voicemail content: %s", voicemailUri));
154 throw new IOException("Updating voicemail should have updated 1 row, was: "
160 public Voicemail findVoicemailBySourceData(String sourceData) {
167 logger.w("Expected 1 voicemail matching sourceData " + sourceData + ", got " +
179 public Voicemail findVoicemailByUri(Uri uri) {
184 logger.w("Expected 1 voicemail matching uri " + uri + ", got " + cursor.getCount());
188 Voicemail voicemail = getVoicemailFromCursor(cursor);
190 if (voicemail.getUri().equals(uri)) {
191 return voicemail;
193 logger.w("Queried uri: " + uri + " do not represent a unique voicemail record.");
210 * including a toString() representation of the voicemail
212 private void check(boolean assertion, String message, Voicemail voicemail) {
214 throw new IllegalArgumentException(message + ": " + voicemail);
225 public List<Voicemail> getAllVoicemails() {
230 public List<Voicemail> getAllVoicemails(VoicemailFilter filter,
238 List<Voicemail> results = new ArrayList<Voicemail>(cursor.getCount());
275 VoicemailImpl voicemail = VoicemailImpl
289 return voicemail;
297 * Maps structured {@link Voicemail} to {@link ContentValues} understood by content provider.
299 private ContentValues getContentValues(Voicemail voicemail) {
301 if (voicemail.hasTimestampMillis()) {
302 contentValues.put(Voicemails.DATE, String.valueOf(voicemail.getTimestampMillis()));
304 if (voicemail.hasNumber()) {
305 contentValues.put(Voicemails.NUMBER, voicemail.getNumber());
307 if (voicemail.hasDuration()) {
308 contentValues.put(Voicemails.DURATION, String.valueOf(voicemail.getDuration()));
310 if (voicemail.hasSourcePackage()) {
311 contentValues.put(Voicemails.SOURCE_PACKAGE, voicemail.getSourcePackage());
313 if (voicemail.hasSourceData()) {
314 contentValues.put(Voicemails.SOURCE_DATA, voicemail.getSourceData());
316 if (voicemail.hasRead()) {
317 contentValues.put(Voicemails.IS_READ, voicemail.isRead() ? 1 : 0);