Run all AsyncTasks on thread pool executor

Should Fix #7002
This commit is contained in:
Moxie Marlinspike 2017-10-23 13:03:32 -07:00
parent 263846bba0
commit 17dd681dc8
57 changed files with 107 additions and 101 deletions

View File

@ -202,8 +202,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
}
};
if (Build.VERSION.SDK_INT >= 11) task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else task.execute();
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}

View File

@ -183,7 +183,7 @@ public class ConfirmIdentityDialog extends AlertDialog {
}
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
if (callback != null) callback.onClick(null, 0);
}

View File

@ -116,7 +116,7 @@ public abstract class ContactSelectionActivity extends PassphraseRequiredActionB
@Override
public void onRefresh() {
new RefreshDirectoryTask(this).execute(getApplicationContext());
new RefreshDirectoryTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getApplicationContext());
}
@Override

View File

@ -588,7 +588,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
invalidateOptionsMenu();
if (fragment != null) fragment.setLastSeen(0);
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
}
@ -607,7 +607,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
}
@ -632,7 +632,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private void handleUnblock() {
@ -655,7 +655,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}).show();
}
@ -714,7 +714,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
protected void onPostExecute(Long result) {
sendComplete(result);
}
}.execute(endSessionMessage);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, endSessionMessage);
}
}
});
@ -786,7 +786,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
.setDistributionType(threadId, ThreadDatabase.DistributionTypes.BROADCAST);
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
@ -802,7 +802,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
.setDistributionType(threadId, ThreadDatabase.DistributionTypes.CONVERSATION);
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
@ -1005,7 +1005,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
updateToggleButtonState();
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private ListenableFuture<Boolean> initializeSecurity(final boolean currentSecureText,
@ -1043,7 +1043,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
future.set(true);
onSecurityUpdated();
}
}.execute(recipient);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, recipient);
return future;
}
@ -1091,7 +1091,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
protected void onPostExecute(Boolean isMmsEnabled) {
ConversationActivity.this.isMmsEnabled = isMmsEnabled;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private ListenableFuture<Boolean> initializeIdentityRecords() {
@ -1145,7 +1145,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
future.set(true);
}
}.execute(recipient);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, recipient);
return future;
}
@ -1427,7 +1427,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
future.set(result);
}
}.execute(thisThreadId);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, thisThreadId);
return future;
}
@ -1537,7 +1537,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
return null;
}
}.execute(threadId);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, threadId);
}
private void markLastSeen() {
@ -1547,7 +1547,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
DatabaseFactory.getThreadDatabase(ConversationActivity.this).setLastSeen(params[0]);
return null;
}
}.execute(threadId);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, threadId);
}
protected void sendComplete(long threadId) {
@ -1655,7 +1655,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
sendComplete(result);
future.set(null);
}
}.execute(outgoingMessage);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, outgoingMessage);
return future;
}
@ -1694,7 +1694,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
protected void onPostExecute(Long result) {
sendComplete(result);
}
}.execute(message);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, message);
}
private void updateToggleButtonState() {
@ -1715,7 +1715,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
.setDefaultSubscriptionId(recipient, subscriptionId.or(-1));
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@Override
@ -1789,7 +1789,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
PersistentBlobProvider.getInstance(ConversationActivity.this).delete(result.first);
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
} catch (InvalidMessageException e) {
@ -1821,7 +1821,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
PersistentBlobProvider.getInstance(ConversationActivity.this).delete(result.first);
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@Override
@ -1999,7 +1999,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
protected void onPostExecute(Void result) {
initializeIdentityRecords();
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}

View File

@ -347,7 +347,7 @@ public class ConversationFragment extends Fragment
return null;
}
}.execute(messageRecords.toArray(new MessageRecord[messageRecords.size()]));
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, messageRecords.toArray(new MessageRecord[messageRecords.size()]));
}
});
@ -388,7 +388,7 @@ public class ConversationFragment extends Fragment
MessageSender.resend(context, masterSecret, messageRecords[0]);
return null;
}
}.execute(message);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, message);
}
private void handleSaveAttachment(final MediaMmsMessageRecord message) {
@ -397,7 +397,7 @@ public class ConversationFragment extends Fragment
for (Slide slide : message.getSlideDeck().getSlides()) {
if ((slide.hasImage() || slide.hasVideo() || slide.hasAudio() || slide.hasDocument()) && slide.getUri() != null) {
SaveAttachmentTask saveTask = new SaveAttachmentTask(getActivity(), masterSecret, list);
saveTask.execute(new Attachment(slide.getUri(), slide.getContentType(), message.getDateReceived(), slide.getFileName().orNull()));
saveTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Attachment(slide.getUri(), slide.getContentType(), message.getDateReceived(), slide.getFileName().orNull()));
return;
}
}

