Loading k9mail/src/main/java/com/fsck/k9/ui/crypto/MessageCryptoHelper.java +13 −4 Original line number Diff line number Diff line Loading @@ -583,6 +583,11 @@ public class MessageCryptoHelper { } private void onCryptoFinished() { boolean currentPartIsFirstInQueue = partsToDecryptOrVerify.peekFirst() == currentCryptoPart; if (!currentPartIsFirstInQueue) { throw new IllegalStateException( "Trying to remove part from queue that is not the currently processed one!"); } if (currentCryptoPart != null) { partsToDecryptOrVerify.removeFirst(); currentCryptoPart = null; Loading Loading @@ -621,13 +626,15 @@ public class MessageCryptoHelper { throw new AssertionError("Callback may only be reattached for the same message!"); } synchronized (callbackLock) { if (queuedResult != null) { Log.d(K9.LOG_TAG, "Returning cached result to reattached callback"); } this.callback = callback; boolean hasCachedResult = queuedResult != null || queuedPendingIntent != null; if (hasCachedResult) { Log.d(K9.LOG_TAG, "Returning cached result or pending intent to reattached callback"); deliverResult(); } } } private void callbackPendingIntent(PendingIntent pendingIntent) { synchronized (callbackLock) { Loading Loading @@ -671,6 +678,8 @@ public class MessageCryptoHelper { callback.startPendingIntentForCryptoHelper( queuedPendingIntent.getIntentSender(), REQUEST_CODE_USER_INTERACTION, null, 0, 0, 0); queuedPendingIntent = null; } else { throw new IllegalStateException("deliverResult() called with no result!"); } } Loading Loading
k9mail/src/main/java/com/fsck/k9/ui/crypto/MessageCryptoHelper.java +13 −4 Original line number Diff line number Diff line Loading @@ -583,6 +583,11 @@ public class MessageCryptoHelper { } private void onCryptoFinished() { boolean currentPartIsFirstInQueue = partsToDecryptOrVerify.peekFirst() == currentCryptoPart; if (!currentPartIsFirstInQueue) { throw new IllegalStateException( "Trying to remove part from queue that is not the currently processed one!"); } if (currentCryptoPart != null) { partsToDecryptOrVerify.removeFirst(); currentCryptoPart = null; Loading Loading @@ -621,13 +626,15 @@ public class MessageCryptoHelper { throw new AssertionError("Callback may only be reattached for the same message!"); } synchronized (callbackLock) { if (queuedResult != null) { Log.d(K9.LOG_TAG, "Returning cached result to reattached callback"); } this.callback = callback; boolean hasCachedResult = queuedResult != null || queuedPendingIntent != null; if (hasCachedResult) { Log.d(K9.LOG_TAG, "Returning cached result or pending intent to reattached callback"); deliverResult(); } } } private void callbackPendingIntent(PendingIntent pendingIntent) { synchronized (callbackLock) { Loading Loading @@ -671,6 +678,8 @@ public class MessageCryptoHelper { callback.startPendingIntentForCryptoHelper( queuedPendingIntent.getIntentSender(), REQUEST_CODE_USER_INTERACTION, null, 0, 0, 0); queuedPendingIntent = null; } else { throw new IllegalStateException("deliverResult() called with no result!"); } } Loading