summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/ContentProvider.java
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@android.com>2010-03-04 17:48:13 -0800
committerBrad Fitzpatrick <bradfitz@android.com>2010-03-05 12:08:39 -0800
commit1877d0158b529663b8315482e7346a7bcaa96166 (patch)
tree5194b59937b70c2f48366f27a4458d4043957d16 /core/java/android/content/ContentProvider.java
parentcd47f11dfad012be1b176ea06904a00da157ed7b (diff)
downloadframeworks_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/ContentProvider.java')
-rw-r--r--core/java/android/content/ContentProvider.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index 91b1c4e..5fb2aae 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -29,6 +29,7 @@ import android.database.IContentObserver;
import android.database.SQLException;
import android.net.Uri;
import android.os.Binder;
+import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.os.Process;
@@ -217,6 +218,13 @@ public abstract class ContentProvider implements ComponentCallbacks {
return ContentProvider.this.openAssetFile(uri, mode);
}
+ /**
+ * @hide
+ */
+ public Bundle call(String method, String request, Bundle args) {
+ return ContentProvider.this.call(method, request, args);
+ }
+
private void enforceReadPermission(Uri uri) {
final int uid = Binder.getCallingUid();
if (uid == mMyUid) {
@@ -748,4 +756,18 @@ public abstract class ContentProvider implements ComponentCallbacks {
}
return results;
}
-} \ No newline at end of file
+
+ /**
+ * @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) {
+ return null;
+ }
+}