Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19cd7b99 authored by Vincent Breitmoser's avatar Vincent Breitmoser
Browse files

add some @WorkerThread annotations

parent 9f58de59
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ import java.util.List;

import android.content.Context;
import android.support.annotation.VisibleForTesting;
import android.support.annotation.WorkerThread;

import com.fsck.k9.R;
import com.fsck.k9.helper.HtmlConverter;
@@ -44,6 +45,7 @@ public class MessageViewInfoExtractor {

    private MessageViewInfoExtractor() { }

    @WorkerThread
    public static MessageViewInfo extractMessageForView(Context context,
            Message message, MessageCryptoAnnotations annotations) throws MessagingException {

+7 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ import android.net.Uri;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.util.Log;
import android.support.annotation.WorkerThread;

import com.fsck.k9.Globals;
import com.fsck.k9.K9;
@@ -40,7 +41,9 @@ public class AttachmentInfoExtractor {
        this.context = context;
    }

    public List<AttachmentViewInfo> extractAttachmentInfos(List<Part> attachmentParts) throws MessagingException {
    @WorkerThread
    public List<AttachmentViewInfo> extractAttachmentInfos(List<Part> attachmentParts)
            throws MessagingException {

        List<AttachmentViewInfo> attachments = new ArrayList<>();
        for (Part part : attachmentParts) {
@@ -50,6 +53,7 @@ public class AttachmentInfoExtractor {
        return attachments;
    }

    @WorkerThread
    public AttachmentViewInfo extractAttachmentInfo(Part part) throws MessagingException {
        Uri uri;
        long size;
@@ -93,6 +97,7 @@ public class AttachmentInfoExtractor {
        return extractAttachmentInfo(part, Uri.EMPTY, AttachmentViewInfo.UNKNOWN_SIZE);
    }

    @WorkerThread
    private AttachmentViewInfo extractAttachmentInfo(Part part, Uri uri, long size) throws MessagingException {
        boolean firstClassAttachment = true;

@@ -128,6 +133,7 @@ public class AttachmentInfoExtractor {
        return new AttachmentViewInfo(mimeType, name, attachmentSize, uri, firstClassAttachment, part);
    }

    @WorkerThread
    private long extractAttachmentSize(String contentDisposition, long size) {
        if (size != AttachmentViewInfo.UNKNOWN_SIZE) {
            return size;
+0 −1
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ import com.fsck.k9.activity.MessageCompose;
import com.fsck.k9.activity.MessageCompose.Action;
import com.fsck.k9.helper.HtmlConverter;
import com.fsck.k9.helper.QuotedMessageHelper;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.Part;
import com.fsck.k9.mail.internet.MessageExtractor;
+2 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ package com.fsck.k9.ui.message;
import android.content.AsyncTaskLoader;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.annotation.WorkerThread;
import android.util.Log;

import com.fsck.k9.K9;
@@ -45,6 +46,7 @@ public class LocalMessageExtractorLoader extends AsyncTaskLoader<MessageViewInfo
    }

    @Override
    @WorkerThread
    public MessageViewInfo loadInBackground() {
        try {
            return MessageViewInfoExtractor.extractMessageForView(getContext(), message, annotations);