Compare commits

..

12 Commits

Author SHA1 Message Date
akwizgran
a872851a78 Revert minSdkVersion to 21 to fix Robolectric tests. 2023-09-05 17:29:05 +01:00
akwizgran
f3050f9fb8 Fix packaging of Tor binaries with minSdkVersion >= 23. 2023-09-05 17:07:59 +01:00
akwizgran
a3ba1ac91e Fix Gradle Witness. 2023-09-05 16:38:36 +01:00
akwizgran
0ac4b5c613 Don't delete .gitkeep when cleaning. 2023-09-05 15:27:01 +01:00
akwizgran
f4425acfaf Keep jniLibs dir, as it's now an input of the clean task. 2023-09-05 15:23:33 +01:00
akwizgran
7b65c63bc9 Package Android binaries, enable desugaring, bump min API level.
FIXME: Desugaring ConcurrentHashMap.newKeySet() requires
desugar_jdk_libs version 2, which requires bumping the Android Gradle
plugin version. This seems to have broken Gradle Witness.
2023-09-05 14:50:23 +01:00
akwizgran
bf2de56abe Use SqliteDatabase as default implementation. 2023-09-05 10:48:58 +01:00
akwizgran
8d7ac49bff Enable secure_delete for SQLite. 2023-09-05 10:48:36 +01:00
akwizgran
9b2c8b0f98 Fix default value for sync versions. 2023-09-05 10:37:07 +01:00
akwizgran
b7c0bc468f WIP: Create indexes on foreign key columns if needed. 2023-09-04 17:42:02 +01:00
akwizgran
852f3fd78b WIP: Temporarily skip failing test so we can run performance test. 2023-09-01 11:51:05 +01:00
akwizgran
6734284585 WIP: Add SQLite DB backend using sqlite-jdbc-crypt. 2023-09-01 11:42:24 +01:00
37 changed files with 994 additions and 609 deletions

View File

@@ -104,3 +104,12 @@ mailbox integration test:
script:
- (cd briar-mailbox; git fetch; git reset --hard origin/main)
- MAILBOX_INTEGRATION_TESTS=true ./gradlew --info mailbox-integration-tests:test
db_performance_comparison_test:
extends: .base-test
stage: optional_tests
script:
- OPTIONAL_TESTS=org.briarproject.bramble.db.H2SqliteDatabasePerformanceComparisonTest ./gradlew --info -Djava.security.egd=file:/dev/urandom :bramble-core:test --tests H2SqliteDatabasePerformanceComparisonTest
rules:
- when: manual

View File

