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