Prevented avatar read failures from crashing.

There are a handful of devices that refuse to use our AesGcmProvider,
and as a result they would crash with AssertionErrors when downloading
avatars. Still haven't found why, but for now, probably best to stop
these devices from crashing, since it puts them in a crash loop, and the
app is still usable without avatars.
This commit is contained in:
Greyson Parrelli 2019-07-02 10:06:20 -04:00
parent 4c30aa9f13
commit ed5f5adc9b

View File

@ -102,7 +102,12 @@ public class RetrieveProfileAvatarJob extends BaseJob implements InjectableType
InputStream avatarStream = receiver.retrieveProfileAvatar(profileAvatar, downloadDestination, profileKey, MAX_PROFILE_SIZE_BYTES);
File decryptDestination = File.createTempFile("avatar", "jpg", context.getCacheDir());
try {
Util.copy(avatarStream, new FileOutputStream(decryptDestination));
} catch (AssertionError e) {
throw new IOException("Failed to copy stream. Likely a Conscrypt issue.", e);
}
decryptDestination.renameTo(AvatarHelper.getAvatarFile(context, recipient.getAddress()));
} catch (PushNetworkException e) {
if (e.getCause() instanceof NonSuccessfulResponseCodeException) {