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