@@ -4,3 +4,4 @@ build
.settings
src/main/res/raw/*.zip
src/main/jniLibs
!src/main/jniLibs/.gitkeep

View File

@@ -11,10 +11,12 @@ android {
}
defaultConfig {
// FIXME: sqlite-jdbc-crypt uses __register_atfork which is only available on API >= 23.
// We might be able to solve this by recompiling (or asking upstream to recompile)
minSdkVersion 21
targetSdkVersion 33
versionCode 10507
versionName "1.5.7"
versionCode 10506
versionName "1.5.6"
consumerProguardFiles 'proguard-rules.txt'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -37,6 +39,7 @@ android {
configurations {
tor
sqliteJdbcCrypt
}
dependencies {
@@ -57,6 +60,8 @@ dependencies {
tor "org.briarproject:obfs4proxy-android:$obfs4proxy_version"
tor "org.briarproject:snowflake-android:$snowflake_version"
sqliteJdbcCrypt "io.github.willena:sqlite-jdbc:$sqlite_jdbc_crypt_version"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
compileOnly 'javax.annotation:jsr250-api:1.0'
@@ -69,26 +74,50 @@ dependencies {
testImplementation "org.jmock:jmock-imposters:$jmock_version"
}
def torLibsDir = 'src/main/jniLibs'
def jniLibsDir = 'src/main/jniLibs'
task cleanTorBinaries {
outputs.dir torLibsDir
task cleanJniLibs {
inputs.dir jniLibsDir
outputs.dir jniLibsDir
doLast {
delete fileTree(torLibsDir)
delete fileTree(jniLibsDir).filter { it.name.endsWith('.so') }
}
}
clean.dependsOn cleanTorBinaries
clean.dependsOn cleanJniLibs
task unpackTorBinaries {
outputs.dir torLibsDir
task unpackJniLibs {
outputs.dir jniLibsDir
doLast {
// Tor
copy {
from configurations.tor.collect { zipTree(it) }
into torLibsDir
into jniLibsDir
}
// sqlite-jdbc-crypt
def archMap = [
aarch64: 'arm64-v8a',
arm : 'armeabi-v7a',
x86 : 'x86',
x86_64 : 'x86_64'
]
configurations.sqliteJdbcCrypt.collect { File artifact ->
zipTree(artifact).each { File f ->
for (String arch : archMap.keySet()) {
if (f.absolutePath.endsWith("/Linux-Android/$arch/libsqlitejdbc.so")) {
def archDir = new File(jniLibsDir, archMap.get(arch))
archDir.mkdirs()
copy {
from f
into archDir
}
break
}
}
dependsOn cleanTorBinaries
}
}
}
dependsOn cleanJniLibs
}
preBuild.dependsOn unpackTorBinaries
preBuild.dependsOn unpackJniLibs

View File

@@ -6,6 +6,9 @@
-dontwarn org.h2.**
-dontnote org.h2.**
# Keep sqlite-jdbc-crypt classes that are loaded via reflection or accessed via JNI
-keep class org.sqlite.** { *; }
-keep class dagger.** { *; }
-dontwarn dagger.**
-dontnote dagger.**

View File

@@ -201,7 +201,6 @@ class AndroidLanTcpPlugin extends LanTcpPlugin {
@Nullable
private InetAddress getIpv6AddressForInterface(InetAddress ipv4) {
try {
// We may get an NPE from getByInetAddress() on Android 11
NetworkInterface iface = NetworkInterface.getByInetAddress(ipv4);
if (iface == null) return null;
for (InetAddress addr : list(iface.getInetAddresses())) {
@@ -209,7 +208,7 @@ class AndroidLanTcpPlugin extends LanTcpPlugin {
}
// No suitable address
return null;
} catch (SocketException | NullPointerException e) {
} catch (SocketException e) {
logException(LOG, WARNING, e);
return null;
}

View File

@@ -64,16 +64,11 @@ public class AndroidUtils {
}
// Return the address from settings if it's valid and not fake
if (SDK_INT < 33) {
try {
address = Settings.Secure.getString(ctx.getContentResolver(),
"bluetooth_address");
if (isValidBluetoothAddress(address)) {
return new Pair<>(address, "settings");
}
} catch (SecurityException e) {
// Some custom ROMs throw this exception on SDK_INT < 33.
// Fall through
}
}
// Try to get the address via reflection
address = getBluetoothAddressByReflection(adapter);

View File

@@ -18,6 +18,7 @@ dependencyVerification {
'com.google.j2objc:j2objc-annotations:1.3:j2objc-annotations-1.3.jar:21af30c92267bd6122c0e0b4d20cccb6641a37eaf956c6540ec471d584e64a7b',
'com.squareup:javapoet:1.13.0:javapoet-1.13.0.jar:4c7517e848a71b36d069d12bb3bf46a70fd4cda3105d822b0ed2e19c00b69291',
'com.squareup:kotlinpoet:1.11.0:kotlinpoet-1.11.0.jar:2887ada1ca03dd83baa2758640d87e840d1907564db0ef88d2289c868a980492',
'io.github.willena:sqlite-jdbc:3.41.2.1:sqlite-jdbc-3.41.2.1.jar:fb60e7137c1791db89240701338d31ca42a0bec5508c1aab1c1131cf885f2309',
'javax.annotation:jsr250-api:1.0:jsr250-api-1.0.jar:a1a922d0d9b6d183ed3800dfac01d1e1eb159f0e8c6f94736931c1def54a941f',
'javax.inject:javax.inject:1:javax.inject-1.jar:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
'junit:junit:4.13.2:junit-4.13.2.jar:8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3',
@@ -38,10 +39,10 @@ dependencyVerification {
'org.hamcrest:hamcrest-core:2.1:hamcrest-core-2.1.jar:e09109e54a289d88506b9bfec987ddd199f4217c9464132668351b9a4f00bee9',
'org.hamcrest:hamcrest-library:2.1:hamcrest-library-2.1.jar:b7e2b6895b3b679f0e47b6380fda391b225e9b78505db9d8bdde8d3cc8d52a21',
'org.hamcrest:hamcrest:2.1:hamcrest-2.1.jar:ba93b2e3a562322ba432f0a1b53addcc55cb188253319a020ed77f824e692050',
'org.jacoco:org.jacoco.agent:0.8.7:org.jacoco.agent-0.8.7.jar:9cbcc986e0fbe821a78ff1f8f7d5216f200e5eb124e7f6837d1dc4a77b28b143',
'org.jacoco:org.jacoco.ant:0.8.7:org.jacoco.ant-0.8.7.jar:97ca96a382c3f23a44d8eb4c4e6c3742a30cb8005774a76ced0fc4806ce49605',
'org.jacoco:org.jacoco.core:0.8.7:org.jacoco.core-0.8.7.jar:ad7739b5fb5969aa1a8aead3d74ed54dc82ed012f1f10f336bd1b96e71c1a13c',
'org.jacoco:org.jacoco.report:0.8.7:org.jacoco.report-0.8.7.jar:cc89258623700a6c932592153cb528785876b6da183d5431f97efbba6f020e5b',
'org.jacoco:org.jacoco.agent:0.8.8:org.jacoco.agent-0.8.8.jar:072ecbd496896623899a696fff12c01c1615f737616d2792e6d0e10cdf8a610d',
'org.jacoco:org.jacoco.ant:0.8.8:org.jacoco.ant-0.8.8.jar:02e33bd2c48dc0be67c2fea84d43beececfd400da6797c58153253d4c30aca15',
'org.jacoco:org.jacoco.core:0.8.8:org.jacoco.core-0.8.8.jar:474c782f809d88924713dfdbf0acb79d330f904be576484803463d0465611643',
'org.jacoco:org.jacoco.report:0.8.8:org.jacoco.report-0.8.8.jar:2c129110f3e3fcaa1f8179578ea3894586199cb0826be5c7790278084c9622a9',
'org.jetbrains.kotlin:kotlin-reflect:1.6.10:kotlin-reflect-1.6.10.jar:3277ac102ae17aad10a55abec75ff5696c8d109790396434b496e75087854203',
'org.jetbrains.kotlin:kotlin-stdlib-common:1.7.0:kotlin-stdlib-common-1.7.0.jar:59c6ff64fe9a6604afce03e8aaa75f83586c6030ac71fb0b34ee7cdefed3618f',
'org.jetbrains.kotlin:kotlin-stdlib-common:1.8.0:kotlin-stdlib-common-1.8.0.jar:78ef93b59e603cc0fe51def9bd4c037b07cbace3b3b7806d1a490a42bc1f4cb2',
@@ -58,10 +59,10 @@ dependencyVerification {
'org.jmock:jmock-testjar:2.12.0:jmock-testjar-2.12.0.jar:efefbcf6cd294d0e29f0c46eb2a3380d4ca4e1763ff719c69e2f2ac62f564a04',
'org.jmock:jmock:2.12.0:jmock-2.12.0.jar:266d07314c0cd343c46ff8a55601272de8cf406807caf55e6f313295f83d10be',
'org.objenesis:objenesis:3.0.1:objenesis-3.0.1.jar:7a8ff780b9ff48415d7c705f60030b0acaa616e7f823c98eede3b63508d4e984',
'org.ow2.asm:asm-analysis:9.1:asm-analysis-9.1.jar:81a88041b1b8beda5a8a99646098046c48709538270c49def68abff25ac3be34',
'org.ow2.asm:asm-commons:9.1:asm-commons-9.1.jar:afcb26dc1fc12c0c4a99ada670908dd82e18dfc488caf5ee92546996b470c00c',
'org.ow2.asm:asm-tree:9.1:asm-tree-9.1.jar:fd00afa49e9595d7646205b09cecb4a776a8ff0ba06f2d59b8f7bf9c704b4a73',
'org.ow2.asm:asm-analysis:9.2:asm-analysis-9.2.jar:878fbe521731c072d14d2d65b983b1beae6ad06fda0007b6a8bae81f73f433c4',
'org.ow2.asm:asm-commons:9.2:asm-commons-9.2.jar:be4ce53138a238bb522cd781cf91f3ba5ce2f6ca93ec62d46a162a127225e0a6',
'org.ow2.asm:asm-tree:9.2:asm-tree-9.2.jar:aabf9bd23091a4ebfc109c1f3ee7cf3e4b89f6ba2d3f51c5243f16b3cffae011',
'org.ow2.asm:asm:7.1:asm-7.1.jar:4ab2fa2b6d2cc9ccb1eaa05ea329c407b47b13ed2915f62f8c4b8cc96258d4de',
'org.ow2.asm:asm:9.1:asm-9.1.jar:cda4de455fab48ff0bcb7c48b4639447d4de859a7afc30a094a986f0936beba2',
'org.ow2.asm:asm:9.2:asm-9.2.jar:b9d4fe4d71938df38839f0eca42aaaa64cf8b313d678da036f0cb3ca199b47f5',
]
}

View File

@@ -16,6 +16,7 @@ dependencies {
implementation "org.bouncycastle:bcprov-jdk15to18:$bouncy_castle_version"
//noinspection GradleDependency
implementation 'com.h2database:h2:1.4.192' // The last version that supports Java 1.6
implementation "io.github.willena:sqlite-jdbc:$sqlite_jdbc_crypt_version"
implementation 'org.bitlet:weupnp:0.1.4'
implementation 'net.i2p.crypto:eddsa:0.2.0'
implementation 'org.whispersystems:curve25519-java:0.5.0'

View File

@@ -413,6 +413,9 @@ interface Database<T> {
*/
Collection<MessageId> getMessageIds(T txn, GroupId g) throws DbException;
Collection<String> explainGetMessageIds(T txn, GroupId g)
throws DbException;
/**
* Returns the IDs of any delivered messages in the given group with
* metadata that matches all entries in the given query. If the query is

View File

@@ -24,7 +24,7 @@ public class DatabaseModule {
@Singleton
Database<Connection> provideDatabase(DatabaseConfig config,
MessageFactory messageFactory, Clock clock) {
return new H2Database(config, messageFactory, clock);
return new SqliteDatabase(config, messageFactory, clock);
}
@Provides

View File

@@ -4,14 +4,16 @@ class DatabaseTypes {
private final String hashType, secretType, binaryType;
private final String counterType, stringType;
private final String explainCommand; // FIXME: Remove
public DatabaseTypes(String hashType, String secretType, String binaryType,
String counterType, String stringType) {
String counterType, String stringType, String explainCommand) {
this.hashType = hashType;
this.secretType = secretType;
this.binaryType = binaryType;
this.counterType = counterType;
this.stringType = stringType;
this.explainCommand = explainCommand;
}
/**
@@ -22,6 +24,7 @@ class DatabaseTypes {
* <li> _BINARY
* <li> _COUNTER
* <li> _STRING
* <li> _EXPLAIN
*/
String replaceTypes(String s) {
s = s.replaceAll("_HASH", hashType);
@@ -29,6 +32,7 @@ class DatabaseTypes {
s = s.replaceAll("_BINARY", binaryType);
s = s.replaceAll("_COUNTER", counterType);
s = s.replaceAll("_STRING", stringType);
s = s.replaceAll("_EXPLAIN", explainCommand);
return s;
}
}

