summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-05-16 12:24:32 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-05-16 12:24:33 +0000
commit79e0206ef3203a1842949242e58fa8f3c25eb129 (patch)
treef4a426dc045bf4a098246f1bd9cf96c83d63b8cf
parent8a196c0676eebf10b2120f3305c0b9bcb99e97ce (diff)
parent1ec4f360605ff62c618ca63368a278cddd0e8a74 (diff)
downloadbase-79e0206ef3203a1842949242e58fa8f3c25eb129.tar.gz
Merge "Init the static member when first used for CursorWindow."
-rw-r--r--core/java/android/database/CursorWindow.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/core/java/android/database/CursorWindow.java b/core/java/android/database/CursorWindow.java
index 197e3ff3eda7..a75372ff6170 100644
--- a/core/java/android/database/CursorWindow.java
+++ b/core/java/android/database/CursorWindow.java
@@ -42,12 +42,8 @@ import android.util.LongSparseArray;
public class CursorWindow extends SQLiteClosable implements Parcelable {
private static final String STATS_TAG = "CursorWindowStats";
- /** The cursor window size. resource xml file specifies the value in kB.
- * convert it to bytes here by multiplying with 1024.
- */
- private static final int sCursorWindowSize =
- Resources.getSystem().getInteger(
- com.android.internal.R.integer.config_cursorWindowSize) * 1024;
+ // This static member will be evaluated when first used.
+ private static int sCursorWindowSize = -1;
/**
* The native CursorWindow object pointer. (FOR INTERNAL USE ONLY)
@@ -100,6 +96,13 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
public CursorWindow(String name) {
mStartPos = 0;
mName = name != null && name.length() != 0 ? name : "<unnamed>";
+ if (sCursorWindowSize < 0) {
+ /** The cursor window size. resource xml file specifies the value in kB.
+ * convert it to bytes here by multiplying with 1024.
+ */
+ sCursorWindowSize = Resources.getSystem().getInteger(
+ com.android.internal.R.integer.config_cursorWindowSize) * 1024;
+ }
mWindowPtr = nativeCreate(mName, sCursorWindowSize);
if (mWindowPtr == 0) {
throw new CursorWindowAllocationException("Cursor window allocation of " +