From 1877d0158b529663b8315482e7346a7bcaa96166 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 4 Mar 2010 17:48:13 -0800 Subject: 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. --- core/java/android/content/IContentProvider.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'core/java/android/content/IContentProvider.java') 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 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; } -- cgit v1.1