summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-07-09 23:24:06 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-07-09 23:24:06 -0700
commit34b32f417964496d14d043368eac521159247ea7 (patch)
treebee879fcff24d7023bf9721918af4c829066d468 /core/java
parent33c5bc476e4a3d612d09efc5d3f8643c042dadb4 (diff)
parent17006897b1aad1632c735505d9432e682fcef98b (diff)
downloadframeworks_base-34b32f417964496d14d043368eac521159247ea7.zip
frameworks_base-34b32f417964496d14d043368eac521159247ea7.tar.gz
frameworks_base-34b32f417964496d14d043368eac521159247ea7.tar.bz2
Merge "Fix requery behaviour of MemoryCursor." into cm-10.1
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/database/MemoryCursor.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/core/java/android/database/MemoryCursor.java b/core/java/android/database/MemoryCursor.java
index 7eb71db..e222819 100644
--- a/core/java/android/database/MemoryCursor.java
+++ b/core/java/android/database/MemoryCursor.java
@@ -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) {
@@ -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;
+ }
+ }
}