IContentProvider.java revision 9066cfe9886ac131c34d59ed0e2d287b0e3c0087
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;
31
32/**
33 * The ipc interface to talk to a content provider.
34 * @hide
35 */
36public interface IContentProvider extends IInterface {
37    /**
38     * @hide - hide this because return type IBulkCursor and parameter
39     * IContentObserver are system private classes.
40     */
41    public IBulkCursor bulkQuery(Uri url, String[] projection,
42            String selection, String[] selectionArgs, String sortOrder, IContentObserver observer,
43            CursorWindow window) throws RemoteException;
44    public Cursor query(Uri url, String[] projection, String selection,
45            String[] selectionArgs, String sortOrder) throws RemoteException;
46    public String getType(Uri url) throws RemoteException;
47    public Uri insert(Uri url, ContentValues initialValues)
48            throws RemoteException;
49    public int bulkInsert(Uri url, ContentValues[] initialValues) throws RemoteException;
50    public int delete(Uri url, String selection, String[] selectionArgs)
51            throws RemoteException;
52    public int update(Uri url, ContentValues values, String selection,
53            String[] selectionArgs) throws RemoteException;
54    public ParcelFileDescriptor openFile(Uri url, String mode)
55            throws RemoteException, FileNotFoundException;
56    public AssetFileDescriptor openAssetFile(Uri url, String mode)
57            throws RemoteException, FileNotFoundException;
58    public ISyncAdapter getSyncAdapter() throws RemoteException;
59
60    /* IPC constants */
61    static final String descriptor = "android.content.IContentProvider";
62
63    static final int QUERY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION;
64    static final int GET_TYPE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 1;
65    static final int INSERT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 2;
66    static final int DELETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 3;
67    static final int UPDATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 9;
68    static final int GET_SYNC_ADAPTER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 10;
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}
73