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