am 79e0206e: Merge "Init the static member when first used for CursorWindow."

* commit '79e0206ef3203a1842949242e58fa8f3c25eb129':
  Init the static member when first used for CursorWindow.
This commit is contained in:
Narayan Kamath
2014-05-16 12:26:34 +00:00
committed by Android Git Automerger

View File

@@ -42,12 +42,8 @@ import android.util.LongSparseArray;
public class CursorWindow extends SQLiteClosable implements Parcelable { public class CursorWindow extends SQLiteClosable implements Parcelable {
private static final String STATS_TAG = "CursorWindowStats"; private static final String STATS_TAG = "CursorWindowStats";
/** The cursor window size. resource xml file specifies the value in kB. // This static member will be evaluated when first used.
* convert it to bytes here by multiplying with 1024. private static int sCursorWindowSize = -1;
*/
private static final int sCursorWindowSize =
Resources.getSystem().getInteger(
com.android.internal.R.integer.config_cursorWindowSize) * 1024;
/** /**
* The native CursorWindow object pointer. (FOR INTERNAL USE ONLY) * The native CursorWindow object pointer. (FOR INTERNAL USE ONLY)
@@ -100,6 +96,13 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
public CursorWindow(String name) { public CursorWindow(String name) {
mStartPos = 0; mStartPos = 0;
mName = name != null && name.length() != 0 ? name : "<unnamed>"; 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); mWindowPtr = nativeCreate(mName, sCursorWindowSize);
if (mWindowPtr == 0) { if (mWindowPtr == 0) {
throw new CursorWindowAllocationException("Cursor window allocation of " + throw new CursorWindowAllocationException("Cursor window allocation of " +