Improve logging around attachment compression failures.

This commit is contained in:
Greyson Parrelli 2022-09-13 09:44:06 -04:00
parent a340ebf74a
commit 6417f5cce0
2 changed files with 13 additions and 1 deletions

View file

@ -289,7 +289,7 @@ public class MessageSender {
final long threadId,
final SmsDatabase.InsertListener insertListener)
{
Log.i(TAG, "Sending media message with pre-uploads to " + message.getRecipient().getId() + ", thread: " + threadId);
Log.i(TAG, "Sending media message with pre-uploads to " + message.getRecipient().getId() + ", thread: " + threadId + ", pre-uploads: " + preUploadResults);
Preconditions.checkArgument(message.getAttachments().isEmpty(), "If the media is pre-uploaded, there should be no attachments on the message.");
try {
@ -807,6 +807,11 @@ public class MessageSender {
ParcelUtil.writeStringCollection(dest, jobIds);
dest.writeParcelable(media, flags);
}
@Override
public @NonNull String toString() {
return "{ID: " + attachmentId.getRowId() + ", URI: " + media.getUri() + ", Jobs: " + jobIds.stream().map(j -> "JOB::" + j).collect(Collectors.toList()) + "}";
}
}
public enum MessageSentEvent {

View file

@ -9,7 +9,9 @@ import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.engine.GlideException;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.mms.GlideApp;
import java.io.ByteArrayOutputStream;
@ -17,6 +19,8 @@ import java.util.concurrent.ExecutionException;
public final class ImageCompressionUtil {
private static final String TAG = Log.tag(ImageCompressionUtil.class);
private ImageCompressionUtil () {}
/**
@ -63,6 +67,9 @@ public final class ImageCompressionUtil {
.submit(maxDimension, maxDimension)
.get();
} catch (ExecutionException | InterruptedException e) {
if (e.getCause() instanceof GlideException) {
((GlideException) e.getCause()).logRootCauses(TAG);
}
throw new BitmapDecodingException(e);
}