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