Methods Summary |
---|
public void | binderDied()
synchronized (mLock) {
disposeLocked();
}
|
public void | close()
synchronized (mLock) {
disposeLocked();
}
|
private void | closeFilledWindowLocked()
if (mFilledWindow != null) {
mFilledWindow.close();
mFilledWindow = null;
}
|
private void | createAndRegisterObserverProxyLocked(IContentObserver observer)Create a ContentObserver from the observer and register it as an observer on the
underlying cursor.
if (mObserver != null) {
throw new IllegalStateException("an observer is already registered");
}
mObserver = new ContentObserverProxy(observer, this);
mCursor.registerContentObserver(mObserver);
|
public void | deactivate()
synchronized (mLock) {
if (mCursor != null) {
unregisterObserverProxyLocked();
mCursor.deactivate();
}
closeFilledWindowLocked();
}
|
private void | disposeLocked()
if (mCursor != null) {
unregisterObserverProxyLocked();
mCursor.close();
mCursor = null;
}
closeFilledWindowLocked();
|
public BulkCursorDescriptor | getBulkCursorDescriptor()Returns an object that contains sufficient metadata to reconstruct
the cursor remotely. May throw if an error occurs when executing the query
and obtaining the row count.
synchronized (mLock) {
throwIfCursorIsClosed();
BulkCursorDescriptor d = new BulkCursorDescriptor();
d.cursor = this;
d.columnNames = mCursor.getColumnNames();
d.wantsAllOnMoveCalls = mCursor.getWantsAllOnMoveCalls();
d.count = mCursor.getCount();
d.window = mCursor.getWindow();
if (d.window != null) {
// Acquire a reference to the window because its reference count will be
// decremented when it is returned as part of the binder call reply parcel.
d.window.acquireReference();
}
return d;
}
|
public Bundle | getExtras()
synchronized (mLock) {
throwIfCursorIsClosed();
return mCursor.getExtras();
}
|
public CursorWindow | getWindow(int position)
synchronized (mLock) {
throwIfCursorIsClosed();
if (!mCursor.moveToPosition(position)) {
closeFilledWindowLocked();
return null;
}
CursorWindow window = mCursor.getWindow();
if (window != null) {
closeFilledWindowLocked();
} else {
window = mFilledWindow;
if (window == null) {
mFilledWindow = new CursorWindow(mProviderName);
window = mFilledWindow;
} else if (position < window.getStartPosition()
|| position >= window.getStartPosition() + window.getNumRows()) {
window.clear();
}
mCursor.fillWindow(position, window);
}
if (window != null) {
// Acquire a reference to the window because its reference count will be
// decremented when it is returned as part of the binder call reply parcel.
window.acquireReference();
}
return window;
}
|
public void | onMove(int position)
synchronized (mLock) {
throwIfCursorIsClosed();
mCursor.onMove(mCursor.getPosition(), position);
}
|
public int | requery(IContentObserver observer)
synchronized (mLock) {
throwIfCursorIsClosed();
closeFilledWindowLocked();
try {
if (!mCursor.requery()) {
return -1;
}
} catch (IllegalStateException e) {
IllegalStateException leakProgram = new IllegalStateException(
mProviderName + " Requery misuse db, mCursor isClosed:" +
mCursor.isClosed(), e);
throw leakProgram;
}
unregisterObserverProxyLocked();
createAndRegisterObserverProxyLocked(observer);
return mCursor.getCount();
}
|
public Bundle | respond(Bundle extras)
synchronized (mLock) {
throwIfCursorIsClosed();
return mCursor.respond(extras);
}
|
private void | throwIfCursorIsClosed()
if (mCursor == null) {
throw new StaleDataException("Attempted to access a cursor after it has been closed.");
}
|
private void | unregisterObserverProxyLocked()Unregister the observer if it is already registered.
if (mObserver != null) {
mCursor.unregisterContentObserver(mObserver);
mObserver.unlinkToDeath(this);
mObserver = null;
}
|