| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.content; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.annotation.Nullable; |
| 21 |
import android.compat.annotation.UnsupportedAppUsage; |
| 22 |
import android.content.res.AssetFileDescriptor; |
| 23 |
import android.database.Cursor; |
| 24 |
import android.net.Uri; |
| 25 |
import android.os.Binder; |
| 26 |
import android.os.Build; |
| 27 |
import android.os.Bundle; |
| 28 |
import android.os.IBinder; |
| 29 |
import android.os.ICancellationSignal; |
| 30 |
import android.os.IInterface; |
| 31 |
import android.os.ParcelFileDescriptor; |
| 32 |
import android.os.RemoteCallback; |
| 33 |
import android.os.RemoteException; |
| 34 |
|
| 35 |
import java.io.FileNotFoundException; |
| 36 |
import java.util.ArrayList; |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
public interface IContentProvider extends IInterface { |
| 43 |
Cursor query(@NonNull AttributionSource attributionSource, Uri url, |
| 44 |
@Nullable String[] projection, |
| 45 |
@Nullable Bundle queryArgs, @Nullable ICancellationSignal cancellationSignal) |
| 46 |
throws RemoteException; |
| 47 |
String getType(Uri url) throws RemoteException; |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
void getTypeAsync(Uri uri, RemoteCallback callback) throws RemoteException; |
| 55 |
|
| 56 |
@Deprecated |
| 57 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link " |
| 58 |
+ "ContentProviderClient#insert(android.net.Uri, android.content.ContentValues)} " |
| 59 |
+ "instead") |
| 60 |
default Uri insert(String callingPkg, Uri url, ContentValues initialValues) |
| 61 |
throws RemoteException { |
| 62 |
return insert(new AttributionSource(Binder.getCallingUid(), callingPkg, null), |
| 63 |
url, initialValues, null); |
| 64 |
} |
| 65 |
Uri insert(@NonNull AttributionSource attributionSource, Uri url, |
| 66 |
ContentValues initialValues, Bundle extras) throws RemoteException; |
| 67 |
@Deprecated |
| 68 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link " |
| 69 |
+ "ContentProviderClient#bulkInsert(android.net.Uri, android.content.ContentValues[])" |
| 70 |
+ "} instead") |
| 71 |
default int bulkInsert(String callingPkg, Uri url, ContentValues[] initialValues) |
| 72 |
throws RemoteException { |
| 73 |
return bulkInsert(new AttributionSource(Binder.getCallingUid(), callingPkg, null), |
| 74 |
url, initialValues); |
| 75 |
} |
| 76 |
int bulkInsert(@NonNull AttributionSource attributionSource, Uri url, |
| 77 |
ContentValues[] initialValues) throws RemoteException; |
| 78 |
@Deprecated |
| 79 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link " |
| 80 |
+ "ContentProviderClient#delete(android.net.Uri, java.lang.String, java.lang" |
| 81 |
+ ".String[])} instead") |
| 82 |
default int delete(String callingPkg, Uri url, String selection, String[] selectionArgs) |
| 83 |
throws RemoteException { |
| 84 |
return delete(new AttributionSource(Binder.getCallingUid(), callingPkg, null), |
| 85 |
url, ContentResolver.createSqlQueryBundle(selection, selectionArgs)); |
| 86 |
} |
| 87 |
int delete(@NonNull AttributionSource attributionSource, Uri url, Bundle extras) |
| 88 |
throws RemoteException; |
| 89 |
@Deprecated |
| 90 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link " |
| 91 |
+ "ContentProviderClient#update(android.net.Uri, android.content.ContentValues, java" |
| 92 |
+ ".lang.String, java.lang.String[])} instead") |
| 93 |
default int update(String callingPkg, Uri url, ContentValues values, String selection, |
| 94 |
String[] selectionArgs) throws RemoteException { |
| 95 |
return update(new AttributionSource(Binder.getCallingUid(), callingPkg, null), |
| 96 |
url, values, ContentResolver.createSqlQueryBundle(selection, selectionArgs)); |
| 97 |
} |
| 98 |
int update(@NonNull AttributionSource attributionSource, Uri url, ContentValues values, |
| 99 |
Bundle extras) throws RemoteException; |
| 100 |
|
| 101 |
ParcelFileDescriptor openFile(@NonNull AttributionSource attributionSource, |
| 102 |
Uri url, String mode, ICancellationSignal signal) |
| 103 |
throws RemoteException, FileNotFoundException; |
| 104 |
|
| 105 |
AssetFileDescriptor openAssetFile(@NonNull AttributionSource attributionSource, |
| 106 |
Uri url, String mode, ICancellationSignal signal) |
| 107 |
throws RemoteException, FileNotFoundException; |
| 108 |
|
| 109 |
ContentProviderResult[] applyBatch(@NonNull AttributionSource attributionSource, |
| 110 |
String authority, ArrayList<ContentProviderOperation> operations) |
| 111 |
throws RemoteException, OperationApplicationException; |
| 112 |
|
| 113 |
@Deprecated |
| 114 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link " |
| 115 |
+ "ContentProviderClient#call(java.lang.String, java.lang.String, android.os.Bundle)} " |
| 116 |
+ "instead") |
| 117 |
public default Bundle call(String callingPkg, String method, |
| 118 |
@Nullable String arg, @Nullable Bundle extras) throws RemoteException { |
| 119 |
return call(new AttributionSource(Binder.getCallingUid(), callingPkg, null), |
| 120 |
"unknown", method, arg, extras); |
| 121 |
} |
| 122 |
|
| 123 |
Bundle call(@NonNull AttributionSource attributionSource, String authority, |
| 124 |
String method, @Nullable String arg, @Nullable Bundle extras) throws RemoteException; |
| 125 |
|
| 126 |
int checkUriPermission(@NonNull AttributionSource attributionSource, Uri uri, |
| 127 |
int uid, int modeFlags) throws RemoteException; |
| 128 |
|
| 129 |
ICancellationSignal createCancellationSignal() throws RemoteException; |
| 130 |
|
| 131 |
Uri canonicalize(@NonNull AttributionSource attributionSource, Uri uri) |
| 132 |
throws RemoteException; |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
void canonicalizeAsync(@NonNull AttributionSource attributionSource, Uri uri, |
| 140 |
RemoteCallback callback) throws RemoteException; |
| 141 |
|
| 142 |
Uri uncanonicalize(@NonNull AttributionSource attributionSource, Uri uri) |
| 143 |
throws RemoteException; |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
void uncanonicalizeAsync(@NonNull AttributionSource attributionSource, Uri uri, |
| 151 |
RemoteCallback callback) throws RemoteException; |
| 152 |
|
| 153 |
public boolean refresh(@NonNull AttributionSource attributionSource, Uri url, |
| 154 |
@Nullable Bundle extras, ICancellationSignal cancellationSignal) throws RemoteException; |
| 155 |
|
| 156 |
|
| 157 |
public String[] getStreamTypes(Uri url, String mimeTypeFilter) throws RemoteException; |
| 158 |
|
| 159 |
public AssetFileDescriptor openTypedAssetFile(@NonNull AttributionSource attributionSource, |
| 160 |
Uri url, String mimeType, Bundle opts, ICancellationSignal signal) |
| 161 |
throws RemoteException, FileNotFoundException; |
| 162 |
|
| 163 |
|
| 164 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) |
| 165 |
static final String descriptor = "android.content.IContentProvider"; |
| 166 |
|
| 167 |
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) |
| 168 |
static final int QUERY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION; |
| 169 |
static final int GET_TYPE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 1; |
| 170 |
static final int INSERT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 2; |
| 171 |
static final int DELETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 3; |
| 172 |
static final int UPDATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 9; |
| 173 |
static final int BULK_INSERT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 12; |
| 174 |
static final int OPEN_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 13; |
| 175 |
static final int OPEN_ASSET_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 14; |
| 176 |
static final int APPLY_BATCH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 19; |
| 177 |
static final int CALL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 20; |
| 178 |
static final int GET_STREAM_TYPES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 21; |
| 179 |
static final int OPEN_TYPED_ASSET_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 22; |
| 180 |
static final int CREATE_CANCELATION_SIGNAL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 23; |
| 181 |
static final int CANONICALIZE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 24; |
| 182 |
static final int UNCANONICALIZE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 25; |
| 183 |
static final int REFRESH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 26; |
| 184 |
static final int CHECK_URI_PERMISSION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 27; |
| 185 |
int GET_TYPE_ASYNC_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 28; |
| 186 |
int CANONICALIZE_ASYNC_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 29; |
| 187 |
int UNCANONICALIZE_ASYNC_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 30; |
| 188 |
} |