From cbba8c0d76af3cf84250c42d73eb2cb1cafdc110 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Thu, 9 Mar 2017 15:04:16 -0800 Subject: [PATCH] Update signal-service // FREEBIE --- build.gradle | 7 ++++--- gradle/wrapper/gradle-wrapper.properties | 2 +- .../securesms/database/AttachmentDatabase.java | 1 - .../thoughtcrime/securesms/jobs/AttachmentDownloadJob.java | 7 ++++--- src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java | 3 ++- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index cc7d7e0218..ed5ac6ce89 100644 --- a/build.gradle +++ b/build.gradle @@ -59,7 +59,7 @@ dependencies { compile 'org.whispersystems:jobmanager:1.0.2' compile 'org.whispersystems:libpastelog:1.0.7' - compile 'org.whispersystems:signal-service-android:2.5.2' + compile 'org.whispersystems:signal-service-android:2.5.3' compile 'org.whispersystems:webrtc-android:M57' compile "me.leolin:ShortcutBadger:1.10-WS1" @@ -129,7 +129,7 @@ dependencyVerification { 'com.google.android.gms:play-services-places:abf3a4a3b146ec7e6e753be62775e512868cf37d6f88ffe2d81167b33b57132b', 'org.whispersystems:jobmanager:506f679fc2fcf7bb6d10f00f41d6f6ea0abf75c70dc95b913398661ad538a181', 'org.whispersystems:libpastelog:bb331d9a98240fc139101128ba836c1edec3c40e000597cdbb29ebf4cbf34d88', - 'org.whispersystems:signal-service-android:030294f4f1517f032892f8100e649ac2ee6db39cf5cfaf42b00cc22ccd66b14b', + 'org.whispersystems:signal-service-android:28a5368cb1336106ba7732aeaf0c5a33ef8fb22500c41f38ad8147375f59073b', 'org.whispersystems:webrtc-android:acf78f6148c2e946b846cc5395887079ba37ddb892bf0d993fed18f1b9f521f8', 'me.leolin:ShortcutBadger:e8e39df8a59d8211a30f40b1eeab21b3fa57b3f3e0f03abb995f82d66588778c', 'se.emilsjolander:stickylistheaders:a08ca948aa6b220f09d82f16bbbac395f6b78897e9eeac6a9f0b0ba755928eeb', @@ -165,7 +165,7 @@ dependencyVerification { 'com.google.android.gms:play-services-basement:95dd882c5ffba15b9a99de3fefb05d3a01946623af67454ca00055d222f85a8d', 'com.google.android.gms:play-services-iid:54e919f9957b8b7820da7ee9b83471d00d0cac1cf08ddea8b5b41aea80bb1a70', 'org.whispersystems:signal-protocol-android:1b4b9d557c8eaf861797ff683990d482d4aa8e9f23d9b17ff0cc67a02f38cb19', - 'org.whispersystems:signal-service-java:49664fb9aedb6c39b303d20d167fa61bc25dc8d8bb148713ac29783383da1e90', + 'org.whispersystems:signal-service-java:969b4e1fb0b87e553d8b231a090002a03748e0444fa23afa1bc6f7065e8039ff', 'com.nineoldandroids:library:68025a14e3e7673d6ad2f95e4b46d78d7d068343aa99256b686fe59de1b3163a', 'javax.inject:javax.inject:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff', 'com.madgag.spongycastle:core:8d6240b974b0aca4d3da9c7dd44d42339d8a374358aca5fc98e50a995764511f', @@ -186,6 +186,7 @@ dependencyVerification { ] } + android { compileSdkVersion 25 buildToolsVersion '23.0.3' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7dc78b5e79..f6f05331de 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -#Sun Aug 28 20:14:40 PDT 2016 +#Thu Mar 09 11:46:40 PST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/src/org/thoughtcrime/securesms/database/AttachmentDatabase.java b/src/org/thoughtcrime/securesms/database/AttachmentDatabase.java index ad4adccd1a..fae47e9c62 100644 --- a/src/org/thoughtcrime/securesms/database/AttachmentDatabase.java +++ b/src/org/thoughtcrime/securesms/database/AttachmentDatabase.java @@ -158,7 +158,6 @@ public class AttachmentDatabase extends Database { notifyConversationListeners(DatabaseFactory.getMmsDatabase(context).getThreadIdForMessage(mmsId)); } - @VisibleForTesting public @Nullable DatabaseAttachment getAttachment(AttachmentId attachmentId) { SQLiteDatabase database = databaseHelper.getReadableDatabase(); Cursor cursor = null; diff --git a/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java b/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java index ad1bdbdde7..f3339bd53f 100644 --- a/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java +++ b/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java @@ -39,8 +39,9 @@ import javax.inject.Inject; import ws.com.google.android.mms.MmsException; public class AttachmentDownloadJob extends MasterSecretJob implements InjectableType { - private static final long serialVersionUID = 1L; - private static final String TAG = AttachmentDownloadJob.class.getSimpleName(); + private static final long serialVersionUID = 1L; + private static final int MAX_ATTACHMENT_SIZE = 150 * 1024 * 1024; + private static final String TAG = AttachmentDownloadJob.class.getSimpleName(); @Inject transient SignalServiceMessageReceiver messageReceiver; @@ -112,7 +113,7 @@ public class AttachmentDownloadJob extends MasterSecretJob implements Injectable attachmentFile = createTempFile(); SignalServiceAttachmentPointer pointer = createAttachmentPointer(masterSecret, attachment); - InputStream stream = messageReceiver.retrieveAttachment(pointer, attachmentFile, new ProgressListener() { + InputStream stream = messageReceiver.retrieveAttachment(pointer, attachmentFile, MAX_ATTACHMENT_SIZE, new ProgressListener() { @Override public void onAttachmentProgress(long total, long progress) { EventBus.getDefault().postSticky(new PartProgressEvent(attachment, total, progress)); diff --git a/src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java b/src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java index 763b11ba2e..24cbc444ab 100644 --- a/src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java +++ b/src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java @@ -30,6 +30,7 @@ import javax.inject.Inject; public class AvatarDownloadJob extends MasterSecretJob implements InjectableType { + private static final int MAX_AVATAR_SIZE = 20 * 1024 * 1024; private static final long serialVersionUID = 1L; private static final String TAG = AvatarDownloadJob.class.getSimpleName(); @@ -77,7 +78,7 @@ public class AvatarDownloadJob extends MasterSecretJob implements InjectableType attachment.deleteOnExit(); SignalServiceAttachmentPointer pointer = new SignalServiceAttachmentPointer(avatarId, contentType, key, relay, digest); - InputStream inputStream = receiver.retrieveAttachment(pointer, attachment); + InputStream inputStream = receiver.retrieveAttachment(pointer, attachment, MAX_AVATAR_SIZE); Bitmap avatar = BitmapUtil.createScaledBitmap(context, new AttachmentModel(attachment, key), 500, 500); database.updateAvatar(groupId, avatar);