summaryrefslogtreecommitdiffstats
path: root/test-runner
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 /test-runner
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 'test-runner')
-rw-r--r--test-runner/src/android/test/mock/MockContentProvider.java18
-rw-r--r--test-runner/src/android/test/mock/MockIContentProvider.java8
2 files changed, 25 insertions, 1 deletions
diff --git a/test-runner/src/android/test/mock/MockContentProvider.java b/test-runner/src/android/test/mock/MockContentProvider.java
index 4078622..3fd71c8 100644
--- a/test-runner/src/android/test/mock/MockContentProvider.java
+++ b/test-runner/src/android/test/mock/MockContentProvider.java
@@ -32,6 +32,7 @@ import android.database.CursorWindow;
import android.database.IBulkCursor;
import android.database.IContentObserver;
import android.net.Uri;
+import android.os.Bundle;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -113,6 +114,15 @@ public class MockContentProvider extends ContentProvider {
return MockContentProvider.this.update(url, values, selection, selectionArgs);
}
+ /**
+ * @hide
+ */
+ @SuppressWarnings("unused")
+ public Bundle call(String method, String request, Bundle args)
+ throws RemoteException {
+ return MockContentProvider.this.call(method, request, args);
+ }
+
public IBinder asBinder() {
throw new UnsupportedOperationException();
}
@@ -205,6 +215,14 @@ public class MockContentProvider extends ContentProvider {
}
/**
+ * @hide
+ */
+ @Override
+ public Bundle call(String method, String request, Bundle args) {
+ throw new UnsupportedOperationException("unimplemented mock method call");
+ }
+
+ /**
* Returns IContentProvider which calls back same methods in this class.
* By overriding this class, we avoid the mechanism hidden behind ContentProvider
* (IPC, etc.)
diff --git a/test-runner/src/android/test/mock/MockIContentProvider.java b/test-runner/src/android/test/mock/MockIContentProvider.java
index 7c0a1e2..0be5bea 100644
--- a/test-runner/src/android/test/mock/MockIContentProvider.java
+++ b/test-runner/src/android/test/mock/MockIContentProvider.java
@@ -27,6 +27,7 @@ import android.database.CursorWindow;
import android.database.IBulkCursor;
import android.database.IContentObserver;
import android.net.Uri;
+import android.os.Bundle;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -38,7 +39,7 @@ import java.util.ArrayList;
* {@link java.lang.UnsupportedOperationException}. Tests can extend this class to
* implement behavior needed for tests.
*
- * @hide - @hide because this exposes bulkQuery(), which must also be hidden.
+ * @hide - @hide because this exposes bulkQuery() and call(), which must also be hidden.
*/
public class MockIContentProvider implements IContentProvider {
public int bulkInsert(Uri url, ContentValues[] initialValues) {
@@ -93,6 +94,11 @@ public class MockIContentProvider implements IContentProvider {
throw new UnsupportedOperationException("unimplemented mock method");
}
+ public Bundle call(String method, String request, Bundle args)
+ throws RemoteException {
+ throw new UnsupportedOperationException("unimplemented mock method");
+ }
+
public IBinder asBinder() {
throw new UnsupportedOperationException("unimplemented mock method");
}