Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update some other files to better match stock Android. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
253313a7ee8cc014432f1603d7eced48 |
User & Date: | dan 2017-11-28 17:05:09.212 |
Context
2017-11-28
| ||
18:16 | Fix a broken test case in DatabaseUtilsTest.java. (check-in: e4878173ae user: dan tags: trunk) | |
17:05 | Update some other files to better match stock Android. (check-in: 253313a7ee user: dan tags: trunk) | |
15:46 | Update further java classfiles to match the latest Android code. (check-in: e782e01fbe user: dan tags: trunk) | |
Changes
Changes to sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteConnection.java.
︙ | ︙ | |||
16 17 18 19 20 21 22 | /* ** Modified to support SQLite extensions by the SQLite developers: ** sqlite-dev@sqlite.org. */ package org.sqlite.database.sqlite; | < > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | /* ** Modified to support SQLite extensions by the SQLite developers: ** sqlite-dev@sqlite.org. */ package org.sqlite.database.sqlite; import org.sqlite.database.sqlite.CloseGuard; import android.database.Cursor; import android.database.CursorWindow; import org.sqlite.database.DatabaseUtils; import org.sqlite.database.sqlite.SQLiteDebug.DbStats; import android.os.CancellationSignal; import android.os.OperationCanceledException; import android.os.ParcelFileDescriptor; import android.os.SystemClock; import android.util.Log; import android.util.LruCache; import android.util.Printer; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; |
︙ | ︙ | |||
91 92 93 94 95 96 97 | public final class SQLiteConnection implements CancellationSignal.OnCancelListener { private static final String TAG = "SQLiteConnection"; private static final boolean DEBUG = false; private static final String[] EMPTY_STRING_ARRAY = new String[0]; private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; | < < | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | public final class SQLiteConnection implements CancellationSignal.OnCancelListener { private static final String TAG = "SQLiteConnection"; private static final boolean DEBUG = false; private static final String[] EMPTY_STRING_ARRAY = new String[0]; private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; private final CloseGuard mCloseGuard = CloseGuard.get(); private final SQLiteConnectionPool mPool; private final SQLiteDatabaseConfiguration mConfiguration; private final int mConnectionId; private final boolean mIsPrimaryConnection; private final boolean mIsReadOnlyConnection; |
︙ | ︙ | |||
215 216 217 218 219 220 221 222 | private void open() { mConnectionPtr = nativeOpen(mConfiguration.path, mConfiguration.openFlags, mConfiguration.label, SQLiteDebug.DEBUG_SQL_STATEMENTS, SQLiteDebug.DEBUG_SQL_TIME); setPageSize(); setForeignKeyModeFromConfiguration(); setJournalSizeLimit(); | > | < | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | private void open() { mConnectionPtr = nativeOpen(mConfiguration.path, mConfiguration.openFlags, mConfiguration.label, SQLiteDebug.DEBUG_SQL_STATEMENTS, SQLiteDebug.DEBUG_SQL_TIME); setPageSize(); setForeignKeyModeFromConfiguration(); setWalModeFromConfiguration(); setJournalSizeLimit(); setAutoCheckpointInterval(); setLocaleFromConfiguration(); // Register custom functions. final int functionCount = mConfiguration.customFunctions.size(); for (int i = 0; i < functionCount; i++) { SQLiteCustomFunction function = mConfiguration.customFunctions.get(i); nativeRegisterCustomFunction(mConnectionPtr, function); |
︙ | ︙ | |||
428 429 430 431 432 433 434 | & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0; boolean localeChanged = !configuration.locale.equals(mConfiguration.locale); // Update configuration parameters. mConfiguration.updateParametersFrom(configuration); // Update prepared statement cache size. | > | | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0; boolean localeChanged = !configuration.locale.equals(mConfiguration.locale); // Update configuration parameters. mConfiguration.updateParametersFrom(configuration); // Update prepared statement cache size. // sqlite.org: android.util.LruCache.resize() requires API level 21. // mPreparedStatementCache.resize(configuration.maxSqlCacheSize); // Update foreign key mode. if (foreignKeyModeChanged) { setForeignKeyModeFromConfiguration(); } // Update WAL. |
︙ | ︙ | |||
1045 1046 1047 1048 1049 1050 1051 | || statementType == DatabaseUtils.STATEMENT_SELECT) { return true; } return false; } private void applyBlockGuardPolicy(PreparedStatement statement) { | < < < < < < < | 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | || statementType == DatabaseUtils.STATEMENT_SELECT) { return true; } return false; } private void applyBlockGuardPolicy(PreparedStatement statement) { } /** * Dumps debugging information about this connection. * * @param printer The printer to receive the dump, not null. * @param verbose True to dump more verbose information. |
︙ | ︙ | |||
1212 1213 1214 1215 1216 1217 1218 | private void recyclePreparedStatement(PreparedStatement statement) { statement.mSql = null; statement.mPoolNext = mPreparedStatementPool; mPreparedStatementPool = statement; } private static String trimSqlForDisplay(String sql) { | > > > > | | 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 | private void recyclePreparedStatement(PreparedStatement statement) { statement.mSql = null; statement.mPoolNext = mPreparedStatementPool; mPreparedStatementPool = statement; } private static String trimSqlForDisplay(String sql) { // Note: Creating and caching a regular expression is expensive at preload-time // and stops compile-time initialization. This pattern is only used when // dumping the connection, which is a rare (mainly error) case. So: // DO NOT CACHE. return sql.replaceAll("[\\s]*\\n+[\\s]*", " "); } /** * Holder type for a prepared statement. * * Although this object holds a pointer to a native statement object, it * does not have a finalizer. This is deliberate. The {@link SQLiteConnection} |
︙ | ︙ | |||
1317 1318 1319 1320 1321 1322 1323 | } else { operation.mFinished = false; operation.mException = null; if (operation.mBindArgs != null) { operation.mBindArgs.clear(); } } | > | | 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 | } else { operation.mFinished = false; operation.mException = null; if (operation.mBindArgs != null) { operation.mBindArgs.clear(); } } operation.mStartWallTime = System.currentTimeMillis(); operation.mStartTime = SystemClock.uptimeMillis(); operation.mKind = kind; operation.mSql = sql; if (bindArgs != null) { if (operation.mBindArgs == null) { operation.mBindArgs = new ArrayList<Object>(); } else { operation.mBindArgs.clear(); |
︙ | ︙ | |||
1374 1375 1376 1377 1378 1379 1380 | logOperationLocked(cookie, detail); } } private boolean endOperationDeferLogLocked(int cookie) { final Operation operation = getOperationLocked(cookie); if (operation != null) { | | | 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 | logOperationLocked(cookie, detail); } } private boolean endOperationDeferLogLocked(int cookie) { final Operation operation = getOperationLocked(cookie); if (operation != null) { operation.mEndTime = SystemClock.uptimeMillis(); operation.mFinished = true; return SQLiteDebug.DEBUG_LOG_SLOW_QUERIES && SQLiteDebug.shouldLogSlowQuery( operation.mEndTime - operation.mStartTime); } return false; } |
︙ | ︙ | |||
1446 1447 1448 1449 1450 1451 1452 | printer.println(" <none>"); } } } } private static final class Operation { | > > > > | < > | | | | 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 | printer.println(" <none>"); } } } } private static final class Operation { // Trim all SQL statements to 256 characters inside the trace marker. // This limit gives plenty of context while leaving space for other // entries in the trace buffer (and ensures atrace doesn't truncate the // marker for us, potentially losing metadata in the process). private static final int MAX_TRACE_METHOD_NAME_LEN = 256; public long mStartWallTime; // in System.currentTimeMillis() public long mStartTime; // in SystemClock.uptimeMillis(); public long mEndTime; // in SystemClock.uptimeMillis(); public String mKind; public String mSql; public ArrayList<Object> mBindArgs; public boolean mFinished; public Exception mException; public int mCookie; public void describe(StringBuilder msg, boolean verbose) { msg.append(mKind); if (mFinished) { msg.append(" took ").append(mEndTime - mStartTime).append("ms"); } else { msg.append(" started ").append(System.currentTimeMillis() - mStartWallTime) .append("ms ago"); } msg.append(" - ").append(getStatus()); if (mSql != null) { msg.append(", sql=\"").append(trimSqlForDisplay(mSql)).append("\""); } if (verbose && mBindArgs != null && mBindArgs.size() != 0) { |
︙ | ︙ | |||
1501 1502 1503 1504 1505 1506 1507 1508 1509 | private String getStatus() { if (!mFinished) { return "running"; } return mException != null ? "failed" : "succeeded"; } private String getFormattedStartTime() { | > > > > > > > > > > > | | 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 | private String getStatus() { if (!mFinished) { return "running"; } return mException != null ? "failed" : "succeeded"; } private String getTraceMethodName() { String methodName = mKind + " " + mSql; if (methodName.length() > MAX_TRACE_METHOD_NAME_LEN) return methodName.substring(0, MAX_TRACE_METHOD_NAME_LEN); return methodName; } private String getFormattedStartTime() { // Note: SimpleDateFormat is not thread-safe, cannot be compile-time created, and is // relatively expensive to create during preloading. This method is only used // when dumping a connection, which is a rare (mainly error) case. So: // DO NOT CACHE. return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date(mStartWallTime)); } } } |
Changes to sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteConnectionPool.java.
︙ | ︙ | |||
23 24 25 26 27 28 29 | import org.sqlite.database.sqlite.CloseGuard; import org.sqlite.database.sqlite.SQLiteDebug.DbStats; import android.os.CancellationSignal; import android.os.OperationCanceledException; import android.os.SystemClock; import android.util.Log; | < | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import org.sqlite.database.sqlite.CloseGuard; import org.sqlite.database.sqlite.SQLiteDebug.DbStats; import android.os.CancellationSignal; import android.os.OperationCanceledException; import android.os.SystemClock; import android.util.Log; import android.util.Printer; import java.io.Closeable; import java.util.ArrayList; import java.util.Map; import java.util.WeakHashMap; import java.util.concurrent.atomic.AtomicBoolean; |
︙ | ︙ | |||
1010 1011 1012 1013 1014 1015 1016 | /** * Dumps debugging information about this connection pool. * * @param printer The printer to receive the dump, not null. * @param verbose True to dump more verbose information. */ public void dump(Printer printer, boolean verbose) { | < | | 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 | /** * Dumps debugging information about this connection pool. * * @param printer The printer to receive the dump, not null. * @param verbose True to dump more verbose information. */ public void dump(Printer printer, boolean verbose) { Printer indentedPrinter = printer; synchronized (mLock) { printer.println("Connection pool for " + mConfiguration.path + ":"); printer.println(" Open: " + mIsOpen); printer.println(" Max connections: " + mMaxConnectionPoolSize); printer.println(" Available primary connection:"); if (mAvailablePrimaryConnection != null) { |
︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 | + ", priority=" + waiter.mPriority + ", sql='" + waiter.mSql + "'"); } } else { indentedPrinter.println("<none>"); } } | < | 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 | + ", priority=" + waiter.mPriority + ", sql='" + waiter.mSql + "'"); } } else { indentedPrinter.println("<none>"); } } } @Override public String toString() { return "SQLiteConnectionPool: " + mConfiguration.path; } |
︙ | ︙ |
Changes to sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteCursor.java.
︙ | ︙ | |||
16 17 18 19 20 21 22 | /* ** Modified to support SQLite extensions by the SQLite developers: ** sqlite-dev@sqlite.org. */ package org.sqlite.database.sqlite; | < < > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /* ** Modified to support SQLite extensions by the SQLite developers: ** sqlite-dev@sqlite.org. */ package org.sqlite.database.sqlite; import android.database.AbstractWindowedCursor; import android.database.CursorWindow; import org.sqlite.database.DatabaseUtils; import android.os.StrictMode; import android.util.Log; import java.util.HashMap; import java.util.Map; |
︙ | ︙ | |||
59 60 61 62 63 64 65 | /** The number of rows that can fit in the cursor window, 0 if unknown */ private int mCursorWindowCapacity; /** A mapping of column names to column indices, to speed up lookups */ private Map<String, Integer> mColumnNameMap; | < < < | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | /** The number of rows that can fit in the cursor window, 0 if unknown */ private int mCursorWindowCapacity; /** A mapping of column names to column indices, to speed up lookups */ private Map<String, Integer> mColumnNameMap; /** * Execute a query and provide access to its result set through a Cursor * interface. For a query such as: {@code SELECT name, birth, phone FROM * myTable WHERE ... LIMIT 1,20 ORDER BY...} the column names (name, birth, * phone) would be in the projection argument and everything from * {@code FROM} onward would be in the params argument. * |
︙ | ︙ | |||
96 97 98 99 100 101 102 | * @param editTable the name of the table used for this query * @param query the {@link SQLiteQuery} object associated with this cursor object. */ public SQLiteCursor(SQLiteCursorDriver driver, String editTable, SQLiteQuery query) { if (query == null) { throw new IllegalArgumentException("query object cannot be null"); } | < < < < < | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | * @param editTable the name of the table used for this query * @param query the {@link SQLiteQuery} object associated with this cursor object. */ public SQLiteCursor(SQLiteCursorDriver driver, String editTable, SQLiteQuery query) { if (query == null) { throw new IllegalArgumentException("query object cannot be null"); } mDriver = driver; mEditTable = editTable; mColumnNameMap = null; mQuery = query; mColumns = query.getColumnNames(); } |
︙ | ︙ | |||
280 281 282 283 284 285 286 | * Release the native resources, if they haven't been released yet. */ @Override protected void finalize() { try { // if the cursor hasn't been closed yet, close it first if (mWindow != null) { | < < < < < < < < < < < < | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | * Release the native resources, if they haven't been released yet. */ @Override protected void finalize() { try { // if the cursor hasn't been closed yet, close it first if (mWindow != null) { close(); } } finally { super.finalize(); } } } |
Changes to sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java.
︙ | ︙ | |||
738 739 740 741 742 743 744 | deleted |= new File(file.getPath() + "-journal").delete(); deleted |= new File(file.getPath() + "-shm").delete(); deleted |= new File(file.getPath() + "-wal").delete(); File dir = file.getParentFile(); if (dir != null) { final String prefix = file.getName() + "-mj"; | | | > | | > | 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | deleted |= new File(file.getPath() + "-journal").delete(); deleted |= new File(file.getPath() + "-shm").delete(); deleted |= new File(file.getPath() + "-wal").delete(); File dir = file.getParentFile(); if (dir != null) { final String prefix = file.getName() + "-mj"; File[] files = dir.listFiles(new FileFilter() { @Override public boolean accept(File candidate) { return candidate.getName().startsWith(prefix); } }); if (files != null) { for (File masterJournal : files) { deleted |= masterJournal.delete(); } } } return deleted; } /** * Reopens the database in read-write mode. |
︙ | ︙ | |||
1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 | public long insertOrThrow(String table, String nullColumnHack, ContentValues values) throws SQLException { return insertWithOnConflict(table, nullColumnHack, values, CONFLICT_NONE); } /** * Convenience method for replacing a row in the database. * * @param table the table in which to replace the row * @param nullColumnHack optional; may be <code>null</code>. * SQL doesn't allow inserting a completely empty row without * naming at least one column name. If your provided <code>initialValues</code> is * empty, no column names are known and an empty row can't be inserted. * If not set to null, the <code>nullColumnHack</code> parameter * provides the name of nullable column name to explicitly insert a NULL into * in the case where your <code>initialValues</code> is empty. * @param initialValues this map contains the initial column values for | > | > | | 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 | public long insertOrThrow(String table, String nullColumnHack, ContentValues values) throws SQLException { return insertWithOnConflict(table, nullColumnHack, values, CONFLICT_NONE); } /** * Convenience method for replacing a row in the database. * Inserts a new row if a row does not already exist. * * @param table the table in which to replace the row * @param nullColumnHack optional; may be <code>null</code>. * SQL doesn't allow inserting a completely empty row without * naming at least one column name. If your provided <code>initialValues</code> is * empty, no column names are known and an empty row can't be inserted. * If not set to null, the <code>nullColumnHack</code> parameter * provides the name of nullable column name to explicitly insert a NULL into * in the case where your <code>initialValues</code> is empty. * @param initialValues this map contains the initial column values for * the row. The keys should be the column names and the values the column values. * @return the row ID of the newly inserted row, or -1 if an error occurred */ public long replace(String table, String nullColumnHack, ContentValues initialValues) { try { return insertWithOnConflict(table, nullColumnHack, initialValues, CONFLICT_REPLACE); } catch (SQLException e) { Log.e(TAG, "Error inserting " + initialValues, e); return -1; } } /** * Convenience method for replacing a row in the database. * Inserts a new row if a row does not already exist. * * @param table the table in which to replace the row * @param nullColumnHack optional; may be <code>null</code>. * SQL doesn't allow inserting a completely empty row without * naming at least one column name. If your provided <code>initialValues</code> is * empty, no column names are known and an empty row can't be inserted. * If not set to null, the <code>nullColumnHack</code> parameter * provides the name of nullable column name to explicitly insert a NULL into * in the case where your <code>initialValues</code> is empty. * @param initialValues this map contains the initial column values for * the row. The keys should be the column names and the values the column values. * @throws SQLException * @return the row ID of the newly inserted row, or -1 if an error occurred */ public long replaceOrThrow(String table, String nullColumnHack, ContentValues initialValues) throws SQLException { return insertWithOnConflict(table, nullColumnHack, initialValues, CONFLICT_REPLACE); |
︙ | ︙ | |||
1427 1428 1429 1430 1431 1432 1433 | * If not set to null, the <code>nullColumnHack</code> parameter * provides the name of nullable column name to explicitly insert a NULL into * in the case where your <code>initialValues</code> is empty. * @param initialValues this map contains the initial column values for the * row. The keys should be the column names and the values the * column values * @param conflictAlgorithm for insert conflict resolver | | < | | | 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 | * If not set to null, the <code>nullColumnHack</code> parameter * provides the name of nullable column name to explicitly insert a NULL into * in the case where your <code>initialValues</code> is empty. * @param initialValues this map contains the initial column values for the * row. The keys should be the column names and the values the * column values * @param conflictAlgorithm for insert conflict resolver * @return the row ID of the newly inserted row OR <code>-1</code> if either the * input parameter <code>conflictAlgorithm</code> = {@link #CONFLICT_IGNORE} * or an error occurred. */ public long insertWithOnConflict(String table, String nullColumnHack, ContentValues initialValues, int conflictAlgorithm) { acquireReference(); try { StringBuilder sql = new StringBuilder(); sql.append("INSERT"); |
︙ | ︙ |
Changes to sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteDatabaseConfiguration.java.
︙ | ︙ | |||
157 158 159 160 161 162 163 | * @return True if the database is in-memory. */ public boolean isInMemoryDb() { return path.equalsIgnoreCase(MEMORY_DB_PATH); } private static String stripPathForLogs(String path) { | | > > | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | * @return True if the database is in-memory. */ public boolean isInMemoryDb() { return path.equalsIgnoreCase(MEMORY_DB_PATH); } private static String stripPathForLogs(String path) { /* Strip off all URI parameters. This is in case a SEE database is * opened with the password specified as a URI parameter. We do not * want the password to appear in any log files. */ int iIdx = path.indexOf('?'); if( iIdx>=0 ){ path = (String) path.subSequence(0, iIdx); } if (path.indexOf('@') == -1) { return path; |
︙ | ︙ |
Changes to sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteDebug.java.
︙ | ︙ | |||
79 80 81 82 83 84 85 | * * This value can be changed dynamically while the system is running. * For example, "adb shell setprop db.log.slow_query_threshold 200" will * log all queries that take 200ms or longer to run. * @hide */ public static final boolean shouldLogSlowQuery(long elapsedTimeMillis) { | | > > | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | * * This value can be changed dynamically while the system is running. * For example, "adb shell setprop db.log.slow_query_threshold 200" will * log all queries that take 200ms or longer to run. * @hide */ public static final boolean shouldLogSlowQuery(long elapsedTimeMillis) { int slowQueryMillis = Integer.parseInt( System.getProperty("db.log.slow_query_threshold", "10000") ); return slowQueryMillis >= 0 && elapsedTimeMillis >= slowQueryMillis; } /** * Contains statistics about the active pagers in the current process. * * @see #nativeGetPagerStats(PagerStats) |
︙ | ︙ |
Changes to sqlite3/src/main/java/org/sqlite/database/sqlite/SQLiteGlobal.java.
︙ | ︙ | |||
18 19 20 21 22 23 24 | ** sqlite-dev@sqlite.org. */ package org.sqlite.database.sqlite; import android.content.res.Resources; import android.os.StatFs; | < | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ** sqlite-dev@sqlite.org. */ package org.sqlite.database.sqlite; import android.content.res.Resources; import android.os.StatFs; /** * Provides access to SQLite functions that affect all database connection, * such as memory management. * * The native code associated with SQLiteGlobal is also sets global configuration options * using sqlite3_config() then calls sqlite3_initialize() to ensure that the SQLite |
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 70 71 72 73 74 | /** * Gets the default page size to use when creating a database. */ public static int getDefaultPageSize() { synchronized (sLock) { if (sDefaultPageSize == 0) { sDefaultPageSize = new StatFs("/data").getBlockSize(); } return 1024; } } /** | > > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | /** * Gets the default page size to use when creating a database. */ public static int getDefaultPageSize() { synchronized (sLock) { if (sDefaultPageSize == 0) { // If there is an issue accessing /data, something is so seriously // wrong that we just let the IllegalArgumentException propagate. sDefaultPageSize = new StatFs("/data").getBlockSize(); } return 1024; } } /** |
︙ | ︙ |