Commit fe4a3436 authored by Sam Maier's avatar Sam Maier Committed by Commit Bot

Android: Removing more Params usages in AsyncTask

This is a follow-up to
https://chromium-review.googlesource.com/c/chromium/src/+/1136730

I appear to have missed a few sites in the previous CL.

Bug: 843745
Change-Id: I541f0db2e9cf8e419a3303b7ab2a08a1df0c0372
Reviewed-on: https://chromium-review.googlesource.com/1148982
Commit-Queue: Sam Maier <smaier@chromium.org>
Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577909}
parent d3cf1351
......@@ -173,10 +173,10 @@ public final class DefaultBrowserInfo {
.isStartupSuccessfullyCompleted();
try {
new AsyncTask<Context, Void, DefaultInfo>() {
new AsyncTask<Void, Void, DefaultInfo>() {
@Override
protected DefaultInfo doInBackground(Context... params) {
Context context = params[0];
protected DefaultInfo doInBackground(Void... params) {
Context context = ContextUtils.getApplicationContext();
PackageManager pm = context.getPackageManager();
......@@ -222,8 +222,7 @@ public final class DefaultBrowserInfo {
getDefaultBrowserUmaState(info), MobileDefaultBrowserState.NUM_ENTRIES);
}
}
.executeOnExecutor(
AsyncTask.THREAD_POOL_EXECUTOR, ContextUtils.getApplicationContext());
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} catch (RejectedExecutionException ex) {
// Fail silently here since this is not a critical task.
}
......
......@@ -67,22 +67,25 @@ class FileDeletionQueue {
System.out.println("dtrainor: Starting " + file.getName());
mTask = new FileDeletionTask();
mTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, file);
mTask = new FileDeletionTask(file);
mTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
private class FileDeletionTask extends AsyncTask<File, Void, Void> {
// AsyncTask implementation.
private class FileDeletionTask extends AsyncTask<Void, Void, Void> {
private final File mFile;
FileDeletionTask(File file) {
mFile = file;
}
@Override
protected Void doInBackground(File... params) {
System.out.println("dtrainor: Deleting " + params[0].getName());
mDeleter.onResult(params[0]);
protected Void doInBackground(Void... params) {
mDeleter.onResult(mFile);
return null;
}
@Override
protected void onPostExecute(Void result) {
System.out.println("dtrainor: Post");
super.onPostExecute(result);
mTask = null;
deleteNextFile();
......
......@@ -95,9 +95,9 @@ public final class ConnectivityChecker {
postResult(callback, ConnectivityCheckResult.ERROR);
return;
}
new AsyncTask<String, Void, Integer>() {
new AsyncTask<Void, Void, Integer>() {
@Override
protected Integer doInBackground(String... strings) {
protected Integer doInBackground(Void... params) {
try {
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setInstanceFollowRedirects(false);
......@@ -127,7 +127,8 @@ public final class ConnectivityChecker {
protected void onPostExecute(Integer result) {
callback.onResult(result);
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
/**
......
......@@ -150,12 +150,13 @@ public class WebApkServiceConnectionManager {
public void disconnectAll(final Context appContext) {
if (mConnections.isEmpty()) return;
Connection[] values = mConnections.values().toArray(new Connection[mConnections.size()]);
final Connection[] values =
mConnections.values().toArray(new Connection[mConnections.size()]);
mConnections.clear();
new AsyncTask<Connection, Void, Void>() {
new AsyncTask<Void, Void, Void>() {
@Override
protected final Void doInBackground(Connection... values) {
protected final Void doInBackground(Void... params) {
for (Connection connection : values) {
if (connection.getService() != null) {
appContext.unbindService(connection);
......@@ -163,7 +164,8 @@ public class WebApkServiceConnectionManager {
}
return null;
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, values);
}
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
public WebApkServiceConnectionManager(String category, String action) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment