Fix bugs regarding IllegalStateException during moving position in cursorwindow.

"startPos + addedRows < requiredPos" could miss a row in boundary position.
Because of the fluctuating row size, "startPos + addedRows < requiredPos" expression could miss a row in boundary position.
For example, simply speaking,
if window capacity = 120 and requiredPos = 120,
"fillWindow" needs to be newly called and "starPos" is 80 for the window.
Unfortunately 120th row is bigger than the rest size of the window,
the row for requiredPos is not in the window.
Then, startPos has to be newly set and the 120th row has to be included in the window.
But by the expression above "startPos + addedRows < requiredPos",
the row for requiredPos is regarded as included in the window.
In that case, by "mCurrentRowID = Long.valueOf(getLong(mRowIdColumnIndex));" statment in AbstractCursor,
IllegalStateException is thrown.

This patch contains modification of the expression as "startPos + addedRows <= requiredPos".

Change-Id: Iaee75241e495949b0a624b836843da18d0bcb98d
Potential NPE in SQLiteConnection

Change-Id: I4d768bda5ea2fccb4a7c6ce7a5f074bf41563eac
Signed-off-by: Sylvain Becuwe <sylvain.becuwe@gmail.com>
Keep native callbacks when primary SQLiteConnection is recreated

When a database was ATTACHed/DETACHed to a database that had Write-Ahead
Logging enabled, the primary SQLConnection was recreated but the
registered native callbacks were not restored.

Change-Id: I8787fee78e68197ae472e05cc694d11381defa71