View File

@ -493,7 +493,7 @@ public class ConversationItem extends LinearLayout
expirationManager.scheduleDeletion(id, mms, messageRecord.getExpiresIn());
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
} else {
this.expirationTimer.setVisibility(View.GONE);

View File

@ -215,7 +215,7 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private void handleInvite() {

View File

@ -197,7 +197,7 @@ public class ConversationListFragment extends Fragment
reminderView.showReminder(reminder.get());
}
}
}.execute(getActivity());
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity());
}
private void initializeListAdapter() {
@ -248,7 +248,7 @@ public class ConversationListFragment extends Fragment
else DatabaseFactory.getThreadDatabase(getActivity()).archiveConversation(threadId);
}
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private void handleDeleteAllSelected() {
@ -294,7 +294,7 @@ public class ConversationListFragment extends Fragment
actionMode = null;
}
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
});
@ -463,7 +463,7 @@ public class ConversationListFragment extends Fragment
protected void reverseAction(@Nullable Long parameter) {
DatabaseFactory.getThreadDatabase(getActivity()).archiveConversation(threadId);
}
}.execute(threadId);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, threadId);
} else {
new SnackbarAsyncTask<Long>(getView(),
getResources().getQuantityString(R.plurals.ConversationListFragment_conversations_archived, 1, 1),
@ -491,7 +491,7 @@ public class ConversationListFragment extends Fragment
MessageNotifier.updateNotification(getActivity(), masterSecret);
}
}
}.execute(threadId);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, threadId);
}
}

View File

