summaryrefslogtreecommitdiffstats
path: root/core/java/android/database/ContentObservable.java
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-01-23 17:36:06 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-01-23 17:36:06 -0800
commitd4e34d61d01222ff90684b9a1dc4f9c8be560e7c (patch)
tree4812d10e24bcaaf6e67933ea831554e29861da2f /core/java/android/database/ContentObservable.java
parentb934a82139d555c40638226852390d53bb611cd7 (diff)
parent655e66bceba7595a2b80e7a328433e6ed5dc28a9 (diff)
downloadframeworks_base-d4e34d61d01222ff90684b9a1dc4f9c8be560e7c.zip
frameworks_base-d4e34d61d01222ff90684b9a1dc4f9c8be560e7c.tar.gz
frameworks_base-d4e34d61d01222ff90684b9a1dc4f9c8be560e7c.tar.bz2
Merge "Inform ContentObservers about the changed content Uri."
Diffstat (limited to 'core/java/android/database/ContentObservable.java')
-rw-r--r--core/java/android/database/ContentObservable.java31
1 files changed, 27 insertions, 4 deletions
diff --git a/core/java/android/database/ContentObservable.java b/core/java/android/database/ContentObservable.java
index aece904..7692bb3 100644
--- a/core/java/android/database/ContentObservable.java
+++ b/core/java/android/database/ContentObservable.java
@@ -16,6 +16,8 @@
package android.database;
+import android.net.Uri;
+
/**
* A specialization of {@link Observable} for {@link ContentObserver}
* that provides methods for sending notifications to a list of
@@ -31,20 +33,41 @@ public class ContentObservable extends Observable<ContentObserver> {
}
/**
- * Invokes {@link ContentObserver#dispatchChange} on each observer.
- *
+ * Invokes {@link ContentObserver#dispatchChange(boolean)} on each observer.
+ * <p>
* If <code>selfChange</code> is true, only delivers the notification
* to the observer if it has indicated that it wants to receive self-change
* notifications by implementing {@link ContentObserver#deliverSelfNotifications}
* to return true.
+ * </p>
*
* @param selfChange True if this is a self-change notification.
+ *
+ * @deprecated Use {@link #dispatchChange(boolean, Uri)} instead.
*/
+ @Deprecated
public void dispatchChange(boolean selfChange) {
+ dispatchChange(selfChange, null);
+ }
+
+ /**
+ * Invokes {@link ContentObserver#dispatchChange(boolean, Uri)} on each observer.
+ * Includes the changed content Uri when available.
+ * <p>
+ * If <code>selfChange</code> is true, only delivers the notification
+ * to the observer if it has indicated that it wants to receive self-change
+ * notifications by implementing {@link ContentObserver#deliverSelfNotifications}
+ * to return true.
+ * </p>
+ *
+ * @param selfChange True if this is a self-change notification.
+ * @param uri The Uri of the changed content, or null if unknown.
+ */
+ public void dispatchChange(boolean selfChange, Uri uri) {
synchronized(mObservers) {
for (ContentObserver observer : mObservers) {
if (!selfChange || observer.deliverSelfNotifications()) {
- observer.dispatchChange(selfChange);
+ observer.dispatchChange(selfChange, uri);
}
}
}
@@ -61,7 +84,7 @@ public class ContentObservable extends Observable<ContentObserver> {
public void notifyChange(boolean selfChange) {
synchronized(mObservers) {
for (ContentObserver observer : mObservers) {
- observer.onChange(selfChange);
+ observer.onChange(selfChange, null);
}
}
}