IContentProvider.java revision 03d9490758c9318cee6d14d3cc5007556dce92d0
1/* 2 * Copyright (C) 2006 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 android.content; 18 19import android.content.res.AssetFileDescriptor; 20import android.database.Cursor; 21import android.database.CursorWindow; 22import android.database.IBulkCursor; 23import android.database.IContentObserver; 24import android.net.Uri; 25import android.os.RemoteException; 26import android.os.IBinder; 27import android.os.IInterface; 28import android.os.ParcelFileDescriptor; 29 30import java.io.FileNotFoundException; 31import java.util.ArrayList; 32 33/** 34 * The ipc interface to talk to a content provider. 35 * @hide 36 */ 37public interface IContentProvider extends IInterface { 38 /** 39 * @hide - hide this because return type IBulkCursor and parameter 40 * IContentObserver are system private classes. 41 */ 42 public IBulkCursor bulkQuery(Uri url, String[] projection, 43 String selection, String[] selectionArgs, String sortOrder, IContentObserver observer, 44 CursorWindow window) throws RemoteException; 45 public Cursor query(Uri url, String[] projection, String selection, 46 String[] selectionArgs, String sortOrder) throws RemoteException; 47 public EntityIterator queryEntities(Uri url, String selection, 48 String[] selectionArgs, String sortOrder) 49 throws RemoteException; 50 public String getType(Uri url) throws RemoteException; 51 public Uri insert(Uri url, ContentValues initialValues) 52 throws RemoteException; 53 public int bulkInsert(Uri url, ContentValues[] initialValues) throws RemoteException; 54 public Uri insertEntity(Uri uri, Entity entities) throws RemoteException; 55 public int delete(Uri url, String selection, String[] selectionArgs) 56 throws RemoteException; 57 public int update(Uri url, ContentValues values, String selection, 58 String[] selectionArgs) throws RemoteException; 59 public int updateEntity(Uri uri, Entity entity) throws RemoteException; 60 public ParcelFileDescriptor openFile(Uri url, String mode) 61 throws RemoteException, FileNotFoundException; 62 public AssetFileDescriptor openAssetFile(Uri url, String mode) 63 throws RemoteException, FileNotFoundException; 64 public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) 65 throws RemoteException, OperationApplicationException; 66 67 /* IPC constants */ 68 static final String descriptor = "android.content.IContentProvider"; 69 70 static final int QUERY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION; 71 static final int GET_TYPE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 1; 72 static final int INSERT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 2; 73 static final int DELETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 3; 74 static final int UPDATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 9; 75 static final int BULK_INSERT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 12; 76 static final int OPEN_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 13; 77 static final int OPEN_ASSET_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 14; 78 static final int INSERT_ENTITIES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 16; 79 static final int UPDATE_ENTITIES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 17; 80 static final int QUERY_ENTITIES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 18; 81 static final int APPLY_BATCH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 19; 82} 83