@ -270,7 +270,7 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje
avatar.setImageDrawable(result.second.asDrawable(CreateProfileActivity.this, 0));
}
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else if (!excludeSystem) {
SystemProfileUtil.getSystemProfileAvatar(this, new ProfileMediaConstraints()).addListener(new ListenableFuture.Listener<byte[]>() {
@Override
@ -398,7 +398,7 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje
Toast.makeText(CreateProfileActivity.this, R.string.CreateProfileActivity_problem_setting_profile, Toast.LENGTH_LONG).show();
}
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private void handleFinishedLegacy() {

View File

@ -105,7 +105,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
ProgressBar determinateProgress = (ProgressBar)findViewById(R.id.determinate_progress);
new DatabaseUpgradeTask(indeterminateProgress, determinateProgress)
.execute(VersionTracker.getLastSeenVersion(this));
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, VersionTracker.getLastSeenVersion(this));
} else {
VersionTracker.updateLastSeenVersion(this);
updateNotifications(this, masterSecret);
@ -150,7 +150,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
MessageNotifier.updateNotification(context, masterSecret);
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public interface DatabaseUpgradeListener {

View File

@ -2,6 +2,7 @@ package org.thoughtcrime.securesms;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
@ -210,6 +211,6 @@ public class DeviceActivity extends PassphraseRequiredActionBarActivity
getSupportFragmentManager().popBackStackImmediate();
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}

View File

@ -3,6 +3,7 @@ package org.thoughtcrime.securesms;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.support.v4.app.LoaderManager;
@ -183,7 +184,7 @@ public class DeviceListFragment extends ListFragment
super.onPostExecute(result);
getLoaderManager().restartLoader(0, null, DeviceListFragment.this);
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@Override

View File

@ -18,6 +18,7 @@
package org.thoughtcrime.securesms;
import android.app.Activity;
import android.content.AsyncTaskLoader;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
@ -171,7 +172,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
}
private void addSelectedContacts(@NonNull Recipient... recipients) {
new AddMembersTask(this).execute(recipients);
new AddMembersTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, recipients);
}
private void addSelectedContacts(@NonNull Collection<Recipient> recipients) {
@ -205,7 +206,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
final Address groupAddress = getIntent().getParcelableExtra(GROUP_ADDRESS_EXTRA);
if (groupAddress != null) {
new FillExistingGroupInfoAsyncTask(this).execute(groupAddress.toGroupString());
new FillExistingGroupInfoAsyncTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, groupAddress.toGroupString());
}
}
@ -253,15 +254,15 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
return;
}
if (isSignalGroup()) {
new CreateSignalGroupTask(this, masterSecret, avatarBmp, getGroupName(), getAdapter().getRecipients()).execute();
new CreateSignalGroupTask(this, masterSecret, avatarBmp, getGroupName(), getAdapter().getRecipients()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
new CreateMmsGroupTask(this, masterSecret, getAdapter().getRecipients()).execute();
new CreateMmsGroupTask(this, masterSecret, getAdapter().getRecipients()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
private void handleGroupUpdate() {
new UpdateSignalGroupTask(this, masterSecret, groupToUpdate.get().id, avatarBmp,
getGroupName(), getAdapter().getRecipients()).execute();
getGroupName(), getAdapter().getRecipients()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private void handleOpenConversation(long threadId, Recipient recipient) {

View File

@ -49,7 +49,7 @@ public class GroupMembersDialog extends AsyncTask<Void, Void, List<Recipient>> {
}
public void display() {
execute();
executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private static class GroupMembersOnClickListener implements DialogInterface.OnClickListener {

View File

@ -112,7 +112,7 @@ public class ImportExportFragment extends Fragment {
builder.setPositiveButton(getActivity().getString(R.string.ImportFragment_import), new AlertDialog.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
new ImportPlaintextBackupTask().execute();
new ImportPlaintextBackupTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
builder.setNegativeButton(getActivity().getString(R.string.ImportFragment_cancel), null);
@ -127,7 +127,7 @@ public class ImportExportFragment extends Fragment {
builder.setPositiveButton(getActivity().getString(R.string.ExportFragment_export), new Dialog.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
new ExportPlaintextTask().execute();
new ExportPlaintextTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
builder.setNegativeButton(getActivity().getString(R.string.ExportFragment_cancel), null);

View File

@ -5,6 +5,7 @@ import android.annotation.TargetApi;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
@ -116,8 +117,9 @@ public class InviteActivity extends PassphraseRequiredActionBarActivity implemen
private void sendSmsInvites() {
new SendSmsInvitesAsyncTask(this, inviteText.getText().toString())
.execute(contactsFragment.getSelectedContacts()
.toArray(new String[contactsFragment.getSelectedContacts().size()]));
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
contactsFragment.getSelectedContacts()
.toArray(new String[contactsFragment.getSelectedContacts().size()]));
}
private void updateSmsButtonText() {

View File

@ -20,6 +20,7 @@ import android.annotation.TargetApi;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
@ -214,7 +215,7 @@ public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity im
public void onClick(DialogInterface dialogInterface, int i) {
SaveAttachmentTask saveTask = new SaveAttachmentTask(MediaPreviewActivity.this, masterSecret, image);
long saveDate = (date > 0) ? date : System.currentTimeMillis();
saveTask.execute(new Attachment(mediaUri, mediaType, saveDate, null));
saveTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Attachment(mediaUri, mediaType, saveDate, null));
}
});
}

View File

@ -296,7 +296,7 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
if (messageRecord == null) {
finish();
} else {
new MessageRecipientAsyncTask(this, messageRecord).execute();
new MessageRecipientAsyncTask(this, messageRecord).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}

View File

@ -119,7 +119,7 @@ public class MessageRecipientListItem extends RelativeLayout
errorDescription.setVisibility(View.GONE);
actionDescription.setVisibility(View.VISIBLE);
actionDescription.setText(R.string.message_recipients_list_item__resending);
new ResendAsyncTask(masterSecret, record, networkFailure).execute();
new ResendAsyncTask(masterSecret, record, networkFailure).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
});
} else {
if (record.isOutgoing()) {

View File

@ -108,7 +108,7 @@ public class PassphraseChangeActivity extends PassphraseActivity {
this.newPassphrase.setError(getString(R.string.PassphraseChangeActivity_enter_new_passphrase_exclamation));
this.newPassphrase.requestFocus();
} else {
new ChangePassphraseTask(this).execute(original, passphrase);
new ChangePassphraseTask(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, original, passphrase);
}
}

View File

@ -47,7 +47,7 @@ public class PassphraseCreateActivity extends PassphraseActivity {
}
private void initializeResources() {
new SecretGenerator().execute(MasterSecretUtil.UNENCRYPTED_PASSPHRASE);
new SecretGenerator().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, MasterSecretUtil.UNENCRYPTED_PASSPHRASE);
}
private class SecretGenerator extends AsyncTask<String, Void, Void> {

View File

@ -240,7 +240,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
toolbarLayout.setTitle(recipient.toShortString());
toolbarLayout.setContentScrimColor(recipient.getColor().toActionBarColor(RecipientPreferenceActivity.this));
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
@Override
@ -443,7 +443,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
.setRingtone(recipient, params[0]);
return null;
}
}.execute(value);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, value);
return false;
}
@ -462,7 +462,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
.setVibrate(recipient, vibrateState);
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
return false;
}
@ -492,7 +492,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
}
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
return true;
}
@ -532,7 +532,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
.setMuted(recipient, until);
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
@ -608,7 +608,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
.add(new MultiDeviceBlockedUpdateJob(context));
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
}

