summaryrefslogtreecommitdiffstats
path: root/core/java/android/database
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-05-16 12:34:48 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-16 12:34:48 +0000
commit3bd2c6ffea0660b29f49647fbb045da84486e26a (patch)
tree0d04d95b36f0287903c15522336793142ea309d4 /core/java/android/database
parentd75f1efcb935b8e448cf29caca1188985eb7984a (diff)
parentb4606676a8e357f7b6de049099a04438f7c1b4eb (diff)
downloadframeworks_base-3bd2c6ffea0660b29f49647fbb045da84486e26a.zip
frameworks_base-3bd2c6ffea0660b29f49647fbb045da84486e26a.tar.gz
frameworks_base-3bd2c6ffea0660b29f49647fbb045da84486e26a.tar.bz2
am b4606676: am 49538def: am 79e0206e: Merge "Init the static member when first used for CursorWindow."
* commit 'b4606676a8e357f7b6de049099a04438f7c1b4eb': Init the static member when first used for CursorWindow.
Diffstat (limited to 'core/java/android/database')
-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 197e3ff..a75372f 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 " +