Loading core/java/android/database/MemoryCursor.java +25 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ import android.database.DatabaseUtils; * @hide */ public class MemoryCursor extends AbstractWindowedCursor { private CursorWindow mDeactivatedWindow; private final String[] mColumnNames; public MemoryCursor(String name, String[] columnNames) { Loading @@ -47,4 +47,28 @@ public class MemoryCursor extends AbstractWindowedCursor { public String[] getColumnNames() { return mColumnNames; } @Override public boolean requery() { if (mDeactivatedWindow != null) { setWindow(mDeactivatedWindow); mDeactivatedWindow = null; } return super.requery(); } @Override protected void onDeactivateOrClose() { // when deactivating the cursor, we need to keep our in-memory cursor // window as we have no chance of requerying it later on if (!isClosed() && getWindow() != null) { mDeactivatedWindow = getWindow(); mWindow = null; } super.onDeactivateOrClose(); if (isClosed() && mDeactivatedWindow != null) { mDeactivatedWindow.close(); mDeactivatedWindow = null; } } } Loading
core/java/android/database/MemoryCursor.java +25 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ import android.database.DatabaseUtils; * @hide */ public class MemoryCursor extends AbstractWindowedCursor { private CursorWindow mDeactivatedWindow; private final String[] mColumnNames; public MemoryCursor(String name, String[] columnNames) { Loading @@ -47,4 +47,28 @@ public class MemoryCursor extends AbstractWindowedCursor { public String[] getColumnNames() { return mColumnNames; } @Override public boolean requery() { if (mDeactivatedWindow != null) { setWindow(mDeactivatedWindow); mDeactivatedWindow = null; } return super.requery(); } @Override protected void onDeactivateOrClose() { // when deactivating the cursor, we need to keep our in-memory cursor // window as we have no chance of requerying it later on if (!isClosed() && getWindow() != null) { mDeactivatedWindow = getWindow(); mWindow = null; } super.onDeactivateOrClose(); if (isClosed() && mDeactivatedWindow != null) { mDeactivatedWindow.close(); mDeactivatedWindow = null; } } }