diff options
author | Brad Fitzpatrick <bradfitz@android.com> | 2010-03-04 17:48:13 -0800 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@android.com> | 2010-03-05 12:08:39 -0800 |
commit | 1877d0158b529663b8315482e7346a7bcaa96166 (patch) | |
tree | 5194b59937b70c2f48366f27a4458d4043957d16 /core/java/android/content/IContentProvider.java | |
parent | cd47f11dfad012be1b176ea06904a00da157ed7b (diff) | |
download | frameworks_base-1877d0158b529663b8315482e7346a7bcaa96166.zip frameworks_base-1877d0158b529663b8315482e7346a7bcaa96166.tar.gz frameworks_base-1877d0158b529663b8315482e7346a7bcaa96166.tar.bz2 |
Add "call" method on ContentProvider.
This permits implementing interfaces which are faster than using
remote Cursors. It then uses it for Settings & SettingProvider, which
together account for ~50% of total ContentProvider event loop stalls
across Froyo dogfooders.
For fetching Settings this looks like it should reduce average
Settings lookup from 10 ms to 0.4 ms on Sholes, once the
SettingsProvider serves most gets from in-memory cache. Currently it
brings the Sholes average down from 10ms to 2.5 ms while still using
SQLite queries on each get.
Diffstat (limited to 'core/java/android/content/IContentProvider.java')
-rw-r--r-- | core/java/android/content/IContentProvider.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/core/java/android/content/IContentProvider.java b/core/java/android/content/IContentProvider.java index 1b0ca58..67e7581 100644 --- a/core/java/android/content/IContentProvider.java +++ b/core/java/android/content/IContentProvider.java @@ -22,10 +22,11 @@ import android.database.CursorWindow; import android.database.IBulkCursor; import android.database.IContentObserver; import android.net.Uri; -import android.os.RemoteException; +import android.os.Bundle; import android.os.IBinder; import android.os.IInterface; import android.os.ParcelFileDescriptor; +import android.os.RemoteException; import java.io.FileNotFoundException; import java.util.ArrayList; @@ -58,6 +59,17 @@ public interface IContentProvider extends IInterface { throws RemoteException, FileNotFoundException; public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) throws RemoteException, OperationApplicationException; + /** + * @hide -- until interface has proven itself + * + * Call an provider-defined method. This can be used to implement + * interfaces that are cheaper than using a Cursor. + * + * @param method Method name to call. Opaque to framework. + * @param request Nullable String argument passed to method. + * @param args Nullable Bundle argument passed to method. + */ + public Bundle call(String method, String request, Bundle args) throws RemoteException; /* IPC constants */ static final String descriptor = "android.content.IContentProvider"; @@ -71,4 +83,5 @@ public interface IContentProvider extends IInterface { static final int OPEN_FILE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 13; 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; } |