View File

@@ -39,10 +39,13 @@ class H2Database extends JdbcDatabase {
private static final String HASH_TYPE = "BINARY(32)";
private static final String SECRET_TYPE = "BINARY(32)";
private static final String BINARY_TYPE = "BINARY";
private static final String COUNTER_TYPE = "INT NOT NULL AUTO_INCREMENT";
private static final String COUNTER_TYPE =
"INT NOT NULL AUTO_INCREMENT PRIMARY KEY";
private static final String STRING_TYPE = "VARCHAR";
private static final String EXPLAIN_COMMAND = "EXPLAIN";
private static final DatabaseTypes dbTypes = new DatabaseTypes(HASH_TYPE,
SECRET_TYPE, BINARY_TYPE, COUNTER_TYPE, STRING_TYPE);
SECRET_TYPE, BINARY_TYPE, COUNTER_TYPE, STRING_TYPE,
EXPLAIN_COMMAND);
private final DatabaseConfig config;
private final String url;
@@ -73,7 +76,7 @@ class H2Database extends JdbcDatabase {
boolean reopen = isNonEmptyDirectory(dir);
if (LOG.isLoggable(INFO)) LOG.info("Reopening DB: " + reopen);
if (!reopen && dir.mkdirs()) LOG.info("Created database directory");
super.open("org.h2.Driver", reopen, key, listener);
super.open("org.h2.Driver", reopen, false, key, listener);
if (LOG.isLoggable(INFO)) {
LOG.info("Contents of account directory after opening DB:");
logFileOrDir(LOG, INFO, dir.getParentFile());

View File

@@ -38,11 +38,13 @@ class HyperSqlDatabase extends JdbcDatabase {
private static final String HASH_TYPE = "BINARY(32)";
private static final String SECRET_TYPE = "BINARY(32)";
private static final String BINARY_TYPE = "BINARY";
private static final String COUNTER_TYPE =
"INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1)";
private static final String COUNTER_TYPE = "INTEGER NOT NULL"
+ " PRIMARY KEY GENERATED ALWAYS AS IDENTITY(START WITH 1)";
private static final String STRING_TYPE = "VARCHAR";
private static final String EXPLAIN_COMMAND = "EXPLAIN PLAN FOR";
private static final DatabaseTypes dbTypes = new DatabaseTypes(HASH_TYPE,
SECRET_TYPE, BINARY_TYPE, COUNTER_TYPE, STRING_TYPE);
SECRET_TYPE, BINARY_TYPE, COUNTER_TYPE, STRING_TYPE,
EXPLAIN_COMMAND);
private final DatabaseConfig config;
private final String url;
@@ -70,7 +72,7 @@ class HyperSqlDatabase extends JdbcDatabase {
boolean reopen = isNonEmptyDirectory(dir);
if (LOG.isLoggable(INFO)) LOG.info("Reopening DB: " + reopen);
if (!reopen && dir.mkdirs()) LOG.info("Created database directory");
super.open("org.hsqldb.jdbc.JDBCDriver", reopen, key, listener);
super.open("org.hsqldb.jdbc.JDBCDriver", reopen, true, key, listener);
return reopen;
}

View File

@@ -143,8 +143,7 @@ abstract class JdbcDatabase implements Database<Connection> {
+ " handshakePublicKey _BINARY," // Null if key is unknown
+ " localAuthorId _HASH NOT NULL,"
+ " verified BOOLEAN NOT NULL,"
+ " syncVersions _BINARY DEFAULT '00' NOT NULL,"
+ " PRIMARY KEY (contactId),"
+ " syncVersions _BINARY DEFAULT x'00' NOT NULL,"
+ " FOREIGN KEY (localAuthorId)"
+ " REFERENCES localAuthors (authorId)"
+ " ON DELETE CASCADE)";
@@ -295,11 +294,11 @@ abstract class JdbcDatabase implements Database<Connection> {
+ " active BOOLEAN NOT NULL,"
+ " rootKey _SECRET," // Null for rotation keys
+ " alice BOOLEAN," // Null for rotation keys
+ " PRIMARY KEY (transportId, keySetId),"
// FIXME: Primary key has changed, migration needed
+ " FOREIGN KEY (transportId)"
+ " REFERENCES transports (transportId)"
+ " ON DELETE CASCADE,"
+ " UNIQUE (keySetId),"
// FIXME: Unique constraint removed, migration needed
+ " FOREIGN KEY (contactId)"
+ " REFERENCES contacts (contactId)"
+ " ON DELETE CASCADE,"
@@ -358,6 +357,85 @@ abstract class JdbcDatabase implements Database<Connection> {
"CREATE INDEX IF NOT EXISTS messagesByCleanupDeadline"
+ " ON messages (cleanupDeadline)";
// FIXME: Migration needs to add new index
private static final String INDEX_OUTGOING_KEYS_BY_TRANSPORT_ID_KEY_SET_ID =
"CREATE INDEX IF NOT EXISTS outgoingKeysByTransportIdKeySetId"
+ " ON outgoingKeys (transportId, keySetId)";
private static final String FOREIGN_INDEX_CONTACTS_BY_LOCAL_AUTHOR_ID =
"CREATE INDEX IF NOT EXISTS contactsByLocalAuthorId"
+ " ON contacts (localAuthorId)";
private static final String FOREIGN_INDEX_GROUP_METADATA_BY_GROUP_ID =
"CREATE INDEX IF NOT EXISTS groupMetadataByGroupId"
+ " ON groupMetadata (groupId)";
private static final String FOREIGN_INDEX_GROUP_VISIBILITIES_BY_CONTACT_ID =
"CREATE INDEX IF NOT EXISTS groupVisibilitiesByContactId"
+ " ON groupVisibilities (contactId)";
private static final String FOREIGN_INDEX_GROUP_VISIBILITIES_BY_GROUP_ID =
"CREATE INDEX IF NOT EXISTS groupVisibilitiesByGroupId"
+ " ON groupVisibilities (groupId)";
private static final String FOREIGN_INDEX_MESSAGES_BY_GROUP_ID =
"CREATE INDEX IF NOT EXISTS messagesByGroupId"
+ " ON messages (groupId)";
private static final String FOREIGN_INDEX_MESSAGE_METADATA_BY_MESSAGE_ID =
"CREATE INDEX IF NOT EXISTS messageMetadataByMessageId"
+ " ON messageMetadata (messageId)";
private static final String FOREIGN_INDEX_MESSAGE_METADATA_BY_GROUP_ID =
"CREATE INDEX IF NOT EXISTS messageMetadataByGroupId"
+ " ON messageMetadata (groupId)";
private static final String FOREIGN_INDEX_MESSAGE_DEPENDENCIES_BY_GROUP_ID =
"CREATE INDEX IF NOT EXISTS messageDependenciesByGroupId"
+ " ON messageDependencies (groupId)";
private static final String
FOREIGN_INDEX_MESSAGE_DEPENDENCIES_BY_MESSAGE_ID =
"CREATE INDEX IF NOT EXISTS messageDependenciesByMessageId"
+ " ON messageDependencies (messageId)";
private static final String FOREIGN_INDEX_OFFERS_BY_CONTACT_ID =
"CREATE INDEX IF NOT EXISTS offersByContactId"
+ " ON offers (contactId)";
private static final String FOREIGN_INDEX_STATUSES_BY_MESSAGE_ID =
"CREATE INDEX IF NOT EXISTS statusesByMessageId"
+ " ON statuses (messageId)";
private static final String FOREIGN_INDEX_STATUSES_BY_CONTACT_ID =
"CREATE INDEX IF NOT EXISTS statusesByContactId"
+ " ON statuses (contactId)";
private static final String FOREIGN_INDEX_STATUSES_BY_GROUP_ID =
"CREATE INDEX IF NOT EXISTS statusesByGroupId"
+ " ON statuses (groupId)";
private static final String FOREIGN_INDEX_OUTGOING_KEYS_BY_TRANSPORT_ID =
"CREATE INDEX IF NOT EXISTS outgoingKeysByTransportId"
+ " ON outgoingKeys (transportId)";
private static final String FOREIGN_INDEX_OUTGOING_KEYS_BY_CONTACT_ID =
"CREATE INDEX IF NOT EXISTS outgoingKeysByContactId"
+ " ON outgoingKeys (contactId)";
private static final String
FOREIGN_INDEX_OUTGOING_KEYS_BY_PENDING_CONTACT_ID =
"CREATE INDEX IF NOT EXISTS outgoingKeysByPendingContactId"
+ " ON outgoingKeys (pendingContactId)";
private static final String FOREIGN_INDEX_INCOMING_KEYS_BY_TRANSPORT_ID =
"CREATE INDEX IF NOT EXISTS incomingKeysByTransportId"
+ " ON incomingKeys (transportId)";
private static final String FOREIGN_INDEX_INCOMING_KEYS_BY_KEY_SET_ID =
"CREATE INDEX IF NOT EXISTS incomingKeysByKeySetId"
+ " ON incomingKeys (keySetId)";
private static final Logger LOG =
getLogger(JdbcDatabase.class.getName());
@@ -393,6 +471,7 @@ abstract class JdbcDatabase implements Database<Connection> {
}
protected void open(String driverClass, boolean reopen,
boolean createForeignKeyIndexes,
@SuppressWarnings("unused") SecretKey key,
@Nullable MigrationListener listener) throws DbException {
// Load the JDBC driver
@@ -419,7 +498,7 @@ abstract class JdbcDatabase implements Database<Connection> {
if (LOG.isLoggable(INFO)) {
LOG.info("db dirty? " + wasDirtyOnInitialisation);
}
createIndexes(txn);
createIndexes(txn, createForeignKeyIndexes);
setDirty(txn, true);
commitTransaction(txn);
} catch (DbException e) {
@@ -552,7 +631,8 @@ abstract class JdbcDatabase implements Database<Connection> {
}
}
private void createIndexes(Connection txn) throws DbException {
private void createIndexes(Connection txn, boolean createForeignKeyIndexes)
throws DbException {
Statement s = null;
try {
s = txn.createStatement();
@@ -564,6 +644,31 @@ abstract class JdbcDatabase implements Database<Connection> {
s.executeUpdate(INDEX_STATUSES_BY_CONTACT_ID_TIMESTAMP);
s.executeUpdate(INDEX_STATUSES_BY_CONTACT_ID_TX_COUNT_TIMESTAMP);
s.executeUpdate(INDEX_MESSAGES_BY_CLEANUP_DEADLINE);
s.executeUpdate(INDEX_OUTGOING_KEYS_BY_TRANSPORT_ID_KEY_SET_ID);
// Some DB implementations automatically create indexes on columns
// that are foreign keys, others don't
if (createForeignKeyIndexes) {
s.executeUpdate(FOREIGN_INDEX_CONTACTS_BY_LOCAL_AUTHOR_ID);
s.executeUpdate(FOREIGN_INDEX_GROUP_METADATA_BY_GROUP_ID);
s.executeUpdate(FOREIGN_INDEX_GROUP_VISIBILITIES_BY_CONTACT_ID);
s.executeUpdate(FOREIGN_INDEX_GROUP_VISIBILITIES_BY_GROUP_ID);
s.executeUpdate(FOREIGN_INDEX_MESSAGES_BY_GROUP_ID);
s.executeUpdate(FOREIGN_INDEX_MESSAGE_METADATA_BY_MESSAGE_ID);
s.executeUpdate(FOREIGN_INDEX_MESSAGE_METADATA_BY_GROUP_ID);
s.executeUpdate(FOREIGN_INDEX_MESSAGE_DEPENDENCIES_BY_GROUP_ID);
s.executeUpdate(
FOREIGN_INDEX_MESSAGE_DEPENDENCIES_BY_MESSAGE_ID);
s.executeUpdate(FOREIGN_INDEX_OFFERS_BY_CONTACT_ID);
s.executeUpdate(FOREIGN_INDEX_STATUSES_BY_MESSAGE_ID);
s.executeUpdate(FOREIGN_INDEX_STATUSES_BY_CONTACT_ID);
s.executeUpdate(FOREIGN_INDEX_STATUSES_BY_GROUP_ID);
s.executeUpdate(FOREIGN_INDEX_OUTGOING_KEYS_BY_TRANSPORT_ID);
s.executeUpdate(FOREIGN_INDEX_OUTGOING_KEYS_BY_CONTACT_ID);
s.executeUpdate(
FOREIGN_INDEX_OUTGOING_KEYS_BY_PENDING_CONTACT_ID);
s.executeUpdate(FOREIGN_INDEX_INCOMING_KEYS_BY_TRANSPORT_ID);
s.executeUpdate(FOREIGN_INDEX_INCOMING_KEYS_BY_KEY_SET_ID);
}
s.close();
} catch (SQLException e) {
tryToClose(s, LOG, WARNING);
@@ -1914,6 +2019,38 @@ abstract class JdbcDatabase implements Database<Connection> {
}
}
@Override
public Collection<String> explainGetMessageIds(Connection txn, GroupId g)
throws DbException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = dbTypes.replaceTypes("_EXPLAIN SELECT messageId"
+ " FROM messages"
+ " WHERE groupId = ? AND state = ?");
ps = txn.prepareStatement(sql);
ps.setBytes(1, g.getBytes());
ps.setInt(2, DELIVERED.getValue());
rs = ps.executeQuery();
int cols = rs.getMetaData().getColumnCount();
List<String> explanation = new ArrayList<>();
while (rs.next()) {
StringBuilder sb = new StringBuilder();
for (int i = 1; i <= cols; i++) {
sb.append(rs.getString(i)).append(' ');
}
explanation.add(sb.toString());
}
rs.close();
ps.close();
return explanation;
} catch (SQLException e) {
tryToClose(rs, LOG, WARNING);
tryToClose(ps, LOG, WARNING);
throw new DbException(e);
}
}
@Override
public Collection<MessageId> getMessageIds(Connection txn, GroupId g,
Metadata query) throws DbException {
@@ -2597,6 +2734,9 @@ abstract class JdbcDatabase implements Database<Connection> {
PublicKey publicKey = new AgreementPublicKey(rs.getBytes(1));
String alias = rs.getString(2);
long timestamp = rs.getLong(3);
if (rs.next()) throw new DbStateException();
rs.close();
ps.close();
return new PendingContact(p, publicKey, alias, timestamp);
} catch (SQLException e) {
tryToClose(rs, LOG, WARNING);

View File

@@ -0,0 +1,117 @@
package org.briarproject.bramble.db;
import org.briarproject.bramble.api.crypto.SecretKey;
import org.briarproject.bramble.api.db.DatabaseConfig;
import org.briarproject.bramble.api.db.DbClosedException;
import org.briarproject.bramble.api.db.DbException;
import org.briarproject.bramble.api.db.MigrationListener;
import org.briarproject.bramble.api.sync.MessageFactory;
import org.briarproject.bramble.api.system.Clock;
import org.briarproject.nullsafety.NotNullByDefault;
import org.sqlite.mc.SQLiteMCSqlCipherConfig;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
import java.util.logging.Logger;
import javax.annotation.Nullable;
import javax.inject.Inject;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING;
import static java.util.logging.Logger.getLogger;
import static org.briarproject.bramble.db.JdbcUtils.tryToClose;
import static org.briarproject.bramble.util.IoUtils.isNonEmptyDirectory;
/**
* Contains all the SQLite-specific code for the database.
*/
@NotNullByDefault
class SqliteDatabase extends JdbcDatabase {
private static final Logger LOG = getLogger(SqliteDatabase.class.getName());
private static final String HASH_TYPE = "BLOB";
private static final String SECRET_TYPE = "BLOB";
private static final String BINARY_TYPE = "BLOB";
private static final String COUNTER_TYPE =
"INTEGER PRIMARY KEY AUTOINCREMENT";
private static final String STRING_TYPE = "VARCHAR";
private static final String EXPLAIN_COMMAND = "EXPLAIN QUERY PLAN";
private static final DatabaseTypes dbTypes = new DatabaseTypes(HASH_TYPE,
SECRET_TYPE, BINARY_TYPE, COUNTER_TYPE, STRING_TYPE,
EXPLAIN_COMMAND);
private final DatabaseConfig config;
private final String url;
@Nullable
private volatile Properties properties = null;
@Inject
SqliteDatabase(DatabaseConfig config, MessageFactory messageFactory,
Clock clock) {
super(dbTypes, messageFactory, clock);
this.config = config;
File dir = config.getDatabaseDirectory();
String path = new File(dir, "db").getAbsolutePath();
url = "jdbc:sqlite:" + path + "?cipher=sqlcipher";
}
@Override
public boolean open(SecretKey key, @Nullable MigrationListener listener)
throws DbException {
properties = SQLiteMCSqlCipherConfig.getDefault()
.withHexKey(key.getBytes())
.build()
.toProperties();
File dir = config.getDatabaseDirectory();
boolean reopen = isNonEmptyDirectory(dir);
if (LOG.isLoggable(INFO)) LOG.info("Reopening DB: " + reopen);
if (!reopen && dir.mkdirs()) LOG.info("Created database directory");
super.open("org.sqlite.JDBC", reopen, true, key, listener);
return reopen;
}
@Override
public void close() throws DbException {
Connection c = null;
try {
c = createConnection();
setDirty(c, false);
c.close();
closeAllConnections();
} catch (SQLException e) {
tryToClose(c, LOG, WARNING);
throw new DbException(e);
}
}
@Override
protected Connection createConnection() throws DbException, SQLException {
Properties properties = this.properties;
if (properties == null) throw new DbClosedException();
Connection c = DriverManager.getConnection(url, properties);
Statement s = null;
try {
s = c.createStatement();
s.execute("PRAGMA foreign_keys = ON");
s.execute("PRAGMA secure_delete = ON");
s.close();
} catch (SQLException e) {
tryToClose(s, LOG, WARNING);
tryToClose(c, LOG, WARNING);
throw new DbException(e);
}
return c;
}
@Override
protected void compactAndClose() throws DbException {
close();
}
}

View File

@@ -0,0 +1,37 @@
package org.briarproject.bramble.db;
import org.briarproject.bramble.api.db.DatabaseConfig;
import org.briarproject.bramble.api.sync.MessageFactory;
import org.briarproject.bramble.api.system.Clock;
import org.junit.BeforeClass;
import java.sql.Connection;
import static org.briarproject.bramble.test.TestUtils.isOptionalTestEnabled;
import static org.junit.Assume.assumeTrue;
public class H2SqliteDatabasePerformanceComparisonTest
extends DatabasePerformanceComparisonTest {
@BeforeClass
public static void setUpClass() {
assumeTrue(isOptionalTestEnabled(
H2SqliteDatabasePerformanceComparisonTest.class));
}
@Override
Database<Connection> createDatabase(boolean conditionA,
DatabaseConfig databaseConfig, MessageFactory messageFactory,
Clock clock) {
if (conditionA) {
return new H2Database(databaseConfig, messageFactory, clock);
} else {
return new SqliteDatabase(databaseConfig, messageFactory, clock);
}
}
@Override
protected String getTestName() {
return getClass().getSimpleName();
}
}

View File

@@ -10,14 +10,21 @@ import static org.junit.Assume.assumeTrue;
public class HyperSqlDatabaseTest extends JdbcDatabaseTest {
@Override
@Before
public void setUp() {
assumeTrue(isCryptoStrengthUnlimited());
super.setUp();
}
@Override
protected JdbcDatabase createDatabase(DatabaseConfig config,
MessageFactory messageFactory, Clock clock) {
return new HyperSqlDatabase(config, messageFactory ,clock);
return new HyperSqlDatabase(config, messageFactory, clock);
}
@Override
public void testExplainGetMessageIds() {
// Ugh, HSQLDB can't handle EXPLAIN PLAN FOR in prepared statements
}
}

View File

@@ -2500,6 +2500,21 @@ public abstract class JdbcDatabaseTest extends BrambleTestCase {
assertEquals(NO_CLEANUP_DEADLINE, db.getNextCleanupDeadline(txn));
}
// FIXME: Remove
@Test
public void testExplainGetMessageIds() throws Exception {
Database<Connection> db = open(false);
Connection txn = db.startTransaction();
db.addGroup(txn, group);
Collection<String> explanation = db.explainGetMessageIds(txn, groupId);
db.commitTransaction(txn);
db.close();
System.out.println("getMessageIds(T, GroupId)");
for (String line : explanation) System.out.println(line);
System.out.println();
}
private Database<Connection> open(boolean resume) throws Exception {
return open(resume, new TestMessageFactory(), new SystemClock());
}

View File

@@ -0,0 +1,25 @@
package org.briarproject.bramble.db;
import org.briarproject.bramble.api.db.DatabaseConfig;
import org.briarproject.bramble.api.sync.MessageFactory;
import org.briarproject.bramble.api.system.Clock;
import org.junit.Before;
import static org.briarproject.bramble.test.TestUtils.isCryptoStrengthUnlimited;
import static org.junit.Assume.assumeTrue;
public class SqliteDatabaseTest extends JdbcDatabaseTest {
@Override
@Before
public void setUp() {
assumeTrue(isCryptoStrengthUnlimited());
super.setUp();
}
@Override
protected JdbcDatabase createDatabase(DatabaseConfig config,
MessageFactory messageFactory, Clock clock) {
return new SqliteDatabase(config, messageFactory, clock);
}
}

View File

@@ -24,6 +24,7 @@ dependencyVerification {
'com.squareup.okio:okio-jvm:3.0.0:okio-jvm-3.0.0.jar:be64a0cc1f28ea9cd5c970dd7e7557af72c808d738c495b397bf897c9921e907',
'com.squareup:javapoet:1.13.0:javapoet-1.13.0.jar:4c7517e848a71b36d069d12bb3bf46a70fd4cda3105d822b0ed2e19c00b69291',
'com.squareup:kotlinpoet:1.11.0:kotlinpoet-1.11.0.jar:2887ada1ca03dd83baa2758640d87e840d1907564db0ef88d2289c868a980492',
'io.github.willena:sqlite-jdbc:3.41.2.1:sqlite-jdbc-3.41.2.1.jar:fb60e7137c1791db89240701338d31ca42a0bec5508c1aab1c1131cf885f2309',
'javax.inject:javax.inject:1:javax.inject-1.jar:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
'junit:junit:4.13.2:junit-4.13.2.jar:8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3',
'net.bytebuddy:byte-buddy:1.9.12:byte-buddy-1.9.12.jar:3688c3d434bebc3edc5516296a2ed0f47b65e451071b4afecad84f902f0efc11',

View File

@@ -21,22 +21,31 @@ android {
packagingOptions {
doNotStrip '**/*.so'
jniLibs {
// Unpack native libs from the APK rather than using them in-place. We package the
// Tor binaries as native libs and need them to be unpacked so we can execute them
useLegacyPackaging = true
}
}
defaultConfig {
// FIXME: sqlite-jdbc-crypt uses __register_atfork which is only available on API >= 23.
// We might be able to solve this by recompiling (or asking upstream to recompile)
minSdkVersion 21
targetSdkVersion 33
versionCode 10507
versionName "1.5.7"
versionCode 10506
versionName "1.5.6"
applicationId "org.briarproject.briar.android"
buildConfigField "String", "TorVersion", "\"$tor_version\""
vectorDrawables.useSupportLibrary = true
buildConfigField "String", "TorVersion", "\"$tor_version\""
buildConfigField "String", "GitHash",
"\"${getStdout(['git', 'rev-parse', '--short=7', 'HEAD'], 'No commit hash')}\""
def now = (long) (System.currentTimeMillis() / 1000)
buildConfigField "Long", "BuildTimestamp",
"${getStdout(['git', 'log', '-n', '1', '--format=%ct'], now)}000L"
testInstrumentationRunner 'org.briarproject.briar.android.BriarTestRunner'
testInstrumentationRunnerArguments disableAnalytics: 'true'
}
@@ -78,6 +87,7 @@ android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
coreLibraryDesugaringEnabled true
}
testOptions {
@@ -97,6 +107,10 @@ android {
}
}
// Workaround for https://github.com/gradle/gradle/issues/20330 to make gradle-witness work
// with Android Gradle Plugin 7.4
project.evaluationDependsOn(project.getRootProject().findProject("bramble-android").getPath())
dependencies {
// In theory this dependency shouldn't be needed, but without it Android Studio's linter will
// complain about unresolved symbols for bramble-api test classes in briar-android tests,
@@ -143,6 +157,8 @@ dependencies {
compileOnly 'javax.annotation:jsr250-api:1.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
testImplementation project(path: ':bramble-api', configuration: 'testOutput')
testImplementation project(path: ':bramble-core', configuration: 'testOutput')

View File

@@ -25,8 +25,9 @@
-dontnote com.android.org.conscrypt.SSLParametersImpl
-dontnote org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
-dontnote sun.security.ssl.SSLContextImpl
-dontwarn org.conscrypt.OpenSSLProvider
-dontwarn org.conscrypt.Conscrypt
-dontwarn org.bouncycastle.jsse.**
-dontwarn org.conscrypt.**
-dontwarn org.openjsse.**
# HTML sanitiser
-keep class org.jsoup.safety.Whitelist

View File

@@ -150,7 +150,8 @@ public class AppModule {
//FIXME: StrictMode
StrictMode.ThreadPolicy tp = StrictMode.allowThreadDiskReads();
StrictMode.allowThreadDiskWrites();
File dbDir = app.getApplicationContext().getDir("db", MODE_PRIVATE);
File dbDir = app.getApplicationContext().getDir("db_sqlite",
MODE_PRIVATE);
File keyDir = app.getApplicationContext().getDir("key", MODE_PRIVATE);
StrictMode.setThreadPolicy(tp);
KeyStrengthener keyStrengthener = SDK_INT >= 23

View File

@@ -1,6 +1,5 @@
package org.briarproject.briar.android.contact.add.remote;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.os.Bundle;
@@ -21,7 +20,6 @@ import org.briarproject.briar.android.view.InfoView;
import org.briarproject.nullsafety.MethodsNotNullByDefault;
import org.briarproject.nullsafety.ParametersNotNullByDefault;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import javax.annotation.Nullable;
@@ -31,12 +29,8 @@ import androidx.core.app.ShareCompat.IntentBuilder;
import androidx.lifecycle.ViewModelProvider;
import static android.content.Context.CLIPBOARD_SERVICE;
import static android.widget.Toast.LENGTH_LONG;
import static android.widget.Toast.LENGTH_SHORT;
import static java.util.logging.Level.WARNING;
import static java.util.logging.Logger.getLogger;
import static org.briarproject.bramble.api.contact.HandshakeLinkConstants.LINK_REGEX;
import static org.briarproject.bramble.util.LogUtils.logException;
import static org.briarproject.briar.android.util.UiUtils.hideViewOnSmallScreen;
import static org.briarproject.briar.android.util.UiUtils.observeOnce;
@@ -45,7 +39,6 @@ import static org.briarproject.briar.android.util.UiUtils.observeOnce;
public class LinkExchangeFragment extends BaseFragment {
private static final String TAG = LinkExchangeFragment.class.getName();
private static final Logger LOG = getLogger(TAG);
@Inject
ViewModelProvider.Factory viewModelFactory;
@@ -123,18 +116,11 @@ public class LinkExchangeFragment extends BaseFragment {
copyButton.setEnabled(true);
Button shareButton = v.findViewById(R.id.shareButton);
shareButton.setOnClickListener(view -> {
try {
shareButton.setOnClickListener(view ->
IntentBuilder.from(requireActivity())
.setText(link)
.setType("text/plain")
.startChooser();
} catch (ActivityNotFoundException e) {
logException(LOG, WARNING, e);
Toast.makeText(requireContext(),
R.string.error_start_activity, LENGTH_LONG).show();
}
});
.startChooser());
shareButton.setEnabled(true);
InfoView infoText = v.findViewById(R.id.infoView);

View File

@@ -152,7 +152,6 @@ Vänlige installera Briar på en nyare enhet.</string>
<string name="error_start_activity">Otillgänglig på ditt system</string>
<string name="status_heading">Status</string>
<string name="error">Fel</string>
<string name="info">Information</string>
<!--Contacts and Private Conversations-->
<string name="no_contacts">Inga kontakter</string>
<string name="no_contacts_action">Tryck på plus-ikonen (+) för att lägga till en kontakt</string>
@@ -223,7 +222,6 @@ Vänlige installera Briar på en nyare enhet.</string>
<string name="menu_contact">Kontakt</string>
<!--Adding Contacts-->
<string name="add_contact_title">Lägg till en närvarande kontakt</string>
<string name="add_contact_error_two_way">Skannade ni båda varandras QR-koder?</string>
<string name="face_to_face">Du måste personligen träffa den som du vill lägga till som kontakt.\n\nDetta för att undvika att någon senare låtsas vara du eller läser dina meddelanden.</string>
<string name="continue_button">Fortsätt</string>
<string name="try_again_button">Försök igen</string>
@@ -231,11 +229,9 @@ Vänlige installera Briar på en nyare enhet.</string>
<string name="exchanging_contact_details">Utbyter detaljer om kontakten\u2026</string>
<string name="contact_added_toast">Kontakt tillagd: %s</string>
<string name="contact_already_exists">Kontakten %s finns redan</string>
<string name="contact_already_exists_general">Kontakten finns redan</string>
<string name="qr_code_invalid">QR-koden är felaktig</string>
<string name="qr_code_too_old_1">QR-koden som du har skannat kommer från en äldre version av Briar.\n\nVar vänlig och be din kontakt att uppgradera till den senaste versionen och försök sedan igen.</string>
<string name="qr_code_too_new_1">QR-koden som du har skannat kommer från en äldre version av Briar.\n\nVänligen uppgradera till den senaste versionen och försök igen.</string>
<string name="mailbox_qr_code_for_contact">QR-koden du skannade kommer från Briar Mailbox.\n\nOm du vill länka en Mailbox, välj Inställningar &gt; Mailbox från Briar-menyn.</string>
<string name="camera_error">Kamerafel</string>
<string name="connecting_to_device">Ansluter till enhet\u2026</string>
<string name="authenticating_with_device">Autentiserar med enhet\u2026</string>

View File

@@ -474,7 +474,7 @@
<string name="blogs_rss_feeds_import_progress">导入 RSS 订阅源中…</string>
<string name="blogs_rss_feeds_import_error">抱歉!导入订阅源时发生错误。</string>
<string name="blogs_rss_feeds_import_title">从文件导入源</string>
<string name="blogs_rss_feeds">RSS </string>
<string name="blogs_rss_feeds">RSS源 </string>
<string name="blogs_rss_feeds_manage_imported">已导入:</string>
<string name="blogs_rss_feeds_manage_author">作者:</string>
<string name="blogs_rss_feeds_manage_updated">最后更新于:</string>
@@ -676,8 +676,6 @@
<string name="disappearing_messages_summary">在7\u00A0天之后使此对话中的后续消息自动消失。</string>
<!--Settings Actions-->
<string name="pref_category_actions">操作</string>
<string name="share_app_link">分享下载链接</string>
<string name="share_app_link_text">Briar 下载地址 %s</string>
<string name="send_feedback">提交反馈</string>
<!--Link Warning-->
<string name="link_warning_title">链接警告</string>
@@ -727,7 +725,6 @@
<string name="permission_camera_title">相机权限</string>
<string name="permission_camera_request_body">Briar 需要获得相机权限以扫描二维码。</string>
<string name="permission_location_title">位置权限</string>
<string name="permission_nearby_devices_title">“附近设备”权限</string>
<string name="permission_location_request_body">Briar 需要位置信息权限以发现蓝牙设备。\n\nBriar 不会存储您的位置或将它分享给任何人。</string>
<string name="permission_camera_location_title">相机和位置</string>
<string name="permission_camera_location_request_body"> Briar 需要相机权限以扫描二维码。\n\nBriar 需要位置信息权限以发现蓝牙设备。\n\nBriar 不会存储您的位置或将它分享给任何人。</string>
@@ -767,8 +764,6 @@
<string name="permission_hotspot_location_request_precise_body">要创建无线热点Briar 需要访问你的精确位置。\n\nBriar 不会储存你的位置也不会和任何人分享它。</string>
<string name="permission_hotspot_location_denied_body">你拒绝了访问你的位置,但 Briar 需要这个权限才能创建 Wi-Fi 热点。\n\n请考虑授予访问权限。</string>
<string name="permission_hotspot_location_denied_precise_body">你拒绝了 Briar 访问你的精确位置,但 Briar 需要这个权限才能创建 无线热点。\n\n请考虑授予访问权限。</string>
<string name="permission_hotspot_nearby_wifi_request_body">要创建 Wi-FI 热点Briar 需要访问附近设备的权限。</string>
<string name="permission_hotspot_nearby_wifi_denied_body">你已拒绝对附近设备的访问,但 Briar 需要此权限在创建 Wi-FI 热点。\n\n请考虑授予权限。</string>
<string name="wifi_settings_title">Wi-Fi 设置</string>
<string name="wifi_settings_request_enable_body">要创建 Wi-Fi 热点Briar 需要使用 Wi-Fi。请允许它。</string>
<string name="hotspot_tab_manual">手动</string>

View File

@@ -87,6 +87,8 @@ dependencyVerification {
'androidx.window:window:1.0.0:window-1.0.0.aar:3212985be4127373ca4d0ea7f8b81a250ae2105e924f7940105d067a0f9ac130',
'cglib:cglib:3.2.8:cglib-3.2.8.jar:3f64de999ecc5595dc84ca8ff0879d8a34c8623f9ef3c517a53ed59023fcb9db',
'com.almworks.sqlite4java:sqlite4java:1.0.392:sqlite4java-1.0.392.jar:243a64470fda0e86a6fddeb0af4c7aa9426ce84e68cbfe18d75ee5da4b7e0b92',
'com.android.tools:desugar_jdk_libs:2.0.3:desugar_jdk_libs-2.0.3.jar:7f4e68385dfe88eba4344ff71912912bdc731806b9b2ce4a12bef9aa6a7d4565',
'com.android.tools:desugar_jdk_libs_configuration:2.0.3:desugar_jdk_libs_configuration-2.0.3.jar:9f834a20ca4e1376522afe7bf523d3f1d5e9ad9bb0214b534ee79cc8481b4fc5',
'com.github.bumptech.glide:annotations:4.14.2:annotations-4.14.2.jar:8419bf262be70edeb6b9582b386546be66d2e8659c7aae65fd69a9ede02c4877',
'com.github.bumptech.glide:compiler:4.14.2:compiler-4.14.2.jar:315b1325283c3d0cf9bc0599c1ecdb85e5f7863b1aa25991b63d616b13930cb6',
'com.github.bumptech.glide:gifdecoder:4.14.2:gifdecoder-4.14.2.aar:d021eee1ac1a036fcdc377b6dc3b218f4a0cc2bc2f096d69b474198b635e8302',
@@ -148,10 +150,10 @@ dependencyVerification {
'org.hamcrest:hamcrest-library:1.3:hamcrest-library-1.3.jar:711d64522f9ec410983bd310934296da134be4254a125080a0416ec178dfad1c',
'org.hamcrest:hamcrest-library:2.1:hamcrest-library-2.1.jar:b7e2b6895b3b679f0e47b6380fda391b225e9b78505db9d8bdde8d3cc8d52a21',
'org.hamcrest:hamcrest:2.1:hamcrest-2.1.jar:ba93b2e3a562322ba432f0a1b53addcc55cb188253319a020ed77f824e692050',
'org.jacoco:org.jacoco.agent:0.8.7:org.jacoco.agent-0.8.7.jar:9cbcc986e0fbe821a78ff1f8f7d5216f200e5eb124e7f6837d1dc4a77b28b143',
'org.jacoco:org.jacoco.ant:0.8.7:org.jacoco.ant-0.8.7.jar:97ca96a382c3f23a44d8eb4c4e6c3742a30cb8005774a76ced0fc4806ce49605',
'org.jacoco:org.jacoco.core:0.8.7:org.jacoco.core-0.8.7.jar:ad7739b5fb5969aa1a8aead3d74ed54dc82ed012f1f10f336bd1b96e71c1a13c',
'org.jacoco:org.jacoco.report:0.8.7:org.jacoco.report-0.8.7.jar:cc89258623700a6c932592153cb528785876b6da183d5431f97efbba6f020e5b',
'org.jacoco:org.jacoco.agent:0.8.8:org.jacoco.agent-0.8.8.jar:072ecbd496896623899a696fff12c01c1615f737616d2792e6d0e10cdf8a610d',
'org.jacoco:org.jacoco.ant:0.8.8:org.jacoco.ant-0.8.8.jar:02e33bd2c48dc0be67c2fea84d43beececfd400da6797c58153253d4c30aca15',
'org.jacoco:org.jacoco.core:0.8.8:org.jacoco.core-0.8.8.jar:474c782f809d88924713dfdbf0acb79d330f904be576484803463d0465611643',
'org.jacoco:org.jacoco.report:0.8.8:org.jacoco.report-0.8.8.jar:2c129110f3e3fcaa1f8179578ea3894586199cb0826be5c7790278084c9622a9',
'org.jetbrains.kotlin:kotlin-reflect:1.6.10:kotlin-reflect-1.6.10.jar:3277ac102ae17aad10a55abec75ff5696c8d109790396434b496e75087854203',
'org.jetbrains.kotlin:kotlin-stdlib-common:1.7.0:kotlin-stdlib-common-1.7.0.jar:59c6ff64fe9a6604afce03e8aaa75f83586c6030ac71fb0b34ee7cdefed3618f',
'org.jetbrains.kotlin:kotlin-stdlib-common:1.8.20:kotlin-stdlib-common-1.8.20.jar:fa20188abaa8ecf1d0035e93a969b071f10e45a1c8378c314521eade73f75fd5',
@@ -174,14 +176,10 @@ dependencyVerification {
'org.mockito:mockito-core:5.1.1:mockito-core-5.1.1.jar:447bdedceaef4107c50db3d33e252bf030c6ae0e46454b40dbcfc0dfbf041264',
'org.nanohttpd:nanohttpd:2.3.1:nanohttpd-2.3.1.jar:de864c47818157141a24c9acb36df0c47d7bf15b7ff48c90610f3eb4e5df0e58',
'org.objenesis:objenesis:3.3:objenesis-3.3.jar:02dfd0b0439a5591e35b708ed2f5474eb0948f53abf74637e959b8e4ef69bfeb',
'org.ow2.asm:asm-analysis:9.1:asm-analysis-9.1.jar:81a88041b1b8beda5a8a99646098046c48709538270c49def68abff25ac3be34',
'org.ow2.asm:asm-analysis:9.2:asm-analysis-9.2.jar:878fbe521731c072d14d2d65b983b1beae6ad06fda0007b6a8bae81f73f433c4',
'org.ow2.asm:asm-commons:9.1:asm-commons-9.1.jar:afcb26dc1fc12c0c4a99ada670908dd82e18dfc488caf5ee92546996b470c00c',
'org.ow2.asm:asm-commons:9.2:asm-commons-9.2.jar:be4ce53138a238bb522cd781cf91f3ba5ce2f6ca93ec62d46a162a127225e0a6',
'org.ow2.asm:asm-tree:9.1:asm-tree-9.1.jar:fd00afa49e9595d7646205b09cecb4a776a8ff0ba06f2d59b8f7bf9c704b4a73',
'org.ow2.asm:asm-tree:9.2:asm-tree-9.2.jar:aabf9bd23091a4ebfc109c1f3ee7cf3e4b89f6ba2d3f51c5243f16b3cffae011',
'org.ow2.asm:asm-util:9.2:asm-util-9.2.jar:ff5b3cd331ae8a9a804768280da98f50f424fef23dd3c788bb320e08c94ee598',
'org.ow2.asm:asm:9.1:asm-9.1.jar:cda4de455fab48ff0bcb7c48b4639447d4de859a7afc30a094a986f0936beba2',
'org.ow2.asm:asm:9.2:asm-9.2.jar:b9d4fe4d71938df38839f0eca42aaaa64cf8b313d678da036f0cb3ca199b47f5',
'org.robolectric:annotations:4.8.2:annotations-4.8.2.jar:998a02f2573884d017b04e1c0cc3ff3a416620daa8cc8d93d6aa15fc00b02c4b',
'org.robolectric:junit:4.8.2:junit-4.8.2.jar:eb0996f147566d722a178b1e1dcb849f69f5dbdd45a0149f10ce0d823b9e5a61',

View File

@@ -64,7 +64,7 @@ internal class HeadlessModule(private val appDir: File) {
@Provides
@Singleton
internal fun provideDatabaseConfig(): DatabaseConfig {
val dbDir = File(appDir, "db")
val dbDir = File(appDir, "db_sqlite")
val keyDir = File(appDir, "key")
return HeadlessDatabaseConfig(dbDir, keyDir)
}

View File

@@ -58,7 +58,7 @@ internal class HeadlessTestModule(private val appDir: File) {
@Provides
@Singleton
internal fun provideDatabaseConfig(): DatabaseConfig {
val dbDir = File(appDir, "db")
val dbDir = File(appDir, "db_sqlite")
val keyDir = File(appDir, "key")
return HeadlessDatabaseConfig(dbDir, keyDir)
}

View File

@@ -38,10 +38,10 @@ buildscript {
jmock_version = '2.12.0'
mockwebserver_version = '4.10.0'
onionwrapper_version = '0.0.5'
sqlite_jdbc_crypt_version = '3.41.2.1'
}
dependencies {
// upgrading this let's us run into https://github.com/gradle/gradle/issues/20330
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.7.0'
classpath files('libs/gradle-witness.jar')
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionSha256Sum=c9490e938b221daf0094982288e4038deed954a3f12fb54cbf270ddf4e37d879
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionSha256Sum=97a52d145762adc241bad7fd18289bf7f6801e08ece6badf80402fe2b9f250b1
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists