1/* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License 15 */ 16 17package com.android.providers.contacts; 18 19import android.content.ContentValues; 20import android.database.Cursor; 21import android.net.Uri; 22import android.os.ParcelFileDescriptor; 23 24import com.android.providers.contacts.VoicemailContentProvider.UriData; 25 26import java.io.FileNotFoundException; 27 28/** 29 * Defines interfaces for communication between voicemail content provider and voicemail table 30 * implementations. 31 */ 32public interface VoicemailTable { 33 /** 34 * Interface that the voicemail content provider uses to delegate database level operations 35 * to the appropriate voicemail table implementation. 36 */ 37 public interface Delegate { 38 public Uri insert(UriData uriData, ContentValues values); 39 public int delete(UriData uriData, String selection, String[] selectionArgs); 40 public Cursor query(UriData uriData, String[] projection, String selection, 41 String[] selectionArgs, String sortOrder); 42 public int update(UriData uriData, ContentValues values, String selection, 43 String[] selectionArgs); 44 public String getType(UriData uriData); 45 public ParcelFileDescriptor openFile(UriData uriData, String mode) 46 throws FileNotFoundException; 47 } 48 49 /** 50 * A helper interface that an implementation of {@link Delegate} uses to access common 51 * functionality across different voicemail tables. 52 */ 53 public interface DelegateHelper { 54 /** 55 * Inserts source_package field into ContentValues. Used in insert operations. 56 */ 57 public void checkAndAddSourcePackageIntoValues(UriData uriData, ContentValues values); 58 59 /** 60 * Opens the file pointed to by the column "_data". 61 * @throws FileNotFoundException 62 */ 63 public ParcelFileDescriptor openDataFile(UriData uriData, String mode) 64 throws FileNotFoundException; 65 } 66} 67