From c00d290df73effc2477d494583377ffb1ffc517f Mon Sep 17 00:00:00 2001 From: Taesu Lee Date: Wed, 12 Feb 2020 16:37:04 +0900 Subject: [PATCH] Actual attachments size is the minimum size except images Only images can be compressed before sending. Actual size got from a content uri is used for computing the minimum size for others. Test: Manual Change-Id: Id8d6ec24f80fe0eae70b6b1686ca7b199c70e313 Signed-off-by: Taesu Lee --- .../messaging/datamodel/data/MessagePartData.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/com/android/messaging/datamodel/data/MessagePartData.java b/src/com/android/messaging/datamodel/data/MessagePartData.java index fffaca8..1bb024d 100644 --- a/src/com/android/messaging/datamodel/data/MessagePartData.java +++ b/src/com/android/messaging/datamodel/data/MessagePartData.java @@ -492,16 +492,8 @@ public class MessagePartData implements Parcelable { } // Other images should be arbitrarily resized by ImageResizer before sending. return MmsUtils.MIN_IMAGE_BYTE_SIZE; - } else if (isAudio()) { - // Audios are already recorded with the lowest sampling settings (AMR_NB), so just - // return the file size as the minimum size. - return UriUtil.getContentSize(mContentUri); - } else if (isVideo()) { - final int mediaDurationMs = UriUtil.getMediaDurationMs(mContentUri); - return MmsUtils.MIN_VIDEO_BYTES_PER_SECOND * mediaDurationMs - / TimeUnit.SECONDS.toMillis(1); - } else if (isVCard()) { - // We can't compress vCards. + } else if (isMedia()) { + // We can't compress attachments except images. return UriUtil.getContentSize(mContentUri); } else { // This is some unknown media type that we don't know how to handle. Log an error