mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-11 20:43:34 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3e9f98273 | ||
|
|
9a3faae731 | ||
|
|
82e8cb87c1 | ||
|
|
9bdcc9e3d8 | ||
|
|
daee747338 | ||
|
|
535a163f00 | ||
|
|
bd61b91722 | ||
|
|
a0c1b072b6 | ||
|
|
fe806cc4eb | ||
|
|
aacad78cdb | ||
|
|
b89f2dd862 | ||
|
|
36d01477cc | ||
|
|
e4090d00c9 |
@@ -46,15 +46,15 @@ ktlint {
|
||||
version = "0.47.1"
|
||||
}
|
||||
|
||||
def canonicalVersionCode = 1271
|
||||
def canonicalVersionName = "6.22.4"
|
||||
def canonicalVersionCode = 1272
|
||||
def canonicalVersionName = "6.22.8"
|
||||
|
||||
def postFixSize = 100
|
||||
def abiPostFix = ['universal' : 0,
|
||||
'armeabi-v7a' : 1,
|
||||
'arm64-v8a' : 2,
|
||||
'x86' : 3,
|
||||
'x86_64' : 4]
|
||||
def abiPostFix = ['universal' : 15,
|
||||
'armeabi-v7a' : 16,
|
||||
'arm64-v8a' : 17,
|
||||
'x86' : 18,
|
||||
'x86_64' : 19]
|
||||
|
||||
def keystores = [ 'debug' : loadKeystoreProperties('keystore.debug.properties') ]
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -81,46 +81,31 @@ private class BluetoothVoiceNoteUtilLegacy(val context: Context, val listener: (
|
||||
private var hasWarnedAboutBluetooth = false
|
||||
|
||||
init {
|
||||
if (Build.VERSION.SDK_INT < 31) {
|
||||
audioHandler.post {
|
||||
signalBluetoothManager.start()
|
||||
Log.d(TAG, "Bluetooth manager started.")
|
||||
}
|
||||
audioHandler.post {
|
||||
signalBluetoothManager.start()
|
||||
Log.d(TAG, "Bluetooth manager started.")
|
||||
}
|
||||
}
|
||||
|
||||
override fun connectBluetoothScoConnection() {
|
||||
if (Build.VERSION.SDK_INT >= 31) {
|
||||
val audioManager = ApplicationDependencies.getAndroidCallAudioManager()
|
||||
val device: AudioDeviceInfo? = audioManager.connectedBluetoothDevice
|
||||
if (device != null) {
|
||||
val result: Boolean = audioManager.setCommunicationDevice(device)
|
||||
if (result) {
|
||||
Log.d(TAG, "Successfully set Bluetooth device as active communication device.")
|
||||
} else {
|
||||
Log.d(TAG, "Found Bluetooth device but failed to set it as active communication device.")
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "Could not find Bluetooth device in list of communications devices, falling back to current input.")
|
||||
audioHandler.post {
|
||||
if (signalBluetoothManager.state.shouldUpdate()) {
|
||||
Log.d(TAG, "Bluetooth manager updating devices.")
|
||||
signalBluetoothManager.updateDevice()
|
||||
}
|
||||
listener()
|
||||
} else {
|
||||
audioHandler.post {
|
||||
if (signalBluetoothManager.state.shouldUpdate()) {
|
||||
signalBluetoothManager.updateDevice()
|
||||
}
|
||||
val currentState = signalBluetoothManager.state
|
||||
if (currentState == SignalBluetoothManager.State.AVAILABLE) {
|
||||
signalBluetoothManager.startScoAudio()
|
||||
} else {
|
||||
Log.d(TAG, "Recording from phone mic because bluetooth state was " + currentState + ", not " + SignalBluetoothManager.State.AVAILABLE)
|
||||
uiThreadHandler.post {
|
||||
if (currentState == SignalBluetoothManager.State.PERMISSION_DENIED && !hasWarnedAboutBluetooth) {
|
||||
bluetoothPermissionDeniedHandler()
|
||||
hasWarnedAboutBluetooth = true
|
||||
}
|
||||
listener()
|
||||
val currentState = signalBluetoothManager.state
|
||||
if (currentState == SignalBluetoothManager.State.AVAILABLE) {
|
||||
Log.d(TAG, "Bluetooth manager state is AVAILABLE. Starting SCO connection.")
|
||||
signalBluetoothManager.startScoAudio()
|
||||
} else {
|
||||
Log.d(TAG, "Recording from phone mic because bluetooth state was " + currentState + ", not " + SignalBluetoothManager.State.AVAILABLE)
|
||||
uiThreadHandler.post {
|
||||
if (currentState == SignalBluetoothManager.State.PERMISSION_DENIED && !hasWarnedAboutBluetooth) {
|
||||
Log.d(TAG, "Warning about Bluetooth permissions.")
|
||||
bluetoothPermissionDeniedHandler()
|
||||
hasWarnedAboutBluetooth = true
|
||||
}
|
||||
listener()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1075,25 +1075,26 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
|
||||
values.putNull(ORIGINAL_MESSAGE_ID)
|
||||
}
|
||||
|
||||
writableDatabase.beginTransaction()
|
||||
val messageId: Long
|
||||
try {
|
||||
messageId = writableDatabase.insert(TABLE_NAME, null, values)
|
||||
if (messageId < 0) {
|
||||
val messageId: Long = writableDatabase.withinTransaction {
|
||||
val id = writableDatabase.insert(TABLE_NAME, null, values)
|
||||
|
||||
if (id < 0) {
|
||||
Log.w(TAG, "Failed to insert text message (${message.sentTimestampMillis}, ${message.authorId}, ThreadId::$threadId)! Likely a duplicate.")
|
||||
return Optional.empty()
|
||||
} else {
|
||||
if (unread && editedMessage == null) {
|
||||
threads.incrementUnread(threadId, 1, 0)
|
||||
}
|
||||
|
||||
if (message.subscriptionId != -1) {
|
||||
recipients.setDefaultSubscriptionId(message.authorId, message.subscriptionId)
|
||||
}
|
||||
}
|
||||
|
||||
if (unread && editedMessage == null) {
|
||||
threads.incrementUnread(threadId, 1, 0)
|
||||
}
|
||||
id
|
||||
}
|
||||
|
||||
if (message.subscriptionId != -1) {
|
||||
recipients.setDefaultSubscriptionId(message.authorId, message.subscriptionId)
|
||||
}
|
||||
writableDatabase.setTransactionSuccessful()
|
||||
} finally {
|
||||
writableDatabase.endTransaction()
|
||||
if (messageId < 0) {
|
||||
return Optional.empty()
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
|
||||
@@ -145,7 +145,11 @@ class PushProcessMessageJobV2 private constructor(
|
||||
}
|
||||
PushProcessMessageJobV2(builder.build(), result.envelope.toBuilder().clearContent().build(), result.content, result.metadata, result.serverDeliveredTimestamp)
|
||||
} else {
|
||||
messageProcessor.process(result.envelope, result.content, result.metadata, result.serverDeliveredTimestamp)
|
||||
try {
|
||||
messageProcessor.process(result.envelope, result.content, result.metadata, result.serverDeliveredTimestamp)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Failed to process message with timestamp ${result.envelope.timestamp}. Dropping.")
|
||||
}
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public final class IncomingGroupCallActionProcessor extends DeviceAwareActionPro
|
||||
@NonNull UUID sender,
|
||||
@NonNull CallManager.RingUpdate ringUpdate)
|
||||
{
|
||||
Log.i(TAG, "handleGroupCallRingUpdate(): recipient: " + remotePeerGroup.getId() + " ring: " + ringId + " update: " + ringUpdate);
|
||||
Log.i(TAG, "handleGroupCallRingUpdate(): recipient: " + remotePeerGroup.getId() + " ring: " + Long.toHexString(ringId) + " update: " + ringUpdate);
|
||||
|
||||
Recipient recipient = remotePeerGroup.getRecipient();
|
||||
boolean updateForCurrentRingId = ringId == currentState.getCallSetupState(RemotePeer.GROUP_CALL_ID).getRingId();
|
||||
@@ -60,10 +60,10 @@ public final class IncomingGroupCallActionProcessor extends DeviceAwareActionPro
|
||||
|
||||
if (SignalDatabase.calls().isRingCancelled(ringId, remotePeerGroup.getId())) {
|
||||
try {
|
||||
Log.i(TAG, "Ignoring incoming ring request for already cancelled ring: " + ringId);
|
||||
Log.i(TAG, "Ignoring incoming ring request for already cancelled ring: " + Long.toHexString(ringId));
|
||||
webRtcInteractor.getCallManager().cancelGroupRing(groupId.getDecodedId(), ringId, null);
|
||||
} catch (CallException e) {
|
||||
Log.w(TAG, "Error while trying to cancel ring: " + ringId, e);
|
||||
Log.w(TAG, "Error while trying to cancel ring: " + Long.toHexString(ringId), e);
|
||||
}
|
||||
return currentState;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public final class IncomingGroupCallActionProcessor extends DeviceAwareActionPro
|
||||
ringUpdate);
|
||||
|
||||
if (updateForCurrentRingId && isCurrentlyRinging) {
|
||||
Log.i(TAG, "Cancelling current ring: " + ringId);
|
||||
Log.i(TAG, "Cancelling current ring: " + Long.toHexString(ringId));
|
||||
|
||||
currentState = currentState.builder()
|
||||
.changeCallInfoState()
|
||||
@@ -93,20 +93,20 @@ public final class IncomingGroupCallActionProcessor extends DeviceAwareActionPro
|
||||
|
||||
if (!updateForCurrentRingId && isCurrentlyRinging) {
|
||||
try {
|
||||
Log.i(TAG, "Already ringing so reply busy for new ring: " + ringId);
|
||||
Log.i(TAG, "Already ringing so reply busy for new ring: " + Long.toHexString(ringId));
|
||||
webRtcInteractor.getCallManager().cancelGroupRing(groupId.getDecodedId(), ringId, CallManager.RingCancelReason.Busy);
|
||||
} catch (CallException e) {
|
||||
Log.w(TAG, "Error while trying to cancel ring: " + ringId, e);
|
||||
Log.w(TAG, "Error while trying to cancel ring: " + Long.toHexString(ringId), e);
|
||||
}
|
||||
return currentState;
|
||||
}
|
||||
|
||||
if (updateForCurrentRingId) {
|
||||
Log.i(TAG, "Already ringing for ring: " + ringId);
|
||||
Log.i(TAG, "Already ringing for ring: " + Long.toHexString(ringId));
|
||||
return currentState;
|
||||
}
|
||||
|
||||
Log.i(TAG, "Requesting new ring: " + ringId);
|
||||
Log.i(TAG, "Requesting new ring: " + Long.toHexString(ringId));
|
||||
|
||||
Recipient ringerRecipient = Recipient.externalPush(ServiceId.from(sender));
|
||||
SignalDatabase.calls().insertOrUpdateGroupCallFromRingState(
|
||||
|
||||
@@ -231,6 +231,12 @@ public final class WebRtcCallService extends Service implements SignalAudioManag
|
||||
}
|
||||
|
||||
public void setCallInProgressNotification(int type, @NonNull RecipientId id) {
|
||||
if (lastNotificationId == INVALID_NOTIFICATION_ID) {
|
||||
lastNotificationId = CallNotificationBuilder.getStartingStoppingNotificationId();
|
||||
lastNotification = CallNotificationBuilder.getStartingNotification(this);
|
||||
startForegroundCompat(lastNotificationId, lastNotification);
|
||||
}
|
||||
|
||||
notificationDisposable.dispose();
|
||||
notificationDisposable = CallNotificationBuilder.getCallInProgressNotification(this, type, Recipient.resolved(id))
|
||||
.subscribe(notification -> {
|
||||
|
||||
@@ -8,18 +8,41 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public final class ImageCompressionUtil {
|
||||
|
||||
private static final String TAG = Log.tag(ImageCompressionUtil.class);
|
||||
private static final String TAG = Log.tag(ImageCompressionUtil.class);
|
||||
private static final RequestListener<Bitmap> bitmapRequestListener = new RequestListener<>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
|
||||
if (e != null) {
|
||||
List<Throwable> causes = e.getRootCauses();
|
||||
for (int i = 0, size = causes.size(); i < size; i++) {
|
||||
Log.i(TAG, "Root cause (" + (i + 1) + " of " + size + ")", causes.get(i));
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "Loading failed: " + model);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
private ImageCompressionUtil () {}
|
||||
|
||||
@@ -60,6 +83,7 @@ public final class ImageCompressionUtil {
|
||||
try {
|
||||
scaledBitmap = GlideApp.with(context.getApplicationContext())
|
||||
.asBitmap()
|
||||
.addListener(bitmapRequestListener)
|
||||
.load(glideModel)
|
||||
.skipMemoryCache(true)
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
|
||||
@@ -122,6 +122,15 @@ public class CallNotificationBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
public static @NonNull Notification getStartingNotification(@NonNull Context context) {
|
||||
return new NotificationCompat.Builder(context, NotificationChannels.getInstance().CALL_STATUS)
|
||||
.setSmallIcon(R.drawable.ic_call_secure_white_24dp)
|
||||
.setOngoing(true)
|
||||
.setContentTitle(context.getString(R.string.NotificationBarManager__starting_signal_call_service))
|
||||
.setPriority(NotificationCompat.PRIORITY_MIN)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static @NonNull Notification getStoppingNotification(@NonNull Context context) {
|
||||
Intent contentIntent = new Intent(context, MainActivity.class);
|
||||
contentIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
||||
@@ -2187,7 +2187,7 @@
|
||||
</plurals>
|
||||
<!-- Text shown in a system notification that is used to summary how many chats have new messages. -->
|
||||
<plurals name="MessageNotifier_d_chats">
|
||||
<item quantity="one">%1$d chats</item>
|
||||
<item quantity="one">%1$d chat</item>
|
||||
<item quantity="other">%1$d chats</item>
|
||||
</plurals>
|
||||
<string name="MessageNotifier_d_new_messages_in_d_conversations">%1$d new messages in %2$d chats</string>
|
||||
|
||||
@@ -112,7 +112,7 @@ dependencyResolutionManagement {
|
||||
alias('libsignal-android').to('org.signal', 'libsignal-android').versionRef('libsignal-client')
|
||||
alias('signal-aesgcmprovider').to('org.signal:aesgcmprovider:0.0.3')
|
||||
alias('signal-ringrtc').to('org.signal:ringrtc-android:2.27.0')
|
||||
alias('signal-android-database-sqlcipher').to('org.signal:sqlcipher-android:4.5.4-S1')
|
||||
alias('signal-android-database-sqlcipher').to('org.signal:sqlcipher-android:4.5.4-S2')
|
||||
|
||||
// Third Party
|
||||
alias('greenrobot-eventbus').to('org.greenrobot:eventbus:3.0.0')
|
||||
|
||||
@@ -5896,19 +5896,9 @@ https://docs.gradle.org/current/userguide/dependency_verification.html
|
||||
<sha256 value="5133a1cf4f3fbf43dc3ab0dd536602bb3d89bb9a1e71b0c86adc034becc11d1f" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.signal" name="sqlcipher-android" version="4.5.3-FTS-S2">
|
||||
<artifact name="sqlcipher-android-4.5.3-FTS-S2.aar">
|
||||
<sha256 value="c7c90d6cb382dc7e599c0c5f515018b820c5a037d9a1655adc72adc04074fc5e" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.signal" name="sqlcipher-android" version="4.5.3-FTS-S3">
|
||||
<artifact name="sqlcipher-android-4.5.3-FTS-S3.aar">
|
||||
<sha256 value="5551f0bfc413f0d56fca2e6fdddaaae0547b6d35a8c438bb2f66e8e0a1144f10" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.signal" name="sqlcipher-android" version="4.5.4-S1">
|
||||
<artifact name="sqlcipher-android-4.5.4-S1.aar">
|
||||
<sha256 value="99b60cc1df0606a3672ce9b87b8b1a43823f45ae027a6fd2167612f1ede080d5" origin="Generated by Gradle"/>
|
||||
<component group="org.signal" name="sqlcipher-android" version="4.5.4-S2">
|
||||
<artifact name="sqlcipher-android-4.5.4-S2.aar">
|
||||
<sha256 value="6f423eb00997e28dd116efa1c1511b78cce0e39e8753026cdc9820fb17140e99" origin="Generated by Gradle"/>
|
||||
</artifact>
|
||||
</component>
|
||||
<component group="org.slf4j" name="slf4j-api" version="1.6.4">
|
||||
|
||||
Reference in New Issue
Block a user