From 1307f428af43c0e40a909da0320ae61ba04d58d5 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Wed, 13 Nov 2019 13:03:10 -0700 Subject: Allow sending of bulk Uri change notifications. MediaProvider makes heavy use of Uri change notifications, which currently need to be delivered one at a time through the Binder interface. To optimize this, allow callers to provide a collection of multiple Uris to notify with a single Binder call. Bug: 134170767 Test: atest cts/tests/tests/content/src/android/content/cts/ContentResolverTest.java Change-Id: Ifef778e88bb772b5580f70929c6f2e9c166d1c0e --- .../src/android/test/mock/MockContentResolver.java | 48 ++++++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) (limited to 'test-mock') diff --git a/test-mock/src/android/test/mock/MockContentResolver.java b/test-mock/src/android/test/mock/MockContentResolver.java index a70152c8b732..8283019a10ec 100644 --- a/test-mock/src/android/test/mock/MockContentResolver.java +++ b/test-mock/src/android/test/mock/MockContentResolver.java @@ -16,6 +16,8 @@ package android.test.mock; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.Context; @@ -130,17 +132,47 @@ public class MockContentResolver extends ContentResolver { } /** - * Overrides {@link android.content.ContentResolver#notifyChange(Uri, ContentObserver, boolean) - * ContentResolver.notifChange(Uri, ContentObserver, boolean)}. All parameters are ignored. - * The method hides providers linked to MockContentResolver from other observers in the system. + * Overrides the behavior from the parent class to completely ignore any + * content notifications sent to this object. This effectively hides clients + * from observers elsewhere in the system. + */ + @Override + public void notifyChange(@NonNull Uri uri, @Nullable ContentObserver observer) { + } + + /** + * Overrides the behavior from the parent class to completely ignore any + * content notifications sent to this object. This effectively hides clients + * from observers elsewhere in the system. * - * @param uri (Ignored) The uri of the content provider. - * @param observer (Ignored) The observer that originated the change. - * @param syncToNetwork (Ignored) If true, attempt to sync the change to the network. + * @deprecated callers should consider migrating to + * {@link #notifyChange(Uri, ContentObserver, int)}, as it + * offers support for many more options than just + * {@link #NOTIFY_SYNC_TO_NETWORK}. */ @Override - public void notifyChange(Uri uri, - ContentObserver observer, + @Deprecated + public void notifyChange(@NonNull Uri uri, @Nullable ContentObserver observer, boolean syncToNetwork) { } + + /** + * Overrides the behavior from the parent class to completely ignore any + * content notifications sent to this object. This effectively hides clients + * from observers elsewhere in the system. + */ + @Override + public void notifyChange(@NonNull Uri uri, @Nullable ContentObserver observer, + @NotifyFlags int flags) { + } + + /** + * Overrides the behavior from the parent class to completely ignore any + * content notifications sent to this object. This effectively hides clients + * from observers elsewhere in the system. + */ + @Override + public void notifyChange(@NonNull Iterable uris, @Nullable ContentObserver observer, + @NotifyFlags int flags) { + } } -- cgit v1.2.3