blob: 4afe38b62851018b015c738aa9cd43ccf0ee4e30 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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
Scott Kennedy9f78f652015-03-01 15:29:25 -080019import android.annotation.Nullable;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.res.AssetFileDescriptor;
21import android.database.Cursor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.net.Uri;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080023import android.os.Bundle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.os.IBinder;
Jeff Browna7771df2012-05-07 20:06:46 -070025import android.os.ICancellationSignal;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.os.IInterface;
27import android.os.ParcelFileDescriptor;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080028import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029
30import java.io.FileNotFoundException;
Fred Quintana03d94902009-05-22 14:23:31 -070031import java.util.ArrayList;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032
33/**
34 * The ipc interface to talk to a content provider.
35 * @hide
36 */
37public interface IContentProvider extends IInterface {
Dianne Hackborn35654b62013-01-14 17:38:02 -080038 public Cursor query(String callingPkg, Uri url, String[] projection, String selection,
Jeff Brown4c1241d2012-02-02 17:05:00 -080039 String[] selectionArgs, String sortOrder, ICancellationSignal cancellationSignal)
Jeff Brown75ea64f2012-01-25 19:37:13 -080040 throws RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041 public String getType(Uri url) throws RemoteException;
Dianne Hackborn35654b62013-01-14 17:38:02 -080042 public Uri insert(String callingPkg, Uri url, ContentValues initialValues)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043 throws RemoteException;
Dianne Hackborn35654b62013-01-14 17:38:02 -080044 public int bulkInsert(String callingPkg, Uri url, ContentValues[] initialValues)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045 throws RemoteException;
Dianne Hackborn35654b62013-01-14 17:38:02 -080046 public int delete(String callingPkg, Uri url, String selection, String[] selectionArgs)
47 throws RemoteException;
48 public int update(String callingPkg, Uri url, ContentValues values, String selection,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049 String[] selectionArgs) throws RemoteException;
Jeff Sharkeybd3b9022013-08-20 15:20:04 -070050 public ParcelFileDescriptor openFile(
Dianne Hackbornff170242014-11-19 10:59:01 -080051 String callingPkg, Uri url, String mode, ICancellationSignal signal,
52 IBinder callerToken)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053 throws RemoteException, FileNotFoundException;
Jeff Sharkeybd3b9022013-08-20 15:20:04 -070054 public AssetFileDescriptor openAssetFile(
55 String callingPkg, Uri url, String mode, ICancellationSignal signal)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 throws RemoteException, FileNotFoundException;
Dianne Hackborn35654b62013-01-14 17:38:02 -080057 public ContentProviderResult[] applyBatch(String callingPkg,
58 ArrayList<ContentProviderOperation> operations)
59 throws RemoteException, OperationApplicationException;
Scott Kennedy9f78f652015-03-01 15:29:25 -080060 public Bundle call(
61 String callingPkg, String method, @Nullable String arg, @Nullable Bundle extras)
Dianne Hackborn35654b62013-01-14 17:38:02 -080062 throws RemoteException;
Jeff Brown4c1241d2012-02-02 17:05:00 -080063 public ICancellationSignal createCancellationSignal() throws RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080064
Dianne Hackborn38ed2a42013-09-06 16:17:22 -070065 public Uri canonicalize(String callingPkg, Uri uri) throws RemoteException;
66 public Uri uncanonicalize(String callingPkg, Uri uri) throws RemoteException;
67
Dianne Hackborn23fdaf62010-08-06 12:16:55 -070068 // Data interchange.
69 public String[] getStreamTypes(Uri url, String mimeTypeFilter) throws RemoteException;
Dianne Hackborn35654b62013-01-14 17:38:02 -080070 public AssetFileDescriptor openTypedAssetFile(String callingPkg, Uri url, String mimeType,
Jeff Sharkeybd3b9022013-08-20 15:20:04 -070071 Bundle opts, ICancellationSignal signal) throws RemoteException, FileNotFoundException;
Dianne Hackborn23fdaf62010-08-06 12:16:55 -070072
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 /* IPC constants */
74 static final String descriptor = "android.content.IContentProvider";
75
76 static final int QUERY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION;
77 static final int GET_TYPE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 1;
78 static final int INSERT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 2;
79 static final int DELETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 3;
80 static final int UPDATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 9;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081 static final int BULK_INSERT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 12;
82 static final int OPEN_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 13;
83 static final int OPEN_ASSET_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 14;
Fred Quintana89437372009-05-15 15:10:40 -070084 static final int APPLY_BATCH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 19;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080085 static final int CALL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 20;
Dianne Hackborn23fdaf62010-08-06 12:16:55 -070086 static final int GET_STREAM_TYPES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 21;
87 static final int OPEN_TYPED_ASSET_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 22;
Jeff Brown75ea64f2012-01-25 19:37:13 -080088 static final int CREATE_CANCELATION_SIGNAL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 23;
Dianne Hackborn38ed2a42013-09-06 16:17:22 -070089 static final int CANONICALIZE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 24;
90 static final int UNCANONICALIZE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 25;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091}