Add API to retrieve cursor notification URI.

Change-Id: I89f6c4d6ee6ef3675eff62ff6bca691b54c69f75
This commit is contained in:
Dianne Hackborn
2013-05-14 13:44:29 -07:00
parent f27796cbbe
commit c87c92e079
5 changed files with 24 additions and 4 deletions

View File

@@ -7634,6 +7634,7 @@ package android.database {
method public abstract float getFloat(int);
method public abstract int getInt(int);
method public abstract long getLong(int);
method public abstract android.net.Uri getNotificationUri();
method public abstract int getPosition();
method public abstract short getShort(int);
method public abstract java.lang.String getString(int);
@@ -7739,6 +7740,7 @@ package android.database {
method public float getFloat(int);
method public int getInt(int);
method public long getLong(int);
method public android.net.Uri getNotificationUri();
method public int getPosition();
method public short getShort(int);
method public java.lang.String getString(int);
@@ -22628,6 +22630,7 @@ package android.test.mock {
method public float getFloat(int);
method public int getInt(int);
method public long getLong(int);
method public android.net.Uri getNotificationUri();
method public int getPosition();
method public short getShort(int);
method public java.lang.String getString(int);

View File

@@ -369,7 +369,9 @@ public abstract class AbstractCursor implements CrossProcessCursor {
}
public Uri getNotificationUri() {
return mNotifyUri;
synchronized (mSelfObserverLock) {
return mNotifyUri;
}
}
public boolean getWantsAllOnMoveCalls() {

View File

@@ -424,6 +424,16 @@ public interface Cursor extends Closeable {
*/
void setNotificationUri(ContentResolver cr, Uri uri);
/**
* Return the URI at which notifications of changes in this Cursor's data
* will be delivered, as previously set by {@link #setNotificationUri}.
* @return Returns a URI that can be used with
* {@link ContentResolver#registerContentObserver(android.net.Uri, boolean, ContentObserver)
* ContentResolver.registerContentObserver} to find out about changes to this Cursor's
* data. May be null if no notification URI has been set.
*/
Uri getNotificationUri();
/**
* onMove() will only be called across processes if this method returns true.
* @return whether all cursor movement should result in a call to onMove().

View File

@@ -194,6 +194,10 @@ public class CursorWrapper implements Cursor {
mCursor.setNotificationUri(cr, uri);
}
public Uri getNotificationUri() {
return mCursor.getNotificationUri();
}
public void unregisterContentObserver(ContentObserver observer) {
mCursor.unregisterContentObserver(observer);
}

View File

@@ -177,17 +177,18 @@ public class MockCursor implements Cursor {
throw new UnsupportedOperationException("unimplemented mock method");
}
@SuppressWarnings("deprecation")
public void setNotificationUri(ContentResolver cr, Uri uri) {
throw new UnsupportedOperationException("unimplemented mock method");
}
@SuppressWarnings("deprecation")
public Uri getNotificationUri() {
throw new UnsupportedOperationException("unimplemented mock method");
}
public void unregisterContentObserver(ContentObserver observer) {
throw new UnsupportedOperationException("unimplemented mock method");
}
@SuppressWarnings("deprecation")
public void unregisterDataSetObserver(DataSetObserver observer) {
throw new UnsupportedOperationException("unimplemented mock method");
}