View File

@ -557,7 +557,7 @@ public class RegistrationProgressActivity extends BaseActionBarActivity {
return NETWORK_ERROR;
}
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
@ -646,7 +646,7 @@ public class RegistrationProgressActivity extends BaseActionBarActivity {
return NETWORK_ERROR;
}
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}

View File

@ -134,7 +134,7 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity
} else {
fragmentContainer.setVisibility(View.GONE);
progressWheel.setVisibility(View.VISIBLE);
new ResolveMediaTask(context).execute(streamExtra);
new ResolveMediaTask(context).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, streamExtra);
}
}

View File

@ -288,7 +288,7 @@ public class VerifyIdentityActivity extends PassphraseRequiredActionBarActivity
setFingerprintViews(fingerprint, true);
getActivity().supportInvalidateOptionsMenu();
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
setHasOptionsMenu(true);
}
@ -617,7 +617,7 @@ public class VerifyIdentityActivity extends PassphraseRequiredActionBarActivity
}
return null;
}
}.execute(recipient);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, recipient);
}
}

View File

@ -96,7 +96,7 @@ public class ZoomingImageView extends FrameLayout {
setSubsamplingImageViewUri(uri);
}
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private void setImageViewUri(MasterSecret masterSecret, Uri uri) {

View File

@ -450,7 +450,7 @@ public class CameraView extends ViewGroup {
Log.w(TAG, "previewFormat: " + camera.getParameters().getPreviewFormat());
Log.w(TAG, "croppingRect: " + croppingRect.toString());
Log.w(TAG, "rotation: " + rotation);
new CaptureTask(previewSize, rotation, croppingRect).execute(data);
new CaptureTask(previewSize, rotation, croppingRect).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, data);
}
});
}

View File

@ -89,7 +89,7 @@ public class RecentEmojiPageModel implements EmojiPageModel {
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private String[] toReversePrimitiveArray(@NonNull LinkedHashSet<String> emojiSet) {

View File

@ -62,7 +62,7 @@ public class EmojiPageBitmap {
@Override protected void onPostExecute(Void aVoid) {
task = null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
return task;
}

View File

@ -57,7 +57,7 @@ public class UntrustedSendDialog extends AlertDialog.Builder implements DialogIn
protected void onPostExecute(Void result) {
resendListener.onResendMessage();
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public interface ResendListener {

View File

@ -58,7 +58,7 @@ public class UnverifiedSendDialog extends AlertDialog.Builder implements DialogI
protected void onPostExecute(Void result) {
resendListener.onResendMessage();
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public interface ResendListener {

View File

@ -26,7 +26,7 @@ public class InviteReminder extends Reminder {
DatabaseFactory.getRecipientDatabase(context).setSeenInviteReminder(recipient, true);
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
}

View File

@ -302,7 +302,7 @@ public class WebRtcCallScreen extends FrameLayout implements RecipientModifiedLi
protected void onPostExecute(final ContactPhoto contactPhoto) {
WebRtcCallScreen.this.photo.setImageDrawable(contactPhoto.asCallCard(context));
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
this.name.setText(recipient.getName());

View File

@ -36,7 +36,7 @@ public class GiphyProxySelector extends ProxySelector {
}
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
initializeGiphyProxy();
}

View File

@ -126,7 +126,7 @@ public class GiphyActivity extends PassphraseRequiredActionBarActivity
Log.w(TAG, "Resolved Uri is no longer the selected element...");
}
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private static class GiphyFragmentPagerAdapter extends FragmentPagerAdapter {

View File

@ -117,7 +117,7 @@ public abstract class GiphyFragment extends Fragment implements LoaderManager.Lo
protected void onPostExecute(List<GiphyImage> images) {
giphyAdapter.addImages(images);
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
}

View File

@ -303,7 +303,7 @@ public class AttachmentManager {
Log.w(TAG, "local slide with size " + mediaSize + " took " + (System.currentTimeMillis() - start) + "ms");
return mediaType.createSlide(context, uri, fileName, mimeType, mediaSize);
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public boolean isAttachmentPresent() {

View File

@ -71,7 +71,7 @@ public class AndroidAutoHeardReceiver extends MasterSecretBroadcastReceiver {
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
}

View File

@ -93,7 +93,7 @@ public class AndroidAutoReplyReceiver extends MasterSecretBroadcastReceiver {
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}

View File

@ -35,7 +35,7 @@ public class DeleteNotificationReceiver extends BroadcastReceiver {
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
}

View File

@ -61,7 +61,7 @@ public class MarkReadReceiver extends MasterSecretBroadcastReceiver {
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}

View File

@ -518,7 +518,7 @@ public class MessageNotifier {
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}

View File

@ -86,7 +86,7 @@ public class RemoteReplyReceiver extends MasterSecretBroadcastReceiver {
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}

View File

@ -6,6 +6,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.annotation.NonNull;
@ -218,7 +219,7 @@ public class AdvancedPreferenceFragment extends CorrectedPreferenceFragment {
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
new DisablePushMessagesTask((CheckBoxPreference)preference).execute();
new DisablePushMessagesTask((CheckBoxPreference)preference).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
builder.show();

View File

@ -53,7 +53,7 @@ public class MmsPreferencesFragment extends CorrectedPreferenceFragment {
@Override
public void onResume() {
super.onResume();
new LoadApnDefaultsTask().execute();
new LoadApnDefaultsTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private class LoadApnDefaultsTask extends AsyncTask<Void, Void, LegacyMmsConnection.Apn> {

View File

@ -106,7 +106,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
MessageNotifier.updateNotification(getActivity(), masterSecret);
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
return super.onPreferenceChange(preference, value);
}

View File

@ -87,7 +87,7 @@ public class ProfilePreference extends Preference {
protected void onPostExecute(@NonNull Drawable contactPhoto) {
avatarView.setImageDrawable(contactPhoto);
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
if (!TextUtils.isEmpty(profileName)) {
profileNameView.setText(profileName);

View File

@ -314,7 +314,7 @@ public class RingtonePreferenceDialogFragmentCompat extends PreferenceDialogFrag
}
}
};
installTask.execute(fileUri);
installTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, fileUri);
} else {
ListView listView = ((AlertDialog) getDialog()).getListView();
listView.setItemChecked(selectedIndex, true);

View File

@ -56,7 +56,7 @@ public class SystemProfileUtil {
future.set(result);
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
return future;
}
@ -101,7 +101,7 @@ public class SystemProfileUtil {
protected void onPostExecute(@Nullable String result) {
future.set(result);
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
return future;
}

View File

@ -54,7 +54,7 @@ public class UnknownSenderView extends FrameLayout {
if (threadId != -1) DatabaseFactory.getThreadDatabase(context).setHasSent(threadId, true);
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
})
.setNegativeButton(android.R.string.cancel, null)
.show();
@ -95,7 +95,7 @@ public class UnknownSenderView extends FrameLayout {
if (threadId != -1) DatabaseFactory.getThreadDatabase(context).setHasSent(threadId, true);
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
})
.setNegativeButton(android.R.string.cancel, null)
.show();

View File

@ -33,7 +33,7 @@ public class AccountManagerFactory {
}
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
return new SignalServiceAccountManager(new SignalServiceNetworkAccess(context).getConfiguration(number),

View File

@ -165,7 +165,7 @@ public class ScribbleActivity extends PassphraseRequiredActionBarActivity implem
protected void onPostExecute(@Nullable Bitmap bitmap) {
addSticker(bitmap);
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
}

View File

@ -135,7 +135,7 @@ public class ScribbleView extends FrameLayout {
canvasView.render(canvas);
future.set(bitmap);
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
return future;
}

View File

@ -115,7 +115,7 @@ public class KeyCachingService extends Service {
}
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
@ -204,7 +204,7 @@ public class KeyCachingService extends Service {
MessageNotifier.updateNotification(KeyCachingService.this, null);
return null;
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private void handleDisableService() {

View File

@ -62,7 +62,7 @@ public class IdentityUtil {
protected void onPostExecute(Optional<IdentityRecord> result) {
future.set(result);
}
}.execute(recipient);
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, recipient);
return future;
}

View File

@ -12,7 +12,7 @@ import org.thoughtcrime.securesms.database.ThreadDatabase;
public class Trimmer {
public static void trimAllThreads(Context context, int threadLengthLimit) {
new TrimmingProgressTask(context).execute(threadLengthLimit);
new TrimmingProgressTask(context).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, threadLengthLimit);
}
private static class TrimmingProgressTask extends AsyncTask<Integer, Integer, Void> implements ThreadDatabase.ProgressListener {

View File

@ -85,7 +85,7 @@ public abstract class SnackbarAsyncTask<Params>
progressDialog = null;
}
}
}.execute();
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
protected abstract void executeAction(@Nullable Params parameter);