diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-08-06 12:16:55 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-08-08 18:49:31 -0700 |
commit | 23fdaf6fb62a9b5154b2508916a21c678462c5d0 (patch) | |
tree | 14b794a1f76f738576bbaa8295141914f5b2b123 /core/java/android/content/IContentProvider.java | |
parent | 163935113919a184122b8b3bd672ef08c8df65dc (diff) | |
download | frameworks_base-23fdaf6fb62a9b5154b2508916a21c678462c5d0.zip frameworks_base-23fdaf6fb62a9b5154b2508916a21c678462c5d0.tar.gz frameworks_base-23fdaf6fb62a9b5154b2508916a21c678462c5d0.tar.bz2 |
Add new ContentProvider for doing conversions to data streams.
This introduces basic infrastructure that should allow content
providers holding complex data to perform on-demand conversion
of their data to streams of various types. It is achieved through
two new content provider APIs, one to interrogate the possible
stream MIME types the provider can return, and the other to
request a stream of data in a particular MIME type.
Because implementations of this will often need to do on-demand
data conversion, there is also a utility intoduced in ContentProvider
for subclasses to easily run a function to write data into a
pipe that is read by the client.
This feature is mostly intended for cut and paste and drag and
drop, as the complex data interchange allowing the source and
destination to negotiate data types and copy (possible large)
data between them. However because it is fundamental facility
of ContentProvider, it can be used in other places, such as for
more advanced GET_CONTENT data exchanges.
An example implementation of this would be in ContactsProvider,
which can now provider a data stream when a client opens certain
pieces of it data, to return data as flat text, a vcard, or other
format.
Change-Id: I58627ea4ed359aa7cf2c66274adb18306c209cb2
Diffstat (limited to 'core/java/android/content/IContentProvider.java')
-rw-r--r-- | core/java/android/content/IContentProvider.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/content/IContentProvider.java b/core/java/android/content/IContentProvider.java index 67e7581..8f122ce 100644 --- a/core/java/android/content/IContentProvider.java +++ b/core/java/android/content/IContentProvider.java @@ -59,6 +59,7 @@ public interface IContentProvider extends IInterface { throws RemoteException, FileNotFoundException; public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) throws RemoteException, OperationApplicationException; + /** * @hide -- until interface has proven itself * @@ -71,6 +72,11 @@ public interface IContentProvider extends IInterface { */ public Bundle call(String method, String request, Bundle args) throws RemoteException; + // Data interchange. + public String[] getStreamTypes(Uri url, String mimeTypeFilter) throws RemoteException; + public AssetFileDescriptor openTypedAssetFile(Uri url, String mimeType, Bundle opts) + throws RemoteException, FileNotFoundException; + /* IPC constants */ static final String descriptor = "android.content.IContentProvider"; @@ -84,4 +90,6 @@ public interface IContentProvider extends IInterface { static final int OPEN_ASSET_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 14; static final int APPLY_BATCH_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 19; static final int CALL_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 20; + static final int GET_STREAM_TYPES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 21; + static final int OPEN_TYPED_ASSET_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 22; } |