|
18 | 18 |
|
19 | 19 | import android.content.res.Resources; |
20 | 20 | import android.os.StatFs; |
| 21 | +import android.os.SystemProperties; |
21 | 22 |
|
22 | 23 | /** |
23 | 24 | * Provides access to SQLite functions that affect all database connection, |
@@ -62,55 +63,63 @@ public static int getDefaultPageSize() { |
62 | 63 | if (sDefaultPageSize == 0) { |
63 | 64 | sDefaultPageSize = new StatFs("/data").getBlockSize(); |
64 | 65 | } |
65 | | - return sDefaultPageSize; |
| 66 | + return SystemProperties.getInt("debug.sqlite.pagesize", sDefaultPageSize); |
66 | 67 | } |
67 | 68 | } |
68 | 69 |
|
69 | 70 | /** |
70 | 71 | * Gets the default journal mode when WAL is not in use. |
71 | 72 | */ |
72 | 73 | public static String getDefaultJournalMode() { |
73 | | - return Resources.getSystem().getString( |
74 | | - com.android.internal.R.string.db_default_journal_mode); |
| 74 | + return SystemProperties.get("debug.sqlite.journalmode", |
| 75 | + Resources.getSystem().getString( |
| 76 | + com.android.internal.R.string.db_default_journal_mode)); |
75 | 77 | } |
76 | 78 |
|
77 | 79 | /** |
78 | 80 | * Gets the journal size limit in bytes. |
79 | 81 | */ |
80 | 82 | public static int getJournalSizeLimit() { |
81 | | - return Resources.getSystem().getInteger( |
82 | | - com.android.internal.R.integer.db_journal_size_limit); |
| 83 | + return SystemProperties.getInt("debug.sqlite.journalsizelimit", |
| 84 | + Resources.getSystem().getInteger( |
| 85 | + com.android.internal.R.integer.db_journal_size_limit)); |
83 | 86 | } |
84 | 87 |
|
85 | 88 | /** |
86 | 89 | * Gets the default database synchronization mode when WAL is not in use. |
87 | 90 | */ |
88 | 91 | public static String getDefaultSyncMode() { |
89 | | - return Resources.getSystem().getString( |
90 | | - com.android.internal.R.string.db_default_sync_mode); |
| 92 | + return SystemProperties.get("debug.sqlite.syncmode", |
| 93 | + Resources.getSystem().getString( |
| 94 | + com.android.internal.R.string.db_default_sync_mode)); |
91 | 95 | } |
92 | 96 |
|
93 | 97 | /** |
94 | 98 | * Gets the database synchronization mode when in WAL mode. |
95 | 99 | */ |
96 | 100 | public static String getWALSyncMode() { |
97 | | - return Resources.getSystem().getString( |
98 | | - com.android.internal.R.string.db_wal_sync_mode); |
| 101 | + return SystemProperties.get("debug.sqlite.wal.syncmode", |
| 102 | + Resources.getSystem().getString( |
| 103 | + com.android.internal.R.string.db_wal_sync_mode)); |
99 | 104 | } |
100 | 105 |
|
101 | 106 | /** |
102 | 107 | * Gets the WAL auto-checkpoint integer in database pages. |
103 | 108 | */ |
104 | 109 | public static int getWALAutoCheckpoint() { |
105 | | - return Math.max(1, Resources.getSystem().getInteger( |
| 110 | + int value = SystemProperties.getInt("debug.sqlite.wal.autocheckpoint", |
| 111 | + Resources.getSystem().getInteger( |
106 | 112 | com.android.internal.R.integer.db_wal_autocheckpoint)); |
| 113 | + return Math.max(1, value); |
107 | 114 | } |
108 | 115 |
|
109 | 116 | /** |
110 | 117 | * Gets the connection pool size when in WAL mode. |
111 | 118 | */ |
112 | 119 | public static int getWALConnectionPoolSize() { |
113 | | - return Math.max(2, Resources.getSystem().getInteger( |
| 120 | + int value = SystemProperties.getInt("debug.sqlite.wal.poolsize", |
| 121 | + Resources.getSystem().getInteger( |
114 | 122 | com.android.internal.R.integer.db_connection_pool_size)); |
| 123 | + return Math.max(2, value); |
115 | 124 | } |
116 | 125 | } |
0 commit comments