mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-27 21:24:42 +00:00
Disable inline message processing for internal users.
This commit is contained in:
committed by
Alex Hart
parent
f06817f00d
commit
58a32c11ec
@@ -1,10 +1,5 @@
|
||||
package org.thoughtcrime.securesms.crypto;
|
||||
|
||||
import net.sqlcipher.database.SQLiteDatabase;
|
||||
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.whispersystems.signalservice.api.SignalSessionLock;
|
||||
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
@@ -24,26 +19,25 @@ public enum DatabaseSessionLock implements SignalSessionLock {
|
||||
|
||||
@Override
|
||||
public Lock acquire() {
|
||||
if (FeatureFlags.internalUser()) {
|
||||
SQLiteDatabase db = DatabaseFactory.getInstance(ApplicationDependencies.getApplication()).getRawDatabase();
|
||||
LEGACY_LOCK.lock();
|
||||
return LEGACY_LOCK::unlock;
|
||||
|
||||
if (db.isDbLockedByCurrentThread()) {
|
||||
return () -> {};
|
||||
}
|
||||
|
||||
db.beginTransaction();
|
||||
|
||||
ownerThreadId = Thread.currentThread().getId();
|
||||
|
||||
return () -> {
|
||||
ownerThreadId = -1;
|
||||
db.setTransactionSuccessful();
|
||||
db.endTransaction();
|
||||
};
|
||||
} else {
|
||||
LEGACY_LOCK.lock();
|
||||
return LEGACY_LOCK::unlock;
|
||||
}
|
||||
// TODO [greyson][db] Revisit after improving database locking
|
||||
// SQLiteDatabase db = DatabaseFactory.getInstance(ApplicationDependencies.getApplication()).getRawDatabase();
|
||||
//
|
||||
// if (db.isDbLockedByCurrentThread()) {
|
||||
// return () -> {};
|
||||
// }
|
||||
//
|
||||
// db.beginTransaction();
|
||||
//
|
||||
// ownerThreadId = Thread.currentThread().getId();
|
||||
//
|
||||
// return () -> {
|
||||
// ownerThreadId = -1;
|
||||
// db.setTransactionSuccessful();
|
||||
// db.endTransaction();
|
||||
// };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -100,11 +100,7 @@ public class IncomingMessageProcessor {
|
||||
}
|
||||
|
||||
private @Nullable String processMessage(@NonNull SignalServiceEnvelope envelope) {
|
||||
if (FeatureFlags.internalUser()) {
|
||||
return processMessageInline(envelope);
|
||||
} else {
|
||||
return processMessageDeferred(envelope);
|
||||
}
|
||||
return processMessageDeferred(envelope);
|
||||
}
|
||||
|
||||
private @Nullable String processMessageDeferred(@NonNull SignalServiceEnvelope envelope) {
|
||||
|
||||
Reference in New Issue
Block a user