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 17 package android.content; 18 19 import android.content.res.AssetFileDescriptor; 20 import android.database.Cursor; 21 import android.net.Uri; 22 import android.os.Bundle; 23 import android.os.IBinder; 24 import android.os.IInterface; 25 import android.os.ParcelFileDescriptor; 26 import android.os.RemoteException; 27 28 import java.io.FileNotFoundException; 29 import java.util.ArrayList; 30 31 /** 32 * The ipc interface to talk to a content provider. 33 * @hide 34 */ 35 public interface IContentProvider extends IInterface { 36 public Cursor query(Uri url, String[] projection, String selection, 37 String[] selectionArgs, String sortOrder) throws RemoteException; 38 public String getType(Uri url) throws RemoteException; 39 public Uri insert(Uri url, ContentValues initialValues) 40 throws RemoteException; 41 public int bulkInsert(Uri url, ContentValues[] initialValues) throws RemoteException; 42 public int delete(Uri url, String selection, String[] selectionArgs) 43 throws RemoteException; 44 public int update(Uri url, ContentValues values, String selection, 45 String[] selectionArgs) throws RemoteException; 46 public ParcelFileDescriptor openFile(Uri url, String mode) 47 throws RemoteException, FileNotFoundException; 48 public AssetFileDescriptor openAssetFile(Uri url, String mode) 49 throws RemoteException, FileNotFoundException; 50 public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) 51 throws RemoteException, OperationApplicationException; 52 public Bundle call(String method, String arg, Bundle extras) throws RemoteException; 53 54 // Data interchange. 55 public String[] getStreamTypes(Uri url, String mimeTypeFilter) throws RemoteException; 56 public AssetFileDescriptor openTypedAssetFile(Uri url, String mimeType, Bundle opts) 57 throws RemoteException, FileNotFoundException; 58 59 /* IPC constants */ 60 static final String descriptor = "android.content.IContentProvider"; 61 62 static final int QUERY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION; 63 static final int GET_TYPE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 1; 64 static final int INSERT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 2; 65 static final int DELETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 3; 66 static final int UPDATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 9; 67 static final int BULK_INSERT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 12; 68 static final int OPEN_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 13; 69 static final int OPEN_ASSET_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 14; 70 static final int APPLY_BATCH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 19; 71 static final int CALL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 20; 72 static final int GET_STREAM_TYPES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 21; 73 static final int OPEN_TYPED_ASSET_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 22; 